createrepo_c library  0.9.1
C library for metadata manipulation
XML file API.

Data Structures

struct  cr_XmlFile
 

Macros

#define cr_xmlfile_open_primary(FILENAME, COMTYPE, ERR)   cr_xmlfile_open(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, ERR)
 
#define cr_xmlfile_sopen_primary(FILENAME, COMTYPE, STAT, ERR)   cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, STAT, ERR)
 
#define cr_xmlfile_open_filelists(FILENAME, COMTYPE, ERR)   cr_xmlfile_open(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, ERR)
 
#define cr_xmlfile_sopen_filelists(FILENAME, COMTYPE, STAT, ERR)   cr_xmlfile_sopen(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, STAT, ERR)
 
#define cr_xmlfile_open_other(FILENAME, COMTYPE, ERR)   cr_xmlfile_open(FILENAME, CR_XMLFILE_OTHER, COMTYPE, ERR)
 
#define cr_xmlfile_sopen_other(FILENAME, COMTYPE, STAT, ERR)   cr_xmlfile_sopen(FILENAME, CR_XMLFILE_OTHER, COMTYPE, STAT, ERR)
 
#define cr_xmlfile_open_prestodelta(FILENAME, COMTYPE, ERR)   cr_xmlfile_open(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, ERR)
 
#define cr_xmlfile_sopen_prestodelta(FILENAME, COMTYPE, STAT, ERR)   cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, STAT, ERR)
 
#define cr_xmlfile_open_updateinfo(FILENAME, COMTYPE, ERR)   cr_xmlfile_open(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, ERR)
 
#define cr_xmlfile_sopen_updateinfo(FILENAME, COMTYPE, STAT, ERR)   cr_xmlfile_sopen(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, STAT, ERR)
 
#define cr_xmlfile_open(FILENAME, TYPE, COMTYPE, ERR)   cr_xmlfile_sopen(FILENAME, TYPE, COMTYPE, NULL, ERR)
 

Enumerations

enum  cr_XmlFileType {
  CR_XMLFILE_PRIMARY, CR_XMLFILE_FILELISTS, CR_XMLFILE_OTHER, CR_XMLFILE_PRESTODELTA,
  CR_XMLFILE_UPDATEINFO, CR_XMLFILE_SENTINEL
}
 

Functions

cr_XmlFilecr_xmlfile_sopen (const char *filename, cr_XmlFileType type, cr_CompressionType comtype, cr_ContentStat *stat, GError **err)
 
int cr_xmlfile_set_num_of_pkgs (cr_XmlFile *f, long num, GError **err)
 
int cr_xmlfile_add_pkg (cr_XmlFile *f, cr_Package *pkg, GError **err)
 
int cr_xmlfile_add_chunk (cr_XmlFile *f, const char *chunk, GError **err)
 
int cr_xmlfile_close (cr_XmlFile *f, GError **err)
 

Detailed Description

Macro Definition Documentation

#define cr_xmlfile_open (   FILENAME,
  TYPE,
  COMTYPE,
  ERR 
)    cr_xmlfile_sopen(FILENAME, TYPE, COMTYPE, NULL, ERR)

Open a new XML file with stats. Note: Opened file must not exists! This function cannot open existing file!.

Parameters
FILENAMEFilename.
TYPEType of XML file.
COMTYPEType of used compression.
ERR**GError
Returns
Opened cr_XmlFile or NULL on error

Definition at line 166 of file xml_file.h.

#define cr_xmlfile_open_filelists (   FILENAME,
  COMTYPE,
  ERR 
)    cr_xmlfile_open(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, ERR)

Open a new filelists XML file.

Parameters
FILENAMEFilename.
COMTYPEType of used compression.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 87 of file xml_file.h.

#define cr_xmlfile_open_other (   FILENAME,
  COMTYPE,
  ERR 
)    cr_xmlfile_open(FILENAME, CR_XMLFILE_OTHER, COMTYPE, ERR)

Open a new other XML file.

Parameters
FILENAMEFilename.
COMTYPEType of used compression.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 106 of file xml_file.h.

#define cr_xmlfile_open_prestodelta (   FILENAME,
  COMTYPE,
  ERR 
)    cr_xmlfile_open(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, ERR)

Open a new prestodelta XML file.

Parameters
FILENAMEFilename.
COMTYPEType of used compression.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 125 of file xml_file.h.

#define cr_xmlfile_open_primary (   FILENAME,
  COMTYPE,
  ERR 
)    cr_xmlfile_open(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, ERR)

Open a new primary XML file.

Parameters
FILENAMEFilename.
COMTYPEType of compression.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 68 of file xml_file.h.

#define cr_xmlfile_open_updateinfo (   FILENAME,
  COMTYPE,
  ERR 
)    cr_xmlfile_open(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, ERR)

Open a new updateinfo XML file.

Parameters
FILENAMEFilename.
COMTYPEType of used compression.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 144 of file xml_file.h.

#define cr_xmlfile_sopen_filelists (   FILENAME,
  COMTYPE,
  STAT,
  ERR 
)    cr_xmlfile_sopen(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, STAT, ERR)

Open a new filelists XML file.

Parameters
FILENAMEFilename.
COMTYPEType of compression.
STATcr_ContentStat object or NULL.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 97 of file xml_file.h.

#define cr_xmlfile_sopen_other (   FILENAME,
  COMTYPE,
  STAT,
  ERR 
)    cr_xmlfile_sopen(FILENAME, CR_XMLFILE_OTHER, COMTYPE, STAT, ERR)

Open a new other XML file.

Parameters
FILENAMEFilename.
COMTYPEType of compression.
STATcr_ContentStat object or NULL.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 116 of file xml_file.h.

#define cr_xmlfile_sopen_prestodelta (   FILENAME,
  COMTYPE,
  STAT,
  ERR 
)    cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, STAT, ERR)

Open a new prestodelta XML file.

Parameters
FILENAMEFilename.
COMTYPEType of compression.
STATcr_ContentStat object or NULL.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 135 of file xml_file.h.

#define cr_xmlfile_sopen_primary (   FILENAME,
  COMTYPE,
  STAT,
  ERR 
)    cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, STAT, ERR)

Open a new primary XML file.

Parameters
FILENAMEFilename.
COMTYPEType of compression.
STATcr_ContentStat object or NULL.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 78 of file xml_file.h.

#define cr_xmlfile_sopen_updateinfo (   FILENAME,
  COMTYPE,
  STAT,
  ERR 
)    cr_xmlfile_sopen(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, STAT, ERR)

Open a new updateinfo XML file.

Parameters
FILENAMEFilename.
COMTYPEType of compression.
STATcr_ContentStat object or NULL.
ERRGError **
Returns
Opened cr_XmlFile or NULL on error

Definition at line 154 of file xml_file.h.

Enumeration Type Documentation

Supported types of xml files

Enumerator
CR_XMLFILE_PRIMARY 

primary.xml

CR_XMLFILE_FILELISTS 

filelists.xml

CR_XMLFILE_OTHER 

other.xml

CR_XMLFILE_PRESTODELTA 

prestodelta.xml

CR_XMLFILE_UPDATEINFO 

updateinfo.xml

CR_XMLFILE_SENTINEL 

sentinel of the list

Definition at line 38 of file xml_file.h.

Function Documentation

int cr_xmlfile_add_chunk ( cr_XmlFile f,
const char *  chunk,
GError **  err 
)

Add (write) string with XML chunk into the file. Note: Because of writing, in case of multithreaded program, shoud be guarded by locks, this function could be much more effective than cr_xml_file_add_pkg(). In case of _add_pkg() function, creating of string with xml chunk is done in a critical section. In _add_chunk() function, you could just dump XML whenever you want and in the critical section do only writting.

Parameters
fAn opened cr_XmlFile
chunkString with XML chunk.
err**GError
Returns
cr_Error code
int cr_xmlfile_add_pkg ( cr_XmlFile f,
cr_Package pkg,
GError **  err 
)

Add package to the xml file.

Parameters
fAn opened cr_XmlFile
pkgPackage object.
err**GError
Returns
cr_Error code
int cr_xmlfile_close ( cr_XmlFile f,
GError **  err 
)

Close an opened cr_XmlFile.

Parameters
fAn opened cr_XmlFile
err**GError
Returns
cr_Error code
int cr_xmlfile_set_num_of_pkgs ( cr_XmlFile f,
long  num,
GError **  err 
)

Set total number of packages that will be in the file. This number must be set before any write operation (cr_xml_add_pkg, cr_xml_file_add_chunk, ..).

Parameters
fAn opened cr_XmlFile
numTotal number of packages in the file.
err**GError
Returns
cr_Error code
cr_XmlFile* cr_xmlfile_sopen ( const char *  filename,
cr_XmlFileType  type,
cr_CompressionType  comtype,
cr_ContentStat stat,
GError **  err 
)

Open a new XML file. Note: Opened file must not exists! This function cannot open existing file!.

Parameters
filenameFilename.
typeType of XML file.
comtypeType of used compression.
statpointer to cr_ContentStat or NULL
err**GError
Returns
Opened cr_XmlFile or NULL on error