1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <precomp.h> 29 #include "ca_def.hxx" 30 31 32 // NOT FULLY DEFINED SERVICES 33 #include <ary/cpp/c_define.hxx> 34 #include <ary/cpp/c_macro.hxx> 35 #include <ary/loc/loc_file.hxx> 36 #include <ary/cpp/inpcontx.hxx> 37 38 39 40 41 namespace ary 42 { 43 namespace cpp 44 { 45 46 47 DefAdmin::DefAdmin(RepositoryPartition & io_myReposyPartition) 48 : aStorage(), 49 pCppRepositoryPartition(&io_myReposyPartition) 50 { 51 } 52 53 DefAdmin::~DefAdmin() 54 { 55 } 56 57 Define & 58 DefAdmin::Store_Define( const InputContext& i_rContext, 59 const String & i_sName, 60 const StringVector & i_rDefinition ) 61 { 62 Define & 63 ret = *new Define( i_sName, 64 i_rDefinition, 65 i_rContext.CurFile().LeId() ); 66 aStorage.Store_Define(ret); 67 return ret; 68 69 } 70 71 Macro & 72 DefAdmin::Store_Macro( const InputContext& i_rContext, 73 const String & i_sName, 74 const StringVector & i_rParams, 75 const StringVector & i_rDefinition ) 76 { 77 Macro & 78 ret = *new Macro( i_sName, 79 i_rParams, 80 i_rDefinition, 81 i_rContext.CurFile().LeId() ); 82 aStorage.Store_Macro(ret); 83 return ret; 84 } 85 86 const DefineEntity & 87 DefAdmin::Find_Def(De_id i_id) const 88 { 89 return aStorage[i_id]; 90 } 91 92 DefsResultList 93 DefAdmin::AllDefines() const 94 { 95 return csv::make_range( aStorage.DefineIndex().Begin(), 96 aStorage.DefineIndex().End() ); 97 } 98 99 DefsResultList 100 DefAdmin::AllMacros() const 101 { 102 return csv::make_range( aStorage.MacroIndex().Begin(), 103 aStorage.MacroIndex().End() ); 104 } 105 106 107 108 109 110 } // namespace cpp 111 } // namespace ary 112