libini_config  0.1.2
ini_comment.h
00001 /*
00002     INI LIBRARY
00003 
00004     Header file for comment object.
00005 
00006     Copyright (C) Dmitri Pal <dpal@redhat.com> 2010
00007 
00008     INI Library is free software: you can redistribute it and/or modify
00009     it under the terms of the GNU Lesser General Public License as published by
00010     the Free Software Foundation, either version 3 of the License, or
00011     (at your option) any later version.
00012 
00013     INI Library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU Lesser General Public License for more details.
00017 
00018     You should have received a copy of the GNU Lesser General Public License
00019     along with INI Library.  If not, see <http://www.gnu.org/licenses/>.
00020 */
00021 
00022 #ifndef INI_COMMENT_H
00023 #define INI_COMMENT_H
00024 
00025 #include <stdint.h>
00026 #include <stdio.h>
00027 
00028 #ifndef EOK
00029 #define EOK 0
00030 #endif
00031 
00032 struct ini_comment;
00033 
00037 int ini_comment_create(struct ini_comment **ic);
00038 
00042 void ini_comment_destroy(struct ini_comment *ic);
00043 
00048 int ini_comment_build(struct ini_comment *ic,
00049                       const char *line);
00050 
00063 int ini_comment_insert(struct ini_comment *ic,
00064                        uint32_t idx,
00065                        const char *line);
00066 
00067 /* Modify comment by appending a line. */
00068 int ini_comment_append(struct ini_comment *ic,
00069                        const char *line);
00070 
00071 /* Remove line from the comment.*/
00072 int ini_comment_remove(struct ini_comment *ic,
00073                        uint32_t idx);
00074 
00075 /* Clear line in the comment. Line is replaced with an empty line */
00076 int ini_comment_clear(struct ini_comment *ic,
00077                       uint32_t idx);
00078 
00079 /* Replace a line in the comment */
00080 int ini_comment_replace(struct ini_comment *ic,
00081                         uint32_t idx,
00082                         const char *line);
00083 
00084 /* Reset the comment - clean all lines.*/
00085 int ini_comment_reset(struct ini_comment *ic);
00086 
00087 /* Get number of lines */
00088 int ini_comment_get_numlines(struct ini_comment *ic,
00089                              uint32_t *num);
00090 
00091 /* Get line */
00092 int ini_comment_get_line(struct ini_comment *ic,
00093                          uint32_t idx,
00094                          char **line);
00095 
00096 /* Swap lines */
00097 int ini_comment_swap(struct ini_comment *ic,
00098                      uint32_t idx1,
00099                      uint32_t idx2);
00100 
00101 
00102 /* Internal function to print comment */
00103 void ini_comment_print(struct ini_comment *ic, FILE *file);
00104 
00105 
00106 #endif
 All Data Structures