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 10cdf0e10cSrcweir * 11*1c78a5d6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 20*1c78a5d6SAndrew Rist *************************************************************/ 21*1c78a5d6SAndrew Rist 22*1c78a5d6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef ARY_CPP_C_NAMESP_HXX 25cdf0e10cSrcweir #define ARY_CPP_C_NAMESP_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir 29cdf0e10cSrcweir // USED SERVICES 30cdf0e10cSrcweir // BASE CLASSES 31cdf0e10cSrcweir #include <ary/cpp/c_ce.hxx> 32cdf0e10cSrcweir #include <ary/arygroup.hxx> 33cdf0e10cSrcweir // OTHER 34cdf0e10cSrcweir #include <ary/symtreenode.hxx> 35cdf0e10cSrcweir #include <ary/cessentl.hxx> 36cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx> 37cdf0e10cSrcweir #include <ary/cpp/c_slntry.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir namespace ary 40cdf0e10cSrcweir { 41cdf0e10cSrcweir namespace cpp 42cdf0e10cSrcweir { 43cdf0e10cSrcweir class Gate; 44cdf0e10cSrcweir class OperationSignature; 45cdf0e10cSrcweir } 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir 49cdf0e10cSrcweir 50cdf0e10cSrcweir namespace ary 51cdf0e10cSrcweir { 52cdf0e10cSrcweir namespace cpp 53cdf0e10cSrcweir { 54cdf0e10cSrcweir 55cdf0e10cSrcweir 56cdf0e10cSrcweir 57cdf0e10cSrcweir /** A C++ namespace. 58cdf0e10cSrcweir */ 59cdf0e10cSrcweir class Namespace : public CodeEntity, 60cdf0e10cSrcweir public AryGroup 61cdf0e10cSrcweir { 62cdf0e10cSrcweir public: 63cdf0e10cSrcweir enum E_ClassId { class_id = 1000 }; 64cdf0e10cSrcweir 65cdf0e10cSrcweir enum E_Slots 66cdf0e10cSrcweir { 67cdf0e10cSrcweir SLOT_SubNamespaces = 1, 68cdf0e10cSrcweir SLOT_Classes, 69cdf0e10cSrcweir SLOT_Enums, 70cdf0e10cSrcweir SLOT_Typedefs, 71cdf0e10cSrcweir SLOT_Operations, 72cdf0e10cSrcweir SLOT_Variables, 73cdf0e10cSrcweir SLOT_Constants 74cdf0e10cSrcweir }; 75cdf0e10cSrcweir 76cdf0e10cSrcweir typedef ::ary::symtree::Node<CeNode_Traits> node_t; 77cdf0e10cSrcweir 78cdf0e10cSrcweir Namespace(); 79cdf0e10cSrcweir Namespace( 80cdf0e10cSrcweir const String & i_sName, 81cdf0e10cSrcweir Namespace & i_rParent ); 82cdf0e10cSrcweir ~Namespace(); 83cdf0e10cSrcweir // OPERATIONS 84cdf0e10cSrcweir void Add_LocalNamespace( 85cdf0e10cSrcweir Namespace & io_rLocalNamespace ); 86cdf0e10cSrcweir void Add_LocalClass( 87cdf0e10cSrcweir const String & i_sLocalName, 88cdf0e10cSrcweir Cid i_nId ); 89cdf0e10cSrcweir void Add_LocalEnum( 90cdf0e10cSrcweir const String & i_sLocalName, 91cdf0e10cSrcweir Cid i_nId ); 92cdf0e10cSrcweir void Add_LocalTypedef( 93cdf0e10cSrcweir const String & i_sLocalName, 94cdf0e10cSrcweir Cid i_nId ); 95cdf0e10cSrcweir void Add_LocalOperation( 96cdf0e10cSrcweir const String & i_sLocalName, 97cdf0e10cSrcweir Cid i_nId ); 98cdf0e10cSrcweir void Add_LocalVariable( 99cdf0e10cSrcweir const String & i_sLocalName, 100cdf0e10cSrcweir Cid i_nId ); 101cdf0e10cSrcweir void Add_LocalConstant( 102cdf0e10cSrcweir const String & i_sLocalName, 103cdf0e10cSrcweir Cid i_nId ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // INQUIRY 106cdf0e10cSrcweir virtual uintt Depth() const; 107cdf0e10cSrcweir Namespace * Parent() const; 108cdf0e10cSrcweir 109cdf0e10cSrcweir Ce_id Search_Child( 110cdf0e10cSrcweir const String & i_key ) const; 111cdf0e10cSrcweir Namespace * Search_LocalNamespace( 112cdf0e10cSrcweir const String & i_sLocalName ) const; 113cdf0e10cSrcweir uintt Get_SubNamespaces( 114cdf0e10cSrcweir std::vector< const Namespace* > & 115cdf0e10cSrcweir o_rResultList ) const; 116cdf0e10cSrcweir Ce_id Search_LocalClass( 117cdf0e10cSrcweir const String & i_sName ) const; 118cdf0e10cSrcweir void Search_LocalOperations( 119cdf0e10cSrcweir std::vector<Ce_id> & 120cdf0e10cSrcweir o_result, 121cdf0e10cSrcweir const String & i_sName ) const; 122cdf0e10cSrcweir const node_t & AsNode() const; 123cdf0e10cSrcweir 124cdf0e10cSrcweir // ACCESS 125cdf0e10cSrcweir node_t & AsNode(); 126cdf0e10cSrcweir 127cdf0e10cSrcweir private: 128cdf0e10cSrcweir NON_COPYABLE(Namespace); 129cdf0e10cSrcweir 130cdf0e10cSrcweir // Interface csv::ConstProcessorClient 131cdf0e10cSrcweir virtual void do_Accept( 132cdf0e10cSrcweir csv::ProcessorIfc & io_processor ) const; 133cdf0e10cSrcweir 134cdf0e10cSrcweir // Interface CodeEntity 135cdf0e10cSrcweir virtual const String & 136cdf0e10cSrcweir inq_LocalName() const; 137cdf0e10cSrcweir virtual Cid inq_Owner() const; 138cdf0e10cSrcweir virtual Lid inq_Location() const; 139cdf0e10cSrcweir 140cdf0e10cSrcweir // Interface ary::cpp::CppEntity 141cdf0e10cSrcweir virtual ClassId get_AryClass() const; 142cdf0e10cSrcweir 143cdf0e10cSrcweir // Interface AryGroup 144cdf0e10cSrcweir virtual Gid inq_Id_Group() const; 145cdf0e10cSrcweir virtual const cpp::CppEntity & 146cdf0e10cSrcweir inq_RE_Group() const; 147cdf0e10cSrcweir virtual const ary::group::SlotList & 148cdf0e10cSrcweir inq_Slots() const; 149cdf0e10cSrcweir virtual DYN Slot * inq_Create_Slot( 150cdf0e10cSrcweir SlotAccessId i_nSlot ) const; 151cdf0e10cSrcweir // Local 152cdf0e10cSrcweir typedef std::multimap<String, Ce_id> Map_Operations; 153cdf0e10cSrcweir 154cdf0e10cSrcweir // DATA 155cdf0e10cSrcweir CeEssentials aEssentials; 156cdf0e10cSrcweir node_t aAssignedNode; 157cdf0e10cSrcweir 158cdf0e10cSrcweir Map_NamespacePtr aLocalNamespaces; 159cdf0e10cSrcweir Map_LocalCe aLocalClasses; 160cdf0e10cSrcweir Map_LocalCe aLocalEnums; 161cdf0e10cSrcweir Map_LocalCe aLocalTypedefs; 162cdf0e10cSrcweir Map_Operations aLocalOperations; 163cdf0e10cSrcweir Map_LocalCe aLocalVariables; 164cdf0e10cSrcweir Map_LocalCe aLocalConstants; 165cdf0e10cSrcweir 166cdf0e10cSrcweir Namespace * pParent; 167cdf0e10cSrcweir uintt nDepth; 168cdf0e10cSrcweir }; 169cdf0e10cSrcweir 170cdf0e10cSrcweir 171cdf0e10cSrcweir 172cdf0e10cSrcweir // IMPLEMENTATION 173cdf0e10cSrcweir inline const Namespace::node_t & 174cdf0e10cSrcweir Namespace::AsNode() const 175cdf0e10cSrcweir { 176cdf0e10cSrcweir return aAssignedNode; 177cdf0e10cSrcweir } 178cdf0e10cSrcweir 179cdf0e10cSrcweir inline Namespace::node_t & 180cdf0e10cSrcweir Namespace::AsNode() 181cdf0e10cSrcweir { 182cdf0e10cSrcweir return aAssignedNode; 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir 186cdf0e10cSrcweir 187cdf0e10cSrcweir 188cdf0e10cSrcweir } // namespace cpp 189cdf0e10cSrcweir } // ary 190cdf0e10cSrcweir #endif 191