File: union.h

package info (click to toggle)
gjs 1.87.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,848 kB
  • sloc: cpp: 38,389; javascript: 31,953; ansic: 15,960; sh: 1,777; python: 791; xml: 137; makefile: 40
file content (68 lines) | stat: -rw-r--r-- 2,034 bytes parent folder | download
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
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2008 litl, LLC

#pragma once

#include <config.h>

#include <glib-object.h>

#include <js/TypeDecls.h>

#include "gi/boxed.h"
#include "gi/cwrapper.h"
#include "gi/info.h"
#include "gi/wrapperutils.h"
#include "gjs/macros.h"

struct JSClass;
struct JSClassOps;
class UnionPrototype;
class UnionInstance;

class UnionBase : public BoxedBase<UnionBase, UnionPrototype, UnionInstance> {
    friend class CWrapperPointerOps<UnionBase>;
    friend class GIWrapperBase<UnionBase, UnionPrototype, UnionInstance>;
    friend class BoxedBase<UnionBase, UnionPrototype, UnionInstance>;
    friend class BoxedPrototype<UnionBase, UnionPrototype, UnionInstance>;
    friend class BoxedInstance<UnionBase, UnionPrototype, UnionInstance>;

 protected:
    using BoxedBase::BoxedBase;

    static constexpr const char* DEBUG_TAG = "union";

    static const JSClassOps class_ops;
    static const JSClass klass;

 public:
    static constexpr const GI::InfoTag TAG = GI::InfoTag::UNION;
};

class UnionPrototype
    : public BoxedPrototype<UnionBase, UnionPrototype, UnionInstance> {
    friend class GIWrapperPrototype<UnionBase, UnionPrototype, UnionInstance,
                                    GI::AutoUnionInfo, GI::UnionInfo>;

    explicit UnionPrototype(const GI::UnionInfo, GType);
    ~UnionPrototype();

 public:
    GJS_JSAPI_RETURN_CONVENTION
    static bool define_class(JSContext*, JS::HandleObject in_object,
                             const GI::UnionInfo);
};

class UnionInstance
    : public BoxedInstance<UnionBase, UnionPrototype, UnionInstance> {
    friend class GIWrapperInstance<UnionBase, UnionPrototype, UnionInstance>;

    explicit UnionInstance(UnionPrototype*, JS::HandleObject);
    ~UnionInstance();

 public:
    GJS_JSAPI_RETURN_CONVENTION
    static JSObject* new_for_c_union(JSContext*, const GI::UnionInfo,
                                     void* gboxed);
};