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 
00055 int ini_comment_build_wl(struct ini_comment *ic,
00056                          const char *line,
00057                          uint32_t length);
00058 
00071 int ini_comment_insert(struct ini_comment *ic,
00072                        uint32_t idx,
00073                        const char *line);
00074 
00075 /* Modify comment by appending a line. */
00076 int ini_comment_append(struct ini_comment *ic,
00077                        const char *line);
00078 
00079 /* Remove line from the comment.*/
00080 int ini_comment_remove(struct ini_comment *ic,
00081                        uint32_t idx);
00082 
00083 /* Clear line in the comment. Line is replaced with an empty line */
00084 int ini_comment_clear(struct ini_comment *ic,
00085                       uint32_t idx);
00086 
00087 /* Replace a line in the comment */
00088 int ini_comment_replace(struct ini_comment *ic,
00089                         uint32_t idx,
00090                         const char *line);
00091 
00092 /* Reset the comment - clean all lines.*/
00093 int ini_comment_reset(struct ini_comment *ic);
00094 
00095 /* Get number of lines */
00096 int ini_comment_get_numlines(struct ini_comment *ic,
00097                              uint32_t *num);
00098 
00099 /* Get line */
00100 int ini_comment_get_line(struct ini_comment *ic,
00101                          uint32_t idx,
00102                          char **line,
00103                          uint32_t *line_len);
00104 
00105 /* Swap lines */
00106 int ini_comment_swap(struct ini_comment *ic,
00107                      uint32_t idx1,
00108                      uint32_t idx2);
00109 
00110 
00111 /* Internal function to print comment */
00112 void ini_comment_print(struct ini_comment *ic, FILE *file);
00113 
00114 
00115 #endif

Generated on Thu Dec 9 12:11:52 2010 for libini_config by  doxygen 1.4.7