libini_config  0.1.3
 All Data Structures Functions Groups Pages
ini_comment.h
1 /*
2  INI LIBRARY
3 
4  Header file for comment object.
5 
6  Copyright (C) Dmitri Pal <dpal@redhat.com> 2010
7 
8  INI Library is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  INI Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with INI Library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef INI_COMMENT_H
23 #define INI_COMMENT_H
24 
25 #include <stdint.h>
26 #include <stdio.h>
27 
28 #ifndef EOK
29 #define EOK 0
30 #endif
31 
32 struct ini_comment;
33 
37 int ini_comment_create(struct ini_comment **ic);
38 
42 void ini_comment_destroy(struct ini_comment *ic);
43 
48 int ini_comment_build(struct ini_comment *ic,
49  const char *line);
50 
63 int ini_comment_insert(struct ini_comment *ic,
64  uint32_t idx,
65  const char *line);
66 
67 /* Modify comment by appending a line. */
68 int ini_comment_append(struct ini_comment *ic,
69  const char *line);
70 
71 /* Remove line from the comment.*/
72 int ini_comment_remove(struct ini_comment *ic,
73  uint32_t idx);
74 
75 /* Clear line in the comment. Line is replaced with an empty line */
76 int ini_comment_clear(struct ini_comment *ic,
77  uint32_t idx);
78 
79 /* Replace a line in the comment */
80 int ini_comment_replace(struct ini_comment *ic,
81  uint32_t idx,
82  const char *line);
83 
84 /* Reset the comment - clean all lines.*/
85 int ini_comment_reset(struct ini_comment *ic);
86 
87 /* Get number of lines */
88 int ini_comment_get_numlines(struct ini_comment *ic,
89  uint32_t *num);
90 
91 /* Get line */
92 int ini_comment_get_line(struct ini_comment *ic,
93  uint32_t idx,
94  char **line);
95 
96 /* Swap lines */
97 int ini_comment_swap(struct ini_comment *ic,
98  uint32_t idx1,
99  uint32_t idx2);
100 
101 
102 /* Internal function to print comment */
103 void ini_comment_print(struct ini_comment *ic, FILE *file);
104 
105 
106 #endif