File: modulemd-defaults.h

package info (click to toggle)
libmodulemd 2.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,152 kB
  • sloc: ansic: 37,845; python: 3,236; xml: 1,739; sh: 377; makefile: 42
file content (197 lines) | stat: -rw-r--r-- 4,865 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*
 * This file is part of libmodulemd
 * Copyright (C) 2017-2018 Stephen Gallagher
 *
 * Fedora-License-Identifier: MIT
 * SPDX-2.0-License-Identifier: MIT
 * SPDX-3.0-License-Identifier: MIT
 *
 * This program is free software.
 * For more information on the license, see COPYING.
 * For more information on free software, see <https://www.gnu.org/philosophy/free-sw.en.html>.
 */

#pragma once

#include <glib-object.h>

G_BEGIN_DECLS


/**
 * SECTION: modulemd-defaults
 * @title: Modulemd.Defaults
 * @stability: stable
 * @short_description: Parent class for Default documents.
 * See #ModulemdDefaultsV1 for a specific type.
 */

/**
 * ModulemdDefaultsVersionEnum:
 * @MD_DEFAULTS_VERSION_ERROR: Represents an error handling mdversion.
 * @MD_DEFAULTS_VERSION_UNSET: Represents an unset mdversion.
 * @MD_DEFAULTS_VERSION_ONE: Represents v1 of the #ModulemdDefaults metadata
 * format.
 * @MD_DEFAULTS_VERSION_LATEST: Represents the highest-supported version of the
 * #ModulemdDefaults metadata format.
 *
 * Since: 2.0
 */
typedef enum
{
  MD_DEFAULTS_VERSION_ERROR = -1,

  MD_DEFAULTS_VERSION_UNSET = 0,

  MD_DEFAULTS_VERSION_ONE = 1,

  MD_DEFAULTS_VERSION_LATEST = MD_DEFAULTS_VERSION_ONE,
} ModulemdDefaultsVersionEnum;


#define MODULEMD_TYPE_DEFAULTS (modulemd_defaults_get_type ())

G_DECLARE_DERIVABLE_TYPE (
  ModulemdDefaults, modulemd_defaults, MODULEMD, DEFAULTS, GObject)

struct _ModulemdDefaultsClass
{
  GObjectClass parent_class;

  ModulemdDefaults *(*copy) (ModulemdDefaults *self);

  gboolean (*validate) (ModulemdDefaults *self, GError **error);

  guint64 (*get_mdversion) (ModulemdDefaults *self);

  gboolean (*equals) (ModulemdDefaults *self_1, ModulemdDefaults *self_2);

  /* Padding to allow adding up to 9 new virtual functions without
   * breaking ABI. */
  gpointer padding[9];
};


/**
 * modulemd_defaults_new:
 * @version: The version of the defaults metadata to create.
 * @module_name: The name of the module to which these defaults apply.
 *
 * Create a new #ModulemdDefaults.
 *
 * Returns: (transfer full): A newly created #ModulemdDefaults subtype of the
 * requested version.
 *
 * Since: 2.0
 */
ModulemdDefaults *
modulemd_defaults_new (guint64 version, const gchar *module_name);


/**
 * modulemd_defaults_copy:
 * @self: (in): This #ModulemdDefaults object.
 *
 * Returns: (transfer full): A newly-allocated copy of @self.
 *
 * Since: 2.0
 */
ModulemdDefaults *
modulemd_defaults_copy (ModulemdDefaults *self);


/**
 * modulemd_defaults_validate:
 * @self: (in): This #ModulemdDefaults object.
 * @error: (out):  A #GError that will return the reason for a validation error.
 *
 * Returns: TRUE if validation passed, FALSE and sets @error appropriately if
 * validation failed.
 *
 * Since: 2.0
 */
gboolean
modulemd_defaults_validate (ModulemdDefaults *self, GError **error);


/**
 * modulemd_defaults_equals:
 * @self_1: (in): A #ModulemdDefaults object
 * @self_2: (in): A #ModulemdDefaults object
 *
 * Returns: TRUE if both @self_1 and @self_2 contain equal values, FALSE if they differed.
 *
 * Since: 2.2
 */
gboolean
modulemd_defaults_equals (ModulemdDefaults *self_1, ModulemdDefaults *self_2);


/**
 * modulemd_defaults_upgrade:
 * @self: (in): This #ModulemdDefaults object.
 * @mdversion: (in): The version to upgrade to.
 * @error: (out):  A #GError that will return the reason for an upgrade error.
 *
 * Returns: (transfer full): A newly-allocated copy of @self upgraded to the
 * requested defaults version. NULL if the upgrade cannot be performed and sets
 * @error appropriately. This function does not modify @self.
 *
 * Since: 2.0
 */
ModulemdDefaults *
modulemd_defaults_upgrade (ModulemdDefaults *self,
                           guint64 mdversion,
                           GError **error);


/**
 * modulemd_defaults_get_module_name:
 * @self: (in): This #ModulemdDefaults object.
 *
 * Returns: (transfer none): The name of the module to which these defaults
 * apply.
 *
 * Since: 2.0
 */
const gchar *
modulemd_defaults_get_module_name (ModulemdDefaults *self);


/**
 * modulemd_defaults_get_mdversion:
 * @self: (in): This #ModulemdDefaults object.
 *
 * Returns: The metadata version of this defaults object.
 *
 * Since: 2.0
 */
guint64
modulemd_defaults_get_mdversion (ModulemdDefaults *self);


/**
 * modulemd_defaults_set_modified:
 * @self: (in): This #ModulemdDefaults object.
 * @modified: (in): The last modified time represented as a 64-bit integer
 * (such as 201807011200)
 *
 * Since: 2.0
 */
void
modulemd_defaults_set_modified (ModulemdDefaults *self, guint64 modified);


/**
 * modulemd_defaults_get_modified:
 * @self: (in): This #ModulemdDefaults object.
 *
 * Returns: The last modified time represented as a 64-bit integer
 * (such as 201807011200)
 *
 * Since: 2.0
 */
guint64
modulemd_defaults_get_modified (ModulemdDefaults *self);

G_END_DECLS