1 /* libcomps - C alternative to yum.comps library
2  * Copyright (C) 2013 Jindrich Luza
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * 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  Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
17  * USA
18  */
19 
20 /** \file comps_docgroupid.h
21  * \brief COMPS_DocGroupId header file
22  */
23 
24 #ifndef COMPS_DOCGROUPID_H
25 #define COMPS_DOCGROUPID_H
26 
27 #include <stdbool.h>
28 
29 #include "comps_utils.h"
30 #include "comps_log.h"
31 #include "comps_validate.h"
32 #include "comps_default.h"
33 #include "comps_obj.h"
34 
35 /** COMPS_Object derivate representing group_id element in comps.xml file */
36 typedef struct {
37     COMPS_Object_HEAD;
38     COMPS_Str *name;
39     /**< name of GroupId */
40     bool def;
41     /**< GroupId default attribute */
42     COMPS_ObjList *arches;
43 } COMPS_DocGroupId;
44 COMPS_Object_TAIL(COMPS_DocGroupId);
45 
46 //HEAD_COMPS_CREATE_u(docgroupid, COMPS_DocGroupId)  /*comps_utils.h macro*/
47 //HEAD_COMPS_COPY_u(docgroupid, COMPS_DocGroupId)  /*comps_utils.h macro*/
48 //HEAD_COMPS_DESTROY_u(docgroupid, COMPS_DocGroupId)  /*comps_utils.h macro*/
49 
50 char __comps_docgroupid_cmp_set(void *gid1, void *gid2);
51 
52 /** COMPS_DocGroupId name getter
53  * @param gid COMPS_DocGroupId object
54  * @return COMPS_Str object representing GroupId name with incremented
55  * reference counter
56  */
57 COMPS_Object* comps_docgroupid_get_name(COMPS_DocGroupId *gid);
58 
59 /** COMPS_DocGroupId name setter
60  * @param gid COMPS_DocGroupId object
61  * @param name new name of COMPS_DocGroupId object. Old name object's reference
62  * @param copy deprecated parameter
63  * counter will be decremented
64  */
65 void comps_docgroupid_set_name(COMPS_DocGroupId *gid, char *name, char copy);
66 
67 /** COMPS_DocGroupId default getter
68  * @param gid COMPS_DocGroupId object
69  * @return COMPS_Num object representing GroupId default with incremented
70  * reference counter
71  */
72 COMPS_Object* comps_docgroupid_get_default(COMPS_DocGroupId *gid);
73 
74 /** COMPS_DocGroupId name setter
75  * @param gid COMPS_DocGroupId object
76  * @param def COMPS_DocGroupId default value.
77  *
78  * Old defaut objects reference counter will be decremented
79  */
80 void comps_docgroupid_set_default(COMPS_DocGroupId *gid, int def);
81 
82 COMPS_ObjList* comps_docgroupid_arches(COMPS_DocGroupId *gid);
83 void comps_docgroupid_set_arches(COMPS_DocGroupId *gid,
84                                  COMPS_ObjList *arches);
85 
86 signed char comps_docgroupid_xml(COMPS_DocGroupId *groupid,
87                                   xmlTextWriterPtr writer,
88                                   COMPS_Log *log, COMPS_XMLOptions *options,
89                                   COMPS_DefaultsOptions *def_options);
90 
91 extern COMPS_ValRuleGeneric* COMPS_DocGroupId_ValidateRules[];
92 
93 #endif
94