Use o3tl::convert in Math
[LibreOffice.git] / unoidl / source / sourceprovider-parser-requires.hxx
blob59c79b39943c55d4f99d3e56eaed6712520ecd69
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 <vector>
16 #include <rtl/ustring.hxx>
17 #include <sal/types.h>
19 #define YYLTYPE int
21 typedef void * yyscan_t;
23 namespace unoidl::detail {
25 struct SourceProviderEntity;
27 enum SourceProviderAccessDecls { ACCESS_DECL_GET = 0x1, ACCESS_DECL_SET = 0x2 };
29 enum SourceProviderFlags {
30 FLAG_ATTRIBUTE = 0x001, FLAG_BOUND = 0x002, FLAG_CONSTRAINED = 0x004,
31 FLAG_MAYBEAMBIGUOUS = 0x008, FLAG_MAYBEDEFAULT = 0x010,
32 FLAG_MAYBEVOID = 0x020, FLAG_OPTIONAL = 0x040, FLAG_PROPERTY = 0x080,
33 FLAG_READONLY = 0x100, FLAG_REMOVABLE = 0x200, FLAG_TRANSIENT = 0x400
36 struct SourceProviderExpr {
37 static SourceProviderExpr Bool(bool v) {
38 SourceProviderExpr e;
39 e.type = TYPE_BOOL;
40 e.bval = v;
41 return e;
44 static SourceProviderExpr Int(sal_Int64 v) {
45 SourceProviderExpr e;
46 e.type = TYPE_INT;
47 e.ival = v;
48 return e;
51 static SourceProviderExpr Uint(sal_uInt64 v) {
52 SourceProviderExpr e;
53 e.type = TYPE_UINT;
54 e.uval = v;
55 return e;
58 static SourceProviderExpr Float(double v) {
59 SourceProviderExpr e;
60 e.type = TYPE_FLOAT;
61 e.fval = v;
62 return e;
65 enum Type { TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_FLOAT };
67 Type type;
68 union {
69 bool bval;
70 sal_Int64 ival;
71 sal_uInt64 uval;
72 double fval;
76 struct SourceProviderType {
77 enum Type {
78 TYPE_VOID, TYPE_BOOLEAN, TYPE_BYTE, TYPE_SHORT, TYPE_UNSIGNED_SHORT,
79 TYPE_LONG, TYPE_UNSIGNED_LONG, TYPE_HYPER, TYPE_UNSIGNED_HYPER,
80 TYPE_FLOAT, TYPE_DOUBLE, TYPE_CHAR, TYPE_STRING, TYPE_TYPE, TYPE_ANY,
81 TYPE_SEQUENCE, TYPE_ENUM, TYPE_PLAIN_STRUCT, TYPE_EXCEPTION,
82 TYPE_INTERFACE, TYPE_INSTANTIATED_POLYMORPHIC_STRUCT, TYPE_PARAMETER
85 SourceProviderType():
86 type(), entity() // avoid false warnings about uninitialized members
89 explicit SourceProviderType(Type theType):
90 type(theType),
91 entity() // avoid false warnings about uninitialized member
92 { assert(theType <= TYPE_ANY); }
94 explicit SourceProviderType(SourceProviderType const * componentType):
95 type(TYPE_SEQUENCE),
96 entity() // avoid false warnings about uninitialized member
97 { assert(componentType != nullptr); subtypes.push_back(*componentType); }
99 SourceProviderType(
100 Type theType, OUString const & theName,
101 SourceProviderEntity const * theEntity):
102 type(theType), name(theName), entity(theEntity)
104 assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE);
105 assert(theEntity != nullptr);
108 SourceProviderType(
109 OUString const & polymorphicStructTypeTemplateName,
110 SourceProviderEntity const * theEntity,
111 std::vector<SourceProviderType>&& typeArguments):
112 type(TYPE_INSTANTIATED_POLYMORPHIC_STRUCT),
113 name(polymorphicStructTypeTemplateName), entity(theEntity),
114 subtypes(std::move(typeArguments))
115 { assert(theEntity != nullptr); }
117 explicit SourceProviderType(OUString const & identifier):
118 type(TYPE_PARAMETER), name(identifier),
119 entity() // avoid false warnings about uninitialized member
122 OUString getName() const;
124 bool equals(SourceProviderType const & other) const;
126 Type type;
127 OUString name; // TYPE_ENUM ... TYPE_PARAMETER
128 SourceProviderEntity const * entity;
129 // TYPE_ENUM ... TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
130 std::vector<SourceProviderType> subtypes;
131 // TYPE_SEQUENCE, TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
132 OUString typedefName;
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */