(root)/
glib-2.79.0/
glib/
gdatetime-private.h
       1  /*
       2   * Copyright 2023 GNOME Foundation Inc.
       3   *
       4   * SPDX-License-Identifier: LGPL-2.1-or-later
       5   *
       6   * This library is free software; you can redistribute it and/or
       7   * modify it under the terms of the GNU Lesser General Public
       8   * License as published by the Free Software Foundation; either
       9   * version 2.1 of the License, or (at your option) any later version.
      10   *
      11   * This library is distributed in the hope that it will be useful,
      12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14   * Lesser General Public License for more details.
      15   *
      16   * You should have received a copy of the GNU Lesser General Public
      17   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
      18   *
      19   * Authors:
      20   *  - Philip Withnall <pwithnall@gnome.org>
      21   */
      22  
      23  #pragma once
      24  
      25  #include "glib.h"
      26  
      27  G_BEGIN_DECLS
      28  
      29  /**
      30   * GEraDate:
      31   * @type: the type of date
      32   * @year: year of the date, in the Gregorian calendar
      33   * @month: month of the date, in the Gregorian calendar
      34   * @day: day of the date, in the Gregorian calendar
      35   *
      36   * A date from a #GEraDescriptionSegment.
      37   *
      38   * If @type is %G_ERA_DATE_SET, @year, @month and @day are valid. Otherwise,
      39   * they are undefined.
      40   *
      41   * Since: 2.80
      42   */
      43  typedef struct {
      44    enum {
      45      G_ERA_DATE_SET,
      46      G_ERA_DATE_PLUS_INFINITY,
      47      G_ERA_DATE_MINUS_INFINITY,
      48    } type;
      49    int year;
      50    int month;
      51    int day;
      52  } GEraDate;
      53  
      54  int _g_era_date_compare (const GEraDate *date1,
      55                           const GEraDate *date2);
      56  
      57  /**
      58   * GEraDescriptionSegment:
      59   * @ref_count: reference count
      60   * @direction_multiplier: `-1` or `1` depending on the order of @start_date and
      61   *   @end_date
      62   * @offset: offset of the first year in the era
      63   * @start_date: start date (in the Gregorian calendar) of the era
      64   * @end_date: end date (in the Gregorian calendar) of the era
      65   * @era_name: (not nullable): name of the era
      66   * @era_format: (not nullable): format string to use for `%EY`
      67   *
      68   * A segment of an `ERA` description string, describing a single era. See
      69   * [`nl_langinfo(3)`](man:nl_langinfo(3)).
      70   *
      71   * Since: 2.80
      72   */
      73  typedef struct {
      74    gatomicrefcount ref_count;
      75    int direction_multiplier;
      76    guint64 offset;
      77    GEraDate start_date;  /* inclusive */
      78    GEraDate end_date;  /* inclusive */
      79    char *era_name;  /* UTF-8 encoded */
      80    char *era_format;  /* UTF-8 encoded */
      81  } GEraDescriptionSegment;
      82  
      83  GPtrArray *_g_era_description_parse (const char *desc);
      84  
      85  GEraDescriptionSegment *_g_era_description_segment_ref (GEraDescriptionSegment *segment);
      86  void _g_era_description_segment_unref (GEraDescriptionSegment *segment);
      87  
      88  G_END_DECLS