bump product version to 5.0.4.1
[LibreOffice.git] / unoidl / source / sourceprovider-parser-requires.hxx
blobf9cd27ef83b115bd86f80eb3f6e1945d672771bc
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 #ifndef INCLUDED_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_REQUIRES_HXX
11 #define INCLUDED_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_REQUIRES_HXX
13 #include "sal/config.h"
15 #include <vector>
17 #include "rtl/string.hxx"
18 #include "rtl/ustring.hxx"
19 #include "sal/types.h"
20 #include "unoidl/unoidl.hxx"
22 #define YYLTYPE int
24 typedef void * yyscan_t;
26 namespace unoidl { namespace detail {
28 struct SourceProviderEntity;
30 enum SourceProviderAccessDecls { ACCESS_DECL_GET = 0x1, ACCESS_DECL_SET = 0x2 };
32 enum SourceProviderFlags {
33 FLAG_ATTRIBUTE = 0x001, FLAG_BOUND = 0x002, FLAG_CONSTRAINED = 0x004,
34 FLAG_MAYBEAMBIGUOUS = 0x008, FLAG_MAYBEDEFAULT = 0x010,
35 FLAG_MAYBEVOID = 0x020, FLAG_OPTIONAL = 0x040, FLAG_PROPERTY = 0x080,
36 FLAG_READONLY = 0x100, FLAG_REMOVABLE = 0x200, FLAG_TRANSIENT = 0x400
39 struct SourceProviderExpr {
40 static SourceProviderExpr Bool(bool v) {
41 SourceProviderExpr e;
42 e.type = TYPE_BOOL;
43 e.bval = v;
44 return e;
47 static SourceProviderExpr Int(sal_Int64 v) {
48 SourceProviderExpr e;
49 e.type = TYPE_INT;
50 e.ival = v;
51 return e;
54 static SourceProviderExpr Uint(sal_uInt64 v) {
55 SourceProviderExpr e;
56 e.type = TYPE_UINT;
57 e.uval = v;
58 return e;
61 static SourceProviderExpr Float(double v) {
62 SourceProviderExpr e;
63 e.type = TYPE_FLOAT;
64 e.fval = v;
65 return e;
68 enum Type { TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_FLOAT };
70 Type type;
71 union {
72 bool bval;
73 sal_Int64 ival;
74 sal_uInt64 uval;
75 double fval;
79 struct SourceProviderType {
80 enum Type {
81 TYPE_VOID, TYPE_BOOLEAN, TYPE_BYTE, TYPE_SHORT, TYPE_UNSIGNED_SHORT,
82 TYPE_LONG, TYPE_UNSIGNED_LONG, TYPE_HYPER, TYPE_UNSIGNED_HYPER,
83 TYPE_FLOAT, TYPE_DOUBLE, TYPE_CHAR, TYPE_STRING, TYPE_TYPE, TYPE_ANY,
84 TYPE_SEQUENCE, TYPE_ENUM, TYPE_PLAIN_STRUCT, TYPE_EXCEPTION,
85 TYPE_INTERFACE, TYPE_INSTANTIATED_POLYMORPHIC_STRUCT, TYPE_PARAMETER
88 SourceProviderType():
89 type(), entity() // avoid false warnings about uninitialized members
92 explicit SourceProviderType(Type theType):
93 type(theType),
94 entity() // avoid false warnings about uninitialized member
95 { assert(theType <= TYPE_ANY); }
97 explicit SourceProviderType(SourceProviderType const * componentType):
98 type(TYPE_SEQUENCE),
99 entity() // avoid false warnings about uninitialized member
100 { assert(componentType != 0); subtypes.push_back(*componentType); }
102 SourceProviderType(
103 Type theType, OUString const & theName,
104 SourceProviderEntity const * theEntity):
105 type(theType), name(theName), entity(theEntity)
107 assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE);
108 assert(theEntity != 0);
111 SourceProviderType(
112 OUString const & polymorphicStructTypeTemplateName,
113 SourceProviderEntity const * theEntity,
114 std::vector<SourceProviderType> const & typeArguments):
115 type(TYPE_INSTANTIATED_POLYMORPHIC_STRUCT),
116 name(polymorphicStructTypeTemplateName), entity(theEntity),
117 subtypes(typeArguments)
118 { assert(theEntity != 0); }
120 explicit SourceProviderType(OUString const & identifier):
121 type(TYPE_PARAMETER), name(identifier),
122 entity() // avoid false warnings about uninitialized member
125 OUString getName() const;
127 bool equals(SourceProviderType const & other) const;
129 Type type;
130 OUString name; // TYPE_ENUM ... TYPE_PARAMETER
131 SourceProviderEntity const * entity;
132 // TYPE_ENUM ... TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
133 std::vector<SourceProviderType> subtypes;
134 // TYPE_SEQUENCE, TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
135 OUString typedefName;
140 #endif
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */