createrepo_c library  0.9.1
C library for metadata manipulation
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 {
46 
49 typedef struct {
54  int header;
56  int footer;
58  long pkgs;
60 } cr_XmlFile;
61 
68 #define cr_xmlfile_open_primary(FILENAME, COMTYPE, ERR) \
69  cr_xmlfile_open(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, ERR)
70 
78 #define cr_xmlfile_sopen_primary(FILENAME, COMTYPE, STAT, ERR) \
79  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, STAT, ERR)
80 
87 #define cr_xmlfile_open_filelists(FILENAME, COMTYPE, ERR) \
88  cr_xmlfile_open(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, ERR)
89 
97 #define cr_xmlfile_sopen_filelists(FILENAME, COMTYPE, STAT, ERR) \
98  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, STAT, ERR)
99 
106 #define cr_xmlfile_open_other(FILENAME, COMTYPE, ERR) \
107  cr_xmlfile_open(FILENAME, CR_XMLFILE_OTHER, COMTYPE, ERR)
108 
116 #define cr_xmlfile_sopen_other(FILENAME, COMTYPE, STAT, ERR) \
117  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_OTHER, COMTYPE, STAT, ERR)
118 
125 #define cr_xmlfile_open_prestodelta(FILENAME, COMTYPE, ERR) \
126  cr_xmlfile_open(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, ERR)
127 
135 #define cr_xmlfile_sopen_prestodelta(FILENAME, COMTYPE, STAT, ERR) \
136  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, STAT, ERR)
137 
144 #define cr_xmlfile_open_updateinfo(FILENAME, COMTYPE, ERR) \
145  cr_xmlfile_open(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, ERR)
146 
154 #define cr_xmlfile_sopen_updateinfo(FILENAME, COMTYPE, STAT, ERR) \
155  cr_xmlfile_sopen(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, STAT, ERR)
156 
166 #define cr_xmlfile_open(FILENAME, TYPE, COMTYPE, ERR) \
167  cr_xmlfile_sopen(FILENAME, TYPE, COMTYPE, NULL, ERR)
168 
179 cr_XmlFile *cr_xmlfile_sopen(const char *filename,
180  cr_XmlFileType type,
181  cr_CompressionType comtype,
182  cr_ContentStat *stat,
183  GError **err);
184 
193 int cr_xmlfile_set_num_of_pkgs(cr_XmlFile *f, long num, GError **err);
194 
201 int cr_xmlfile_add_pkg(cr_XmlFile *f, cr_Package *pkg, GError **err);
202 
215 int cr_xmlfile_add_chunk(cr_XmlFile *f, const char *chunk, GError **err);
216 
222 int cr_xmlfile_close(cr_XmlFile *f, GError **err);
223 
224 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif /* __C_CREATEREPOLIB_XML_FILE_H__ */
cr_CompressionType
cr_XmlFileType type
Definition: xml_file.h:52
cr_XmlFile * cr_xmlfile_sopen(const char *filename, cr_XmlFileType type, cr_CompressionType comtype, cr_ContentStat *stat, GError **err)
int cr_xmlfile_close(cr_XmlFile *f, GError **err)
int cr_xmlfile_add_pkg(cr_XmlFile *f, cr_Package *pkg, GError **err)
int header
Definition: xml_file.h:54
int cr_xmlfile_add_chunk(cr_XmlFile *f, const char *chunk, GError **err)
int footer
Definition: xml_file.h:56
long pkgs
Definition: xml_file.h:58
cr_XmlFileType
Definition: xml_file.h:38
CR_FILE * f
Definition: xml_file.h:50
int cr_xmlfile_set_num_of_pkgs(cr_XmlFile *f, long num, GError **err)