xref: /aoo42x/main/autodoc/source/ary/cpp/ca_def.cxx (revision d291ea28)
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 #include <precomp.h>
23 #include "ca_def.hxx"
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <ary/cpp/c_define.hxx>
28 #include <ary/cpp/c_macro.hxx>
29 #include <ary/loc/loc_file.hxx>
30 #include <ary/cpp/inpcontx.hxx>
31 
32 
33 
34 
35 namespace ary
36 {
37 namespace cpp
38 {
39 
40 
DefAdmin(RepositoryPartition & io_myReposyPartition)41 DefAdmin::DefAdmin(RepositoryPartition & io_myReposyPartition)
42     :   aStorage(),
43         pCppRepositoryPartition(&io_myReposyPartition)
44 {
45 }
46 
~DefAdmin()47 DefAdmin::~DefAdmin()
48 {
49 }
50 
51 Define &
Store_Define(const InputContext & i_rContext,const String & i_sName,const StringVector & i_rDefinition)52 DefAdmin::Store_Define( const InputContext&     i_rContext,
53 						const String  &         i_sName,
54                         const StringVector &    i_rDefinition )
55 {
56     Define &
57         ret = *new Define( i_sName,
58                            i_rDefinition,
59                            i_rContext.CurFile().LeId() );
60     aStorage.Store_Define(ret);
61     return ret;
62 
63 }
64 
65 Macro &
Store_Macro(const InputContext & i_rContext,const String & i_sName,const StringVector & i_rParams,const StringVector & i_rDefinition)66 DefAdmin::Store_Macro(  const InputContext&     i_rContext,
67 					    const String  &         i_sName,
68                         const StringVector &    i_rParams,
69                         const StringVector &    i_rDefinition )
70 {
71     Macro &
72         ret = *new Macro( i_sName,
73                           i_rParams,
74                           i_rDefinition,
75                           i_rContext.CurFile().LeId() );
76     aStorage.Store_Macro(ret);
77     return ret;
78 }
79 
80 const DefineEntity &
Find_Def(De_id i_id) const81 DefAdmin::Find_Def(De_id i_id) const
82 {
83     return aStorage[i_id];
84 }
85 
86 DefsResultList
AllDefines() const87 DefAdmin::AllDefines() const
88 {
89     return csv::make_range( aStorage.DefineIndex().Begin(),
90                             aStorage.DefineIndex().End() );
91 }
92 
93 DefsResultList
AllMacros() const94 DefAdmin::AllMacros() const
95 {
96     return csv::make_range( aStorage.MacroIndex().Begin(),
97                             aStorage.MacroIndex().End() );
98 }
99 
100 
101 
102 
103 
104 }   // namespace cpp
105 }   // namespace ary
106