Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #ifndef INCLUDED_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_REQUIRES_HXX
11 : #define INCLUDED_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_REQUIRES_HXX
12 :
13 : #include "sal/config.h"
14 :
15 : #include <vector>
16 :
17 : #include "rtl/string.hxx"
18 : #include "rtl/ustring.hxx"
19 : #include "sal/types.h"
20 : #include "unoidl/unoidl.hxx"
21 :
22 : #define YYLTYPE int
23 :
24 : typedef void * yyscan_t;
25 :
26 : namespace unoidl { namespace detail {
27 :
28 : struct SourceProviderEntity;
29 :
30 : enum SourceProviderAccessDecls { ACCESS_DECL_GET = 0x1, ACCESS_DECL_SET = 0x2 };
31 :
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
37 : };
38 :
39 : struct SourceProviderExpr {
40 2 : static SourceProviderExpr Bool(bool v) {
41 : SourceProviderExpr e;
42 2 : e.type = TYPE_BOOL;
43 2 : e.bval = v;
44 2 : return e;
45 : }
46 :
47 806 : static SourceProviderExpr Int(sal_Int64 v) {
48 : SourceProviderExpr e;
49 806 : e.type = TYPE_INT;
50 806 : e.ival = v;
51 806 : return e;
52 : }
53 :
54 15138 : static SourceProviderExpr Uint(sal_uInt64 v) {
55 : SourceProviderExpr e;
56 15138 : e.type = TYPE_UINT;
57 15138 : e.uval = v;
58 15138 : return e;
59 : }
60 :
61 24 : static SourceProviderExpr Float(double v) {
62 : SourceProviderExpr e;
63 24 : e.type = TYPE_FLOAT;
64 24 : e.fval = v;
65 24 : return e;
66 : }
67 :
68 : enum Type { TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_FLOAT };
69 :
70 : Type type;
71 : union {
72 : bool bval;
73 : sal_Int64 ival;
74 : sal_uInt64 uval;
75 : double fval;
76 : };
77 : };
78 :
79 168543 : 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
86 : };
87 :
88 8742 : SourceProviderType():
89 8742 : type(), entity() // avoid false warnings about uninitialized members
90 8742 : {}
91 :
92 38234 : explicit SourceProviderType(Type theType):
93 : type(theType),
94 38234 : entity() // avoid false warnings about uninitialized member
95 38234 : { assert(theType <= TYPE_ANY); }
96 :
97 2240 : explicit SourceProviderType(SourceProviderType const * componentType):
98 : type(TYPE_SEQUENCE),
99 2240 : entity() // avoid false warnings about uninitialized member
100 2240 : { assert(componentType != 0); subtypes.push_back(*componentType); }
101 :
102 7833 : SourceProviderType(
103 : Type theType, OUString const & theName,
104 : SourceProviderEntity const * theEntity):
105 7833 : type(theType), name(theName), entity(theEntity)
106 : {
107 : assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE);
108 : assert(theEntity != 0);
109 7833 : }
110 :
111 153 : 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 153 : subtypes(typeArguments)
118 153 : { assert(theEntity != 0); }
119 :
120 61 : explicit SourceProviderType(OUString const & identifier):
121 : type(TYPE_PARAMETER), name(identifier),
122 61 : entity() // avoid false warnings about uninitialized member
123 61 : {}
124 :
125 : OUString getName() const;
126 :
127 : bool equals(SourceProviderType const & other) const;
128 :
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;
136 : };
137 :
138 : } }
139 :
140 : #endif
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|