createrepo_c library  0.2.1
C library for metadata manipulation
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
xml_file.h
1 /* createrepo_c - Library of routines for manipulation with repodata
2  * Copyright (C) 2013 Tomas Mlcoch
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (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, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17  * USA.
18  */
19 
20 #ifndef __C_CREATEREPOLIB_XML_FILE_H__
21 #define __C_CREATEREPOLIB_XML_FILE_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <glib.h>
28 #include "compression_wrapper.h"
29 #include "package.h"
30 
38 typedef enum {
44 
47 typedef struct {
52  int header;
54  int footer;
56  long pkgs;
58 } cr_XmlFile;
59 
66 #define cr_xmlfile_open_primary(FILENAME, COMTYPE, ERR) \
67  cr_xmlfile_open(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, ERR)
68 
76 #define cr_xmlfile_sopen_primary(FILENAME, COMTYPE, STAT, ERR) \
77  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, STAT, ERR)
78 
85 #define cr_xmlfile_open_filelists(FILENAME, COMTYPE, ERR) \
86  cr_xmlfile_open(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, ERR)
87 
95 #define cr_xmlfile_sopen_filelists(FILENAME, COMTYPE, STAT, ERR) \
96  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, STAT, ERR)
97 
104 #define cr_xmlfile_open_other(FILENAME, COMTYPE, ERR) \
105  cr_xmlfile_open(FILENAME, CR_XMLFILE_OTHER, COMTYPE, ERR)
106 
114 #define cr_xmlfile_sopen_other(FILENAME, COMTYPE, STAT, ERR) \
115  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_OTHER, COMTYPE, STAT, ERR)
116 
126 #define cr_xmlfile_open(FILENAME, TYPE, COMTYPE, ERR) \
127  cr_xmlfile_sopen(FILENAME, TYPE, COMTYPE, NULL, ERR)
128 
139 cr_XmlFile *cr_xmlfile_sopen(const char *filename,
140  cr_XmlFileType type,
141  cr_CompressionType comtype,
142  cr_ContentStat *stat,
143  GError **err);
144 
153 int cr_xmlfile_set_num_of_pkgs(cr_XmlFile *f, long num, GError **err);
154 
161 int cr_xmlfile_add_pkg(cr_XmlFile *f, cr_Package *pkg, GError **err);
162 
175 int cr_xmlfile_add_chunk(cr_XmlFile *f, const char *chunk, GError **err);
176 
182 int cr_xmlfile_close(cr_XmlFile *f, GError **err);
183 
184 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif /* __C_CREATEREPOLIB_XML_FILE_H__ */