File: utility.h

package info (click to toggle)
gobject-introspection 1.84.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 72,336 kB
  • sloc: ansic: 562,269; python: 23,692; xml: 16,240; yacc: 1,711; perl: 1,624; sh: 1,139; lex: 510; cpp: 487; makefile: 182; javascript: 15; lisp: 1
file content (109 lines) | stat: -rw-r--r-- 2,314 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
/*
SPDX-License-Identifier: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT
SPDX-FileCopyrightText: 2008 Colin Walters <walters@verbum.org>
SPDX-FileCopyrightText: 2008 Johan Dahlin
SPDX-FileCopyrightText: 2008-2009 Andreas Rottmann <a.rottmann@gmx.at>
*/

#pragma once

#include <glib-object.h>
#include <glib.h>

#include "gitestmacros.h"

#define UTILITY_TYPE_OBJECT (utility_object_get_type ())
#define UTILITY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), UTILITY_TYPE_OBJECT, UtilityObject))
#define UTILITY_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), UTILITY_TYPE_OBJECT))

typedef struct _UtilityObject UtilityObject;
typedef struct _UtilityObjectClass UtilityObjectClass;

struct _UtilityObject
{
  GObject parent_instance;
  /*< private >*/
  void *user_data;
  GDestroyNotify destroy_notify;
};

struct _UtilityObjectClass
{
  GObjectClass parent_class;
};

/* This one is similar to Pango.Glyph */
typedef guint32 UtilityGlyph;

typedef struct
{
  int tag;
  union
  {
    gpointer v_pointer;
    double v_real;
    long v_integer;
  } value;
} UtilityTaggedValue;

typedef union
{
  guint8 value;
  struct
  {
    guint8 first_nibble : 4;
    guint8 second_nibble : 4;
  } parts;
} UtilityByte;

/* This one is similiar to Soup.Buffer */
typedef struct
{
  const char *data;
  gsize length;
} UtilityBuffer;

typedef void (*UtilityFileFunc) (const char *path, gpointer user_data);

GI_TEST_EXTERN
GType utility_object_get_type (void) G_GNUC_CONST;

GI_TEST_EXTERN
void utility_object_watch_dir (UtilityObject *object,
                               const char *path,
                               UtilityFileFunc func,
                               gpointer user_data,
                               GDestroyNotify destroy);

typedef enum
{
  UTILITY_ENUM_A,
  UTILITY_ENUM_B,
  UTILITY_ENUM_C
} UtilityEnumType;

/* The shift operators here should imply bitfield */
typedef enum
{
  UTILITY_FLAG_A = 1 << 0,
  UTILITY_FLAG_B = 1 << 1,
  UTILITY_FLAG_C = 1 << 2
} UtilityFlagType;

typedef struct
{
  int field;
  guint bitfield1 : 3;
  guint bitfield2 : 2;
  guint8 data[16];
} UtilityStruct;

typedef union
{
  char *pointer;
  glong integer;
  double real;
} UtilityUnion;

GI_TEST_EXTERN
void utility_dir_foreach (const char *path, UtilityFileFunc func, gpointer user_data);