xref: /aoo42x/main/autodoc/inc/cosv/ploc_dir.hxx (revision 8a106958)
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 CSV_PLOCDIR_HXX
25 #define CSV_PLOCDIR_HXX
26 
27 
28 // USED SERVICES
29 	// BASE CLASSES
30 #include <cosv/persist.hxx>
31 	// COMPONENTS
32 #include <cosv/ploc.hxx>
33 	// PARAMETERS
34 
35 namespace csv
36 {
37 namespace ploc
38 {
39 
40 class DirectoryChain;
41 
42 enum E_Recursivity
43 {
44     flat,
45     recursive
46 };
47 
48 class Directory : public Persistent
49 {
50   public:
51     // LIFECYCLE
52                         Directory();
53                         Directory(
54                             const Path &        i_rLocation );
55                         Directory(
56                             const char *        i_rLocation );
57                         Directory(
58                             const String &      i_rLocation );
59                         Directory(
60                             const Directory &   i_rDir );
61     virtual             ~Directory();
62 
63     // OPERATORS
64 	Directory &			operator+=(
65 							const String &      i_sName );
66 	Directory &			operator+=(
67 							const DirectoryChain &
68                                                 i_sDirChain );
69 	Directory &			operator-=(
70 							uintt               i_nLevels );
71 
72     // OPERATIONS
73     bool                PhysicalCreate(
74                             bool                i_bCreateParentsIfNecessary = true ) const;
75 
76     // INQUIRY
77 	void				GetContainedDirectories(
78 							StringVector &		o_rResult ) const;
79     /** @param i_sFilter
80         Currently only filters of the form "*.ending" or "*.*"
81         (the default) are processed correctly under UNIX. Under WNT this
82         restriction does not apply.
83     */
84 	void				GetContainedFiles(
85 							StringVector &		o_rResult,
86 							const char *		i_sFilter = "*.*",
87                             E_Recursivity       i_eRecursivity = flat ) const;
88   private:
89     // Interface Persistent:
90 	virtual const Path &
91                         inq_MyPath() const;
92 
93     // Locals:
94     /** @return
95         true, if parent(!) directory exists or could be created.
96         false, if this is a root directory.
97     */
98     bool                Check_Parent() const;
99     bool                PhysicalCreate_Dir(
100                             const char *        i_sStr ) const;
101     // DATA
102     Path                aPath;
103 };
104 
105 
106 
107 }   // namespace ploc
108 }   // namespace csv
109 
110 
111 
112 #endif
113 
114 
115