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