xref: /aoo4110/main/autodoc/inc/ary/loc/loc_dir.hxx (revision b1cdbd2c)
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 
23 
24 #ifndef ARY_LOC_DIR_HXX
25 #define ARY_LOC_DIR_HXX
26 
27 // BASE CLASSES
28 #include <ary/loc/loc_le.hxx>
29 
30 // USED SERVICES
31 #include <ary/loc/loc_traits.hxx>
32 #include <ary/symtreenode.hxx>
33 
34 namespace ary
35 {
36 namespace loc
37 {
38     class File;
39 }
40 }
41 
42 
43 
44 
45 namespace ary
46 {
47 namespace loc
48 {
49 
50 
51 /** Represents a directory for source code files.
52 */
53 class Directory : public LocationEntity
54 {
55   public:
56     enum E_ClassId { class_id = 7030 };
57 
58     typedef ::ary::symtree::Node<LeNode_Traits>    node_t;
59 
60     /// Used for root directories.
61 	explicit		    Directory(
62 							Le_id               i_assignedRoot );
63 
64     /// Used for subdirectories which have a parent directory.
65 						Directory(
66 							const String  &     i_localName,
67 							Le_id               i_parentDirectory );
68 	virtual			    ~Directory();
69 
70     void                Add_Dir(
71                             const Directory  &  i_dir );
72     void                Add_File(
73                             const File &        i_file );
74 
75     Le_id               Parent() const;
76     Le_id               AssignedRoot() const;
77 
78     Le_id               Search_Dir(
79                             const String &      i_name ) const;
80     Le_id               Search_File(
81                             const String &      i_name ) const;
82 
83     const node_t &      AsNode() const;
84     node_t &            AsNode();
85 
86   private:
87     struct Container;
88 
89     // Interface csv::ConstProcessorClient:
90     virtual void        do_Accept(
91                             csv::ProcessorIfc & io_processor ) const;
92     // Interface ary::Object:
93     virtual ClassId     get_AryClass() const;
94 
95     // Interface LocationEntity:
96     virtual const String &
97                         inq_LocalName() const;
98     virtual Le_id       inq_ParentDirectory() const;
99 
100 	// DATA
101 	String              sLocalName;
102 	Le_id               nParentDirectory;
103 	Le_id               nAssignedRoot;
104     node_t              aAssignedNode;
105     Dyn<Container>      pChildren;
106 };
107 
108 
109 
110 
111 // IMPLEMENTATION
112 inline Le_id
Parent() const113 Directory::Parent() const
114 {
115     return nParentDirectory;
116 }
117 
118 inline Le_id
AssignedRoot() const119 Directory::AssignedRoot() const
120 {
121     return nAssignedRoot;
122 }
123 
124 inline const Directory::node_t &
AsNode() const125 Directory::AsNode() const
126 {
127     return aAssignedNode;
128 }
129 
130 inline Directory::node_t &
AsNode()131 Directory::AsNode()
132 {
133     return aAssignedNode;
134 }
135 
136 
137 
138 
139 } // namespace loc
140 } // namespace ary
141 #endif
142