xref: /AOO41X/main/autodoc/source/ary/loc/loc_dir.cxx (revision d291ea287686f95dc2fff9ad28612d818a1c6b1e)
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 <ary/loc/loc_dir.hxx>
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <ary/loc/loc_file.hxx>
28cdf0e10cSrcweir #include <sortedids.hxx>
29cdf0e10cSrcweir #include "locs_le.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace ary
33cdf0e10cSrcweir {
34cdf0e10cSrcweir namespace loc
35cdf0e10cSrcweir {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir struct Directory::Container
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     typedef SortedIds<Le_Compare>           SortedChildList;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	SortedChildList     aSubDirectories;
42cdf0e10cSrcweir 	SortedChildList     aFiles;
43cdf0e10cSrcweir 
Containerary::loc::Directory::Container44cdf0e10cSrcweir 	                    Container()
45cdf0e10cSrcweir 	                        :   aSubDirectories(),
46cdf0e10cSrcweir 	                            aFiles()
47cdf0e10cSrcweir 	                        {}
48cdf0e10cSrcweir };
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 
Directory(Le_id i_assignedRoot)53cdf0e10cSrcweir Directory::Directory(Le_id i_assignedRoot)
54cdf0e10cSrcweir     :   sLocalName(),
55cdf0e10cSrcweir         nParentDirectory(0),
56cdf0e10cSrcweir         nAssignedRoot(i_assignedRoot),
57cdf0e10cSrcweir 	    aAssignedNode(),
58cdf0e10cSrcweir         pChildren(new Container)
59cdf0e10cSrcweir {
60cdf0e10cSrcweir     aAssignedNode.Assign_Entity(*this);
61cdf0e10cSrcweir }
62cdf0e10cSrcweir 
Directory(const String & i_localName,Le_id i_parentDirectory)63cdf0e10cSrcweir Directory::Directory( const String  &   i_localName,
64cdf0e10cSrcweir 					  Le_id             i_parentDirectory )
65cdf0e10cSrcweir     :   sLocalName(i_localName),
66cdf0e10cSrcweir         nParentDirectory(i_parentDirectory),
67cdf0e10cSrcweir         nAssignedRoot(0),
68cdf0e10cSrcweir 	    aAssignedNode(),
69cdf0e10cSrcweir         pChildren(new Container)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     aAssignedNode.Assign_Entity(*this);
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
~Directory()74cdf0e10cSrcweir Directory::~Directory()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir void
Add_Dir(const Directory & i_dir)79cdf0e10cSrcweir Directory::Add_Dir(const Directory  &  i_dir)
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     pChildren->aSubDirectories.Add(i_dir.LeId());
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir void
Add_File(const File & i_file)85cdf0e10cSrcweir Directory::Add_File(const File & i_file)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     pChildren->aFiles.Add(i_file.LeId());
88cdf0e10cSrcweir }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir Le_id
Search_Dir(const String & i_name) const91cdf0e10cSrcweir Directory::Search_Dir(const String & i_name) const
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     return pChildren->aSubDirectories.Search(i_name);
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir Le_id
Search_File(const String & i_name) const97cdf0e10cSrcweir Directory::Search_File(const String & i_name) const
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     return pChildren->aFiles.Search(i_name);
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir void
do_Accept(csv::ProcessorIfc & io_processor) const103cdf0e10cSrcweir Directory::do_Accept(csv::ProcessorIfc & io_processor) const
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     csv::CheckedCall(io_processor,*this);
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir ClassId
get_AryClass() const109cdf0e10cSrcweir Directory::get_AryClass() const
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     return class_id;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir const String &
inq_LocalName() const115cdf0e10cSrcweir Directory::inq_LocalName() const
116cdf0e10cSrcweir {
117cdf0e10cSrcweir     return sLocalName;
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir Le_id
inq_ParentDirectory() const121cdf0e10cSrcweir Directory::inq_ParentDirectory() const
122cdf0e10cSrcweir {
123cdf0e10cSrcweir     return nParentDirectory;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 
127cdf0e10cSrcweir } // namespace loc
128cdf0e10cSrcweir } // namespace ary
129