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 VariableFlagsary::cpp::VariableFlags49 VariableFlags( 50 UINT16 i_nFlags = 0 ) 51 : nFlags(i_nFlags) {} 52 Resetary::cpp::VariableFlags53 void Reset() { nFlags = 0; } 54 SetStaticLocalary::cpp::VariableFlags55 void SetStaticLocal() { nFlags |= f_static_local; } SetStaticMemberary::cpp::VariableFlags56 void SetStaticMember() { nFlags |= f_static_member; } SetExternary::cpp::VariableFlags57 void SetExtern() { nFlags |= f_extern; } SetMutableary::cpp::VariableFlags58 void SetMutable() { nFlags |= f_mutable; } 59 IsStaticLocalary::cpp::VariableFlags60 bool IsStaticLocal() const { return (nFlags & f_static_local) != 0; } IsStaticMemberary::cpp::VariableFlags61 bool IsStaticMember() const { return (nFlags & f_static_member) != 0; } IsExternary::cpp::VariableFlags62 bool IsExtern() const { return (nFlags & f_extern) != 0; } IsMutableary::cpp::VariableFlags63 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 FunctionFlagsary::cpp::FunctionFlags87 FunctionFlags( 88 UINT16 i_nFlags = 0 ) 89 : nFlags(i_nFlags) {} 90 operator ==ary::cpp::FunctionFlags91 bool operator==( 92 const FunctionFlags & 93 i_ff ) const 94 { return nFlags == i_ff.nFlags; } operator !=ary::cpp::FunctionFlags95 bool operator!=( 96 const FunctionFlags & 97 i_ff ) const 98 { return NOT operator==(i_ff); } 99 Resetary::cpp::FunctionFlags100 void Reset() { nFlags = 0; } 101 SetStaticLocalary::cpp::FunctionFlags102 void SetStaticLocal() { nFlags |= f_static_local; } SetStaticMemberary::cpp::FunctionFlags103 void SetStaticMember() { nFlags |= f_static_member; } SetExternary::cpp::FunctionFlags104 void SetExtern() { nFlags |= f_extern; } SetExternCary::cpp::FunctionFlags105 void SetExternC() { nFlags |= f_externC; } SetMutableary::cpp::FunctionFlags106 void SetMutable() { nFlags |= f_mutable; } SetInlineary::cpp::FunctionFlags107 void SetInline() { nFlags |= f_inline; } SetRegisterary::cpp::FunctionFlags108 void SetRegister() { nFlags |= f_register; } SetExplicitary::cpp::FunctionFlags109 void SetExplicit() { nFlags |= f_explicit; } 110 IsStaticLocalary::cpp::FunctionFlags111 bool IsStaticLocal() const { return (nFlags & f_static_local) != 0; } IsStaticMemberary::cpp::FunctionFlags112 bool IsStaticMember() const { return (nFlags & f_static_member) != 0; } IsExternary::cpp::FunctionFlags113 bool IsExtern() const { return (nFlags & f_extern) != 0; } IsExternCary::cpp::FunctionFlags114 bool IsExternC() const { return (nFlags & f_externC) != 0; } IsMutableary::cpp::FunctionFlags115 bool IsMutable() const { return (nFlags & f_mutable) != 0; } IsInlineary::cpp::FunctionFlags116 bool IsInline() const { return (nFlags & f_inline) != 0; } IsRegisterary::cpp::FunctionFlags117 bool IsRegister() const { return (nFlags & f_register) != 0; } IsExplicitary::cpp::FunctionFlags118 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 S_Parameterary::cpp::S_Parameter134 S_Parameter() : nType(0) {} ~S_Parameterary::cpp::S_Parameter135 ~S_Parameter() {} Emptyary::cpp::S_Parameter136 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