sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / unoidl / source / sourceprovider-parser-requires.hxx
blob8444da21026fb53599218c15f47f67dad46bfd3b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 #include <sal/config.h>
14 #include <utility>
15 #include <vector>
17 #include <rtl/ustring.hxx>
18 #include <sal/types.h>
20 #define YYLTYPE int
22 typedef void * yyscan_t;
24 namespace unoidl::detail {
26 struct SourceProviderEntity;
28 enum SourceProviderAccessDecls { ACCESS_DECL_GET = 0x1, ACCESS_DECL_SET = 0x2 };
30 enum SourceProviderFlags {
31 FLAG_ATTRIBUTE = 0x001, FLAG_BOUND = 0x002, FLAG_CONSTRAINED = 0x004,
32 FLAG_MAYBEAMBIGUOUS = 0x008, FLAG_MAYBEDEFAULT = 0x010,
33 FLAG_MAYBEVOID = 0x020, FLAG_OPTIONAL = 0x040, FLAG_PROPERTY = 0x080,
34 FLAG_READONLY = 0x100, FLAG_REMOVABLE = 0x200, FLAG_TRANSIENT = 0x400
37 struct SourceProviderExpr {
38 static SourceProviderExpr Bool(bool v) {
39 SourceProviderExpr e;
40 e.type = TYPE_BOOL;
41 e.bval = v;
42 return e;
45 static SourceProviderExpr Int(sal_Int64 v) {
46 SourceProviderExpr e;
47 e.type = TYPE_INT;
48 e.ival = v;
49 return e;
52 static SourceProviderExpr Uint(sal_uInt64 v) {
53 SourceProviderExpr e;
54 e.type = TYPE_UINT;
55 e.uval = v;
56 return e;
59 static SourceProviderExpr Float(double v) {
60 SourceProviderExpr e;
61 e.type = TYPE_FLOAT;
62 e.fval = v;
63 return e;
66 enum Type { TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_FLOAT };
68 Type type;
69 union {
70 bool bval;
71 sal_Int64 ival;
72 sal_uInt64 uval;
73 double fval;
77 struct SourceProviderType {
78 enum Type {
79 TYPE_VOID, TYPE_BOOLEAN, TYPE_BYTE, TYPE_SHORT, TYPE_UNSIGNED_SHORT,
80 TYPE_LONG, TYPE_UNSIGNED_LONG, TYPE_HYPER, TYPE_UNSIGNED_HYPER,
81 TYPE_FLOAT, TYPE_DOUBLE, TYPE_CHAR, TYPE_STRING, TYPE_TYPE, TYPE_ANY,
82 TYPE_SEQUENCE, TYPE_ENUM, TYPE_PLAIN_STRUCT, TYPE_EXCEPTION,
83 TYPE_INTERFACE, TYPE_INSTANTIATED_POLYMORPHIC_STRUCT, TYPE_PARAMETER
86 SourceProviderType():
87 type(), entity() // avoid false warnings about uninitialized members
90 explicit SourceProviderType(Type theType):
91 type(theType),
92 entity() // avoid false warnings about uninitialized member
93 { assert(theType <= TYPE_ANY); }
95 explicit SourceProviderType(SourceProviderType const * componentType):
96 type(TYPE_SEQUENCE),
97 entity() // avoid false warnings about uninitialized member
98 { assert(componentType != nullptr); subtypes.push_back(*componentType); }
100 SourceProviderType(
101 Type theType, OUString theName,
102 SourceProviderEntity const * theEntity):
103 type(theType), name(std::move(theName)), entity(theEntity)
105 assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE);
106 assert(theEntity != nullptr);
109 SourceProviderType(
110 OUString polymorphicStructTypeTemplateName,
111 SourceProviderEntity const * theEntity,
112 std::vector<SourceProviderType>&& typeArguments):
113 type(TYPE_INSTANTIATED_POLYMORPHIC_STRUCT),
114 name(std::move(polymorphicStructTypeTemplateName)), entity(theEntity),
115 subtypes(std::move(typeArguments))
116 { assert(theEntity != nullptr); }
118 explicit SourceProviderType(OUString identifier):
119 type(TYPE_PARAMETER), name(std::move(identifier)),
120 entity() // avoid false warnings about uninitialized member
123 OUString getName() const;
125 bool equals(SourceProviderType const & other) const;
127 Type type;
128 OUString name; // TYPE_ENUM ... TYPE_PARAMETER
129 SourceProviderEntity const * entity;
130 // TYPE_ENUM ... TYPE_INSTANTIATED_POLYMORPHIC_STRUCT
131 std::vector<SourceProviderType> subtypes;
132 // TYPE_SEQUENCE, TYPE_INSTANTIATED_POLYMORPHIC_STRUCT
133 OUString typedefName;
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */