xref: /AOO41X/main/autodoc/inc/ary/cpp/c_vfflag.hxx (revision 83137a03adbb58b5b3bdafefefa1e93de35e0011)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ARY_CPP_C_VFFLAG_HXX
25 #define ARY_CPP_C_VFFLAG_HXX
26 
27 // USED SERVICES
28 
29 
30 namespace ary
31 {
32 namespace cpp
33 {
34 
35 
36 /** Properties of C++ variables.
37 */
38 struct VariableFlags
39 {
40   public:
41     enum E_Flags
42     {
43         f_static_local      = 0x0001,
44         f_static_member     = 0x0002,
45         f_extern            = 0x0004,
46         f_mutable           = 0x0008
47     };
48 
49                         VariableFlags(
50                             UINT16              i_nFlags = 0 )
51                                                 :   nFlags(i_nFlags) {}
52 
53     void                Reset()                 { nFlags = 0; }
54 
55     void                SetStaticLocal()        { nFlags |= f_static_local; }
56     void                SetStaticMember()       { nFlags |= f_static_member; }
57     void                SetExtern()             { nFlags |= f_extern; }
58     void                SetMutable()            { nFlags |= f_mutable; }
59 
60     bool                IsStaticLocal() const   { return (nFlags & f_static_local) != 0; }
61     bool                IsStaticMember() const  { return (nFlags & f_static_member) != 0; }
62     bool                IsExtern() const        { return (nFlags & f_extern) != 0; }
63     bool                IsMutable() const       { return (nFlags & f_mutable) != 0; }
64 
65   private:
66     UINT16              nFlags;
67 };
68 
69 
70 /** Properties of C++ functions.
71 */
72 struct FunctionFlags
73 {
74   public:
75     enum E_Flags
76     {
77         f_static_local      = 0x0001,
78         f_static_member     = 0x0002,
79         f_extern            = 0x0004,
80         f_externC           = 0x0008,
81         f_mutable           = 0x0010,
82         f_inline            = 0x0100,
83         f_register          = 0x0200,
84         f_explicit          = 0x0400
85     };
86 
87                         FunctionFlags(
88                             UINT16              i_nFlags = 0 )
89                                                 :   nFlags(i_nFlags) {}
90 
91     bool                operator==(
92                             const FunctionFlags &
93                                                 i_ff ) const
94                                                 { return nFlags == i_ff.nFlags; }
95     bool                operator!=(
96                             const FunctionFlags &
97                                                 i_ff ) const
98                                                 { return NOT operator==(i_ff); }
99 
100     void                Reset()                 { nFlags = 0; }
101 
102     void                SetStaticLocal()        { nFlags |= f_static_local; }
103     void                SetStaticMember()       { nFlags |= f_static_member; }
104     void                SetExtern()             { nFlags |= f_extern; }
105     void                SetExternC()            { nFlags |= f_externC; }
106     void                SetMutable()            { nFlags |= f_mutable; }
107     void                SetInline()             { nFlags |= f_inline; }
108     void                SetRegister()           { nFlags |= f_register; }
109     void                SetExplicit()           { nFlags |= f_explicit; }
110 
111     bool                IsStaticLocal() const   { return (nFlags & f_static_local) != 0; }
112     bool                IsStaticMember() const  { return (nFlags & f_static_member) != 0; }
113     bool                IsExtern() const        { return (nFlags & f_extern) != 0; }
114     bool                IsExternC() const       { return (nFlags & f_externC) != 0; }
115     bool                IsMutable() const       { return (nFlags & f_mutable) != 0; }
116     bool                IsInline() const        { return (nFlags & f_inline) != 0; }
117     bool                IsRegister() const      { return (nFlags & f_register) != 0; }
118     bool                IsExplicit() const      { return (nFlags & f_explicit) != 0; }
119 
120   private:
121     UINT16              nFlags;
122 };
123 
124 
125 /** A C++ function parameter.
126 */
127 struct S_Parameter
128 {
129     String              sName;
130     String              sSizeExpression;
131     String              sInitExpression;
132     Type_id             nType;
133 
134                         S_Parameter()           : nType(0) {}
135                         ~S_Parameter()          {}
136     void                Empty()                 { nType = Type_id(0);
137                                                   sName.clear();
138                                                   sSizeExpression.clear();
139                                                   sInitExpression.clear(); }
140 };
141 
142 
143 
144 
145 }   // namespace cpp
146 }   // namespace ary
147 #endif
148