File: gdatetime-private.h

package info (click to toggle)
glib2.0 2.86.1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid
  • size: 67,012 kB
  • sloc: ansic: 544,596; python: 9,702; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (88 lines) | stat: -rw-r--r-- 2,609 bytes parent folder | download | duplicates (6)
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
/*
 * Copyright 2023 GNOME Foundation Inc.
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *  - Philip Withnall <pwithnall@gnome.org>
 */

#pragma once

#include "glib.h"

G_BEGIN_DECLS

/**
 * GEraDate:
 * @type: the type of date
 * @year: year of the date, in the Gregorian calendar
 * @month: month of the date, in the Gregorian calendar
 * @day: day of the date, in the Gregorian calendar
 *
 * A date from a #GEraDescriptionSegment.
 *
 * If @type is %G_ERA_DATE_SET, @year, @month and @day are valid. Otherwise,
 * they are undefined.
 *
 * Since: 2.80
 */
typedef struct {
  enum {
    G_ERA_DATE_SET,
    G_ERA_DATE_PLUS_INFINITY,
    G_ERA_DATE_MINUS_INFINITY,
  } type;
  int year;
  int month;
  int day;
} GEraDate;

int _g_era_date_compare (const GEraDate *date1,
                         const GEraDate *date2);

/**
 * GEraDescriptionSegment:
 * @ref_count: reference count
 * @direction_multiplier: `-1` or `1` depending on the order of @start_date and
 *   @end_date
 * @offset: offset of the first year in the era
 * @start_date: start date (in the Gregorian calendar) of the era
 * @end_date: end date (in the Gregorian calendar) of the era
 * @era_name: (not nullable): name of the era
 * @era_format: (not nullable): format string to use for `%EY`
 *
 * A segment of an `ERA` description string, describing a single era. See
 * [`nl_langinfo(3)`](man:nl_langinfo(3)).
 *
 * Since: 2.80
 */
typedef struct {
  gatomicrefcount ref_count;
  int direction_multiplier;
  guint64 offset;
  GEraDate start_date;  /* inclusive */
  GEraDate end_date;  /* inclusive */
  char *era_name;  /* UTF-8 encoded */
  char *era_format;  /* UTF-8 encoded */
} GEraDescriptionSegment;

GPtrArray *_g_era_description_parse (const char *desc);

GEraDescriptionSegment *_g_era_description_segment_ref (GEraDescriptionSegment *segment);
void _g_era_description_segment_unref (GEraDescriptionSegment *segment);

G_END_DECLS