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_DE_HXX 25 #define ARY_CPP_C_DE_HXX 26 27 28 29 // USED SERVICES 30 // BASE CLASSES 31 #include <ary/cpp/c_cppentity.hxx> 32 // OTHER 33 #include <ary/loc/loc_types4loc.hxx> 34 #include <ary/cpp/c_traits.hxx> 35 36 37 38 39 namespace ary 40 { 41 namespace cpp 42 { 43 44 45 /** Describes a C/C++ #define statement. May be a define or a macro, for which 46 two cases the two different constructors are to be used. 47 48 This class is used by cpp::PreProcessor. 49 */ 50 class DefineEntity : public ary::cpp::CppEntity 51 { 52 public: 53 typedef Def_Traits traits_t; 54 ~DefineEntity()55 virtual ~DefineEntity() {} 56 57 // INQUIRY DefId() const58 De_id DefId() const { return De_id(Id()); } 59 const String & LocalName() const; 60 loc::Le_id Location() const; 61 const StringVector & 62 DefinitionText() const; 63 // ACCESS 64 protected: 65 DefineEntity( 66 const String & i_name, 67 loc::Le_id i_declaringFile ); 68 private: 69 // Locals 70 virtual const StringVector & 71 inq_DefinitionText() const = 0; 72 73 // DATA 74 String sName; 75 loc::Le_id nLocation; 76 }; 77 78 79 80 81 // IMPLEMENTATION 82 inline const String & LocalName() const83DefineEntity::LocalName() const 84 { return sName; } 85 86 inline loc::Le_id Location() const87DefineEntity::Location() const 88 { return nLocation; } 89 90 inline const StringVector & DefinitionText() const91DefineEntity::DefinitionText() const 92 { return inq_DefinitionText(); } 93 94 95 96 97 98 } // end namespace cpp 99 } // end namespace ary 100 #endif 101