1*1c78a5d6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1c78a5d6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1c78a5d6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1c78a5d6SAndrew Rist * distributed with this work for additional information 6*1c78a5d6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1c78a5d6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1c78a5d6SAndrew Rist * "License"); you may not use this file except in compliance 9*1c78a5d6SAndrew Rist * with the License. You may obtain a copy of the License at 10*1c78a5d6SAndrew Rist * 11*1c78a5d6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1c78a5d6SAndrew Rist * 13*1c78a5d6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1c78a5d6SAndrew Rist * software distributed under the License is distributed on an 15*1c78a5d6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1c78a5d6SAndrew Rist * KIND, either express or implied. See the License for the 17*1c78a5d6SAndrew Rist * specific language governing permissions and limitations 18*1c78a5d6SAndrew Rist * under the License. 19*1c78a5d6SAndrew Rist * 20*1c78a5d6SAndrew Rist *************************************************************/ 21*1c78a5d6SAndrew Rist 22*1c78a5d6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef ARY_CPP_C_VFFLAG_HXX 25cdf0e10cSrcweir #define ARY_CPP_C_VFFLAG_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir // USED SERVICES 28cdf0e10cSrcweir 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace ary 31cdf0e10cSrcweir { 32cdf0e10cSrcweir namespace cpp 33cdf0e10cSrcweir { 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweir /** Properties of C++ variables. 37cdf0e10cSrcweir */ 38cdf0e10cSrcweir struct VariableFlags 39cdf0e10cSrcweir { 40cdf0e10cSrcweir public: 41cdf0e10cSrcweir enum E_Flags 42cdf0e10cSrcweir { 43cdf0e10cSrcweir f_static_local = 0x0001, 44cdf0e10cSrcweir f_static_member = 0x0002, 45cdf0e10cSrcweir f_extern = 0x0004, 46cdf0e10cSrcweir f_mutable = 0x0008 47cdf0e10cSrcweir }; 48cdf0e10cSrcweir VariableFlagsary::cpp::VariableFlags49cdf0e10cSrcweir VariableFlags( 50cdf0e10cSrcweir UINT16 i_nFlags = 0 ) 51cdf0e10cSrcweir : nFlags(i_nFlags) {} 52cdf0e10cSrcweir Resetary::cpp::VariableFlags53cdf0e10cSrcweir void Reset() { nFlags = 0; } 54cdf0e10cSrcweir SetStaticLocalary::cpp::VariableFlags55cdf0e10cSrcweir void SetStaticLocal() { nFlags |= f_static_local; } SetStaticMemberary::cpp::VariableFlags56cdf0e10cSrcweir void SetStaticMember() { nFlags |= f_static_member; } SetExternary::cpp::VariableFlags57cdf0e10cSrcweir void SetExtern() { nFlags |= f_extern; } SetMutableary::cpp::VariableFlags58cdf0e10cSrcweir void SetMutable() { nFlags |= f_mutable; } 59cdf0e10cSrcweir IsStaticLocalary::cpp::VariableFlags60cdf0e10cSrcweir bool IsStaticLocal() const { return (nFlags & f_static_local) != 0; } IsStaticMemberary::cpp::VariableFlags61cdf0e10cSrcweir bool IsStaticMember() const { return (nFlags & f_static_member) != 0; } IsExternary::cpp::VariableFlags62cdf0e10cSrcweir bool IsExtern() const { return (nFlags & f_extern) != 0; } IsMutableary::cpp::VariableFlags63cdf0e10cSrcweir bool IsMutable() const { return (nFlags & f_mutable) != 0; } 64cdf0e10cSrcweir 65cdf0e10cSrcweir private: 66cdf0e10cSrcweir UINT16 nFlags; 67cdf0e10cSrcweir }; 68cdf0e10cSrcweir 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** Properties of C++ functions. 71cdf0e10cSrcweir */ 72cdf0e10cSrcweir struct FunctionFlags 73cdf0e10cSrcweir { 74cdf0e10cSrcweir public: 75cdf0e10cSrcweir enum E_Flags 76cdf0e10cSrcweir { 77cdf0e10cSrcweir f_static_local = 0x0001, 78cdf0e10cSrcweir f_static_member = 0x0002, 79cdf0e10cSrcweir f_extern = 0x0004, 80cdf0e10cSrcweir f_externC = 0x0008, 81cdf0e10cSrcweir f_mutable = 0x0010, 82cdf0e10cSrcweir f_inline = 0x0100, 83cdf0e10cSrcweir f_register = 0x0200, 84cdf0e10cSrcweir f_explicit = 0x0400 85cdf0e10cSrcweir }; 86cdf0e10cSrcweir FunctionFlagsary::cpp::FunctionFlags87cdf0e10cSrcweir FunctionFlags( 88cdf0e10cSrcweir UINT16 i_nFlags = 0 ) 89cdf0e10cSrcweir : nFlags(i_nFlags) {} 90cdf0e10cSrcweir operator ==ary::cpp::FunctionFlags91cdf0e10cSrcweir bool operator==( 92cdf0e10cSrcweir const FunctionFlags & 93cdf0e10cSrcweir i_ff ) const 94cdf0e10cSrcweir { return nFlags == i_ff.nFlags; } operator !=ary::cpp::FunctionFlags95cdf0e10cSrcweir bool operator!=( 96cdf0e10cSrcweir const FunctionFlags & 97cdf0e10cSrcweir i_ff ) const 98cdf0e10cSrcweir { return NOT operator==(i_ff); } 99cdf0e10cSrcweir Resetary::cpp::FunctionFlags100cdf0e10cSrcweir void Reset() { nFlags = 0; } 101cdf0e10cSrcweir SetStaticLocalary::cpp::FunctionFlags102cdf0e10cSrcweir void SetStaticLocal() { nFlags |= f_static_local; } SetStaticMemberary::cpp::FunctionFlags103cdf0e10cSrcweir void SetStaticMember() { nFlags |= f_static_member; } SetExternary::cpp::FunctionFlags104cdf0e10cSrcweir void SetExtern() { nFlags |= f_extern; } SetExternCary::cpp::FunctionFlags105cdf0e10cSrcweir void SetExternC() { nFlags |= f_externC; } SetMutableary::cpp::FunctionFlags106cdf0e10cSrcweir void SetMutable() { nFlags |= f_mutable; } SetInlineary::cpp::FunctionFlags107cdf0e10cSrcweir void SetInline() { nFlags |= f_inline; } SetRegisterary::cpp::FunctionFlags108cdf0e10cSrcweir void SetRegister() { nFlags |= f_register; } SetExplicitary::cpp::FunctionFlags109cdf0e10cSrcweir void SetExplicit() { nFlags |= f_explicit; } 110cdf0e10cSrcweir IsStaticLocalary::cpp::FunctionFlags111cdf0e10cSrcweir bool IsStaticLocal() const { return (nFlags & f_static_local) != 0; } IsStaticMemberary::cpp::FunctionFlags112cdf0e10cSrcweir bool IsStaticMember() const { return (nFlags & f_static_member) != 0; } IsExternary::cpp::FunctionFlags113cdf0e10cSrcweir bool IsExtern() const { return (nFlags & f_extern) != 0; } IsExternCary::cpp::FunctionFlags114cdf0e10cSrcweir bool IsExternC() const { return (nFlags & f_externC) != 0; } IsMutableary::cpp::FunctionFlags115cdf0e10cSrcweir bool IsMutable() const { return (nFlags & f_mutable) != 0; } IsInlineary::cpp::FunctionFlags116cdf0e10cSrcweir bool IsInline() const { return (nFlags & f_inline) != 0; } IsRegisterary::cpp::FunctionFlags117cdf0e10cSrcweir bool IsRegister() const { return (nFlags & f_register) != 0; } IsExplicitary::cpp::FunctionFlags118cdf0e10cSrcweir bool IsExplicit() const { return (nFlags & f_explicit) != 0; } 119cdf0e10cSrcweir 120cdf0e10cSrcweir private: 121cdf0e10cSrcweir UINT16 nFlags; 122cdf0e10cSrcweir }; 123cdf0e10cSrcweir 124cdf0e10cSrcweir 125cdf0e10cSrcweir /** A C++ function parameter. 126cdf0e10cSrcweir */ 127cdf0e10cSrcweir struct S_Parameter 128cdf0e10cSrcweir { 129cdf0e10cSrcweir String sName; 130cdf0e10cSrcweir String sSizeExpression; 131cdf0e10cSrcweir String sInitExpression; 132cdf0e10cSrcweir Type_id nType; 133cdf0e10cSrcweir S_Parameterary::cpp::S_Parameter134cdf0e10cSrcweir S_Parameter() : nType(0) {} ~S_Parameterary::cpp::S_Parameter135cdf0e10cSrcweir ~S_Parameter() {} Emptyary::cpp::S_Parameter136cdf0e10cSrcweir void Empty() { nType = Type_id(0); 137cdf0e10cSrcweir sName.clear(); 138cdf0e10cSrcweir sSizeExpression.clear(); 139cdf0e10cSrcweir sInitExpression.clear(); } 140cdf0e10cSrcweir }; 141cdf0e10cSrcweir 142cdf0e10cSrcweir 143cdf0e10cSrcweir 144cdf0e10cSrcweir 145cdf0e10cSrcweir } // namespace cpp 146cdf0e10cSrcweir } // namespace ary 147cdf0e10cSrcweir #endif 148