createrepo_c library
0.10.0
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
{
39
CR_XMLFILE_PRIMARY
,
40
CR_XMLFILE_FILELISTS
,
41
CR_XMLFILE_OTHER
,
42
CR_XMLFILE_PRESTODELTA
,
43
CR_XMLFILE_UPDATEINFO
,
44
CR_XMLFILE_SENTINEL
,
45
}
cr_XmlFileType
;
46
49
typedef
struct
{
50
CR_FILE
*
f
;
52
cr_XmlFileType
type
;
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_XmlFileType
cr_XmlFileType
Definition:
xml_file.h:38
cr_XmlFile::type
cr_XmlFileType type
Definition:
xml_file.h:52
cr_XmlFile::footer
int footer
Definition:
xml_file.h:56
CR_FILE
Definition:
compression_wrapper.h:79
CR_XMLFILE_UPDATEINFO
Definition:
xml_file.h:43
cr_XmlFile::header
int header
Definition:
xml_file.h:54
cr_xmlfile_add_chunk
int cr_xmlfile_add_chunk(cr_XmlFile *f, const char *chunk, GError **err)
cr_xmlfile_close
int cr_xmlfile_close(cr_XmlFile *f, GError **err)
cr_xmlfile_add_pkg
int cr_xmlfile_add_pkg(cr_XmlFile *f, cr_Package *pkg, GError **err)
cr_xmlfile_sopen
cr_XmlFile * cr_xmlfile_sopen(const char *filename, cr_XmlFileType type, cr_CompressionType comtype, cr_ContentStat *stat, GError **err)
CR_XMLFILE_SENTINEL
Definition:
xml_file.h:44
cr_XmlFile
Definition:
xml_file.h:49
CR_XMLFILE_OTHER
Definition:
xml_file.h:41
CR_XMLFILE_PRESTODELTA
Definition:
xml_file.h:42
CR_XMLFILE_FILELISTS
Definition:
xml_file.h:40
cr_CompressionType
cr_CompressionType
Definition:
compression_wrapper.h:37
CR_XMLFILE_PRIMARY
Definition:
xml_file.h:39
cr_XmlFile::f
CR_FILE * f
Definition:
xml_file.h:50
cr_Package
Definition:
package.h:83
cr_ContentStat
Definition:
compression_wrapper.h:57
cr_xmlfile_set_num_of_pkgs
int cr_xmlfile_set_num_of_pkgs(cr_XmlFile *f, long num, GError **err)
cr_XmlFile::pkgs
long pkgs
Definition:
xml_file.h:58
src
xml_file.h
Generated by
1.8.16