LibreOffice Module unoidl (master) 1
sourceprovider-parser-requires.hxx
Go to the documentation of this file.
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#pragma once
11
12#include <sal/config.h>
13
14#include <utility>
15#include <vector>
16
17#include <rtl/ustring.hxx>
18#include <sal/types.h>
19
20#define YYLTYPE int
21
22typedef void * yyscan_t;
23
24namespace unoidl::detail {
25
26struct SourceProviderEntity;
27
29
31 FLAG_ATTRIBUTE = 0x001, FLAG_BOUND = 0x002, FLAG_CONSTRAINED = 0x004,
33 FLAG_MAYBEVOID = 0x020, FLAG_OPTIONAL = 0x040, FLAG_PROPERTY = 0x080,
35};
36
38 static SourceProviderExpr Bool(bool v) {
40 e.type = TYPE_BOOL;
41 e.bval = v;
42 return e;
43 }
44
45 static SourceProviderExpr Int(sal_Int64 v) {
47 e.type = TYPE_INT;
48 e.ival = v;
49 return e;
50 }
51
52 static SourceProviderExpr Uint(sal_uInt64 v) {
54 e.type = TYPE_UINT;
55 e.uval = v;
56 return e;
57 }
58
59 static SourceProviderExpr Float(double v) {
61 e.type = TYPE_FLOAT;
62 e.fval = v;
63 return e;
64 }
65
67
69 union {
70 bool bval;
71 sal_Int64 ival;
72 sal_uInt64 uval;
73 double fval;
74 };
75};
76
78 enum Type {
84 };
85
87 type(), entity() // avoid false warnings about uninitialized members
88 {}
89
90 explicit SourceProviderType(Type theType):
91 type(theType),
92 entity() // avoid false warnings about uninitialized member
93 { assert(theType <= TYPE_ANY); }
94
95 explicit SourceProviderType(SourceProviderType const * componentType):
97 entity() // avoid false warnings about uninitialized member
98 { assert(componentType != nullptr); subtypes.push_back(*componentType); }
99
101 Type theType, OUString theName,
102 SourceProviderEntity const * theEntity):
103 type(theType), name(std::move(theName)), entity(theEntity)
104 {
105 assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE);
106 assert(theEntity != nullptr);
107 }
108
110 OUString polymorphicStructTypeTemplateName,
111 SourceProviderEntity const * theEntity,
112 std::vector<SourceProviderType>&& typeArguments):
114 name(std::move(polymorphicStructTypeTemplateName)), entity(theEntity),
115 subtypes(std::move(typeArguments))
116 { assert(theEntity != nullptr); }
117
118 explicit SourceProviderType(OUString identifier):
120 entity() // avoid false warnings about uninitialized member
121 {}
122
123 OUString getName() const;
124
125 bool equals(SourceProviderType const & other) const;
126
128 OUString name; // TYPE_ENUM ... TYPE_PARAMETER
130 // TYPE_ENUM ... TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
131 std::vector<SourceProviderType> subtypes;
132 // TYPE_SEQUENCE, TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
133 OUString typedefName;
134};
135
136}
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
float v
::boost::spirit::classic::rule< ScannerT > identifier
static SourceProviderExpr Uint(sal_uInt64 v)
static SourceProviderExpr Float(double v)
static SourceProviderExpr Int(sal_Int64 v)
SourceProviderType(SourceProviderType const *componentType)
SourceProviderType(OUString polymorphicStructTypeTemplateName, SourceProviderEntity const *theEntity, std::vector< SourceProviderType > &&typeArguments)
bool equals(SourceProviderType const &other) const
SourceProviderType(Type theType, OUString theName, SourceProviderEntity const *theEntity)