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