solparser_image.h (1634B)
1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) 2 * Copyright (C) 2016-2018 CNRS 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 16 17 #ifndef SOLPARSER_IMAGE_H 18 #define SOLPARSER_IMAGE_H 19 20 #include <rsys/str.h> 21 22 struct solparser_image { 23 struct str filename; 24 }; 25 26 struct solparser_image_id { size_t i; }; 27 28 static INLINE void 29 solparser_image_init 30 (struct mem_allocator* allocator, 31 struct solparser_image* img) 32 { 33 ASSERT(img); 34 str_init(allocator, &img->filename); 35 } 36 37 static INLINE void 38 solparser_image_release(struct solparser_image* img) 39 { 40 ASSERT(img); 41 str_release(&img->filename); 42 } 43 44 static INLINE res_T 45 solparser_image_copy 46 (struct solparser_image* dst, 47 const struct solparser_image* src) 48 { 49 ASSERT(dst && src); 50 return str_copy(&dst->filename, &src->filename); 51 } 52 53 static INLINE res_T 54 solparser_image_copy_and_release 55 (struct solparser_image* dst, 56 struct solparser_image* src) 57 { 58 ASSERT(dst && src); 59 return str_copy_and_release(&dst->filename, &src->filename); 60 } 61 62 #endif /* SOLPARSER_IMAGE_H */ 63