1*d291ea28SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*d291ea28SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d291ea28SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d291ea28SAndrew Rist * distributed with this work for additional information 6*d291ea28SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d291ea28SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d291ea28SAndrew Rist * "License"); you may not use this file except in compliance 9*d291ea28SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*d291ea28SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*d291ea28SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d291ea28SAndrew Rist * software distributed under the License is distributed on an 15*d291ea28SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d291ea28SAndrew Rist * KIND, either express or implied. See the License for the 17*d291ea28SAndrew Rist * specific language governing permissions and limitations 18*d291ea28SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*d291ea28SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include "ca_def.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include <ary/cpp/c_define.hxx> 28cdf0e10cSrcweir #include <ary/cpp/c_macro.hxx> 29cdf0e10cSrcweir #include <ary/loc/loc_file.hxx> 30cdf0e10cSrcweir #include <ary/cpp/inpcontx.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace ary 36cdf0e10cSrcweir { 37cdf0e10cSrcweir namespace cpp 38cdf0e10cSrcweir { 39cdf0e10cSrcweir 40cdf0e10cSrcweir 41cdf0e10cSrcweir DefAdmin::DefAdmin(RepositoryPartition & io_myReposyPartition) 42cdf0e10cSrcweir : aStorage(), 43cdf0e10cSrcweir pCppRepositoryPartition(&io_myReposyPartition) 44cdf0e10cSrcweir { 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir DefAdmin::~DefAdmin() 48cdf0e10cSrcweir { 49cdf0e10cSrcweir } 50cdf0e10cSrcweir 51cdf0e10cSrcweir Define & 52cdf0e10cSrcweir DefAdmin::Store_Define( const InputContext& i_rContext, 53cdf0e10cSrcweir const String & i_sName, 54cdf0e10cSrcweir const StringVector & i_rDefinition ) 55cdf0e10cSrcweir { 56cdf0e10cSrcweir Define & 57cdf0e10cSrcweir ret = *new Define( i_sName, 58cdf0e10cSrcweir i_rDefinition, 59cdf0e10cSrcweir i_rContext.CurFile().LeId() ); 60cdf0e10cSrcweir aStorage.Store_Define(ret); 61cdf0e10cSrcweir return ret; 62cdf0e10cSrcweir 63cdf0e10cSrcweir } 64cdf0e10cSrcweir 65cdf0e10cSrcweir Macro & 66cdf0e10cSrcweir DefAdmin::Store_Macro( const InputContext& i_rContext, 67cdf0e10cSrcweir const String & i_sName, 68cdf0e10cSrcweir const StringVector & i_rParams, 69cdf0e10cSrcweir const StringVector & i_rDefinition ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir Macro & 72cdf0e10cSrcweir ret = *new Macro( i_sName, 73cdf0e10cSrcweir i_rParams, 74cdf0e10cSrcweir i_rDefinition, 75cdf0e10cSrcweir i_rContext.CurFile().LeId() ); 76cdf0e10cSrcweir aStorage.Store_Macro(ret); 77cdf0e10cSrcweir return ret; 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir const DefineEntity & 81cdf0e10cSrcweir DefAdmin::Find_Def(De_id i_id) const 82cdf0e10cSrcweir { 83cdf0e10cSrcweir return aStorage[i_id]; 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir DefsResultList 87cdf0e10cSrcweir DefAdmin::AllDefines() const 88cdf0e10cSrcweir { 89cdf0e10cSrcweir return csv::make_range( aStorage.DefineIndex().Begin(), 90cdf0e10cSrcweir aStorage.DefineIndex().End() ); 91cdf0e10cSrcweir } 92cdf0e10cSrcweir 93cdf0e10cSrcweir DefsResultList 94cdf0e10cSrcweir DefAdmin::AllMacros() const 95cdf0e10cSrcweir { 96cdf0e10cSrcweir return csv::make_range( aStorage.MacroIndex().Begin(), 97cdf0e10cSrcweir aStorage.MacroIndex().End() ); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir 103cdf0e10cSrcweir 104cdf0e10cSrcweir } // namespace cpp 105cdf0e10cSrcweir } // namespace ary 106