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_VARI_HXX 25 #define ARY_CPP_C_VARI_HXX 26 27 28 // USED SERVICES 29 // BASE CLASSES 30 #include <ary/cpp/c_ce.hxx> 31 // OTHER 32 #include <ary/cessentl.hxx> 33 #include <ary/cpp/c_types4cpp.hxx> 34 #include <ary/cpp/c_vfflag.hxx> 35 36 37 38 namespace ary 39 { 40 namespace cpp 41 { 42 43 44 /** A C++ variable or constant declaration. 45 */ 46 class Variable : public CodeEntity 47 { 48 public: 49 // LIFECYCLE 50 enum E_ClassId { class_id = 1005 }; 51 52 Variable( 53 const String & i_sLocalName, 54 Ce_id i_nOwner, 55 E_Protection i_eProtection, 56 loc::Le_id i_nFile, 57 Type_id i_nType, 58 VariableFlags i_aFlags, 59 const String & i_sArraySize, 60 const String & i_sInitValue ); 61 ~Variable(); 62 63 64 // INQUIRY 65 Type_id Type() const; 66 const String & ArraySize() const; 67 const String & Initialisation() const; Protection() const68 E_Protection Protection() const { return eProtection; } 69 70 private: 71 // Interface csv::ConstProcessorClient 72 virtual void do_Accept( 73 csv::ProcessorIfc & io_processor ) const; 74 75 // Interface ary::cpp::CodeEntity 76 virtual const String & 77 inq_LocalName() const; 78 virtual Cid inq_Owner() const; 79 virtual Lid inq_Location() const; 80 81 // Interface ary::cpp::CppEntity 82 virtual ClassId get_AryClass() const; 83 84 // DATA 85 CeEssentials aEssentials; 86 Type_id nType; 87 E_Protection eProtection; 88 VariableFlags aFlags; 89 String sArraySize; 90 String sInitialisation; 91 }; 92 93 94 95 // IMPLEMENTATION 96 inline Type_id Type() const97 Variable::Type() const 98 { return nType; } 99 inline const String & ArraySize() const100 Variable::ArraySize() const 101 { return sArraySize; } 102 inline const String & Initialisation() const103 Variable::Initialisation() const 104 { return sInitialisation; } 105 106 107 108 } // namespace cpp 109 } // namespace ary 110 #endif 111