xref: /aoo41x/main/cosv/inc/cosv/ploc_dir.hxx (revision ac3d0c65)
1*ac3d0c65SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ac3d0c65SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ac3d0c65SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ac3d0c65SAndrew Rist  * distributed with this work for additional information
6*ac3d0c65SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ac3d0c65SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ac3d0c65SAndrew Rist  * "License"); you may not use this file except in compliance
9*ac3d0c65SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ac3d0c65SAndrew Rist  *
11*ac3d0c65SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ac3d0c65SAndrew Rist  *
13*ac3d0c65SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ac3d0c65SAndrew Rist  * software distributed under the License is distributed on an
15*ac3d0c65SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ac3d0c65SAndrew Rist  * KIND, either express or implied.  See the License for the
17*ac3d0c65SAndrew Rist  * specific language governing permissions and limitations
18*ac3d0c65SAndrew Rist  * under the License.
19*ac3d0c65SAndrew Rist  *
20*ac3d0c65SAndrew Rist  *************************************************************/
21*ac3d0c65SAndrew Rist 
22*ac3d0c65SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef CSV_PLOCDIR_HXX
25cdf0e10cSrcweir #define CSV_PLOCDIR_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir // USED SERVICES
29cdf0e10cSrcweir 	// BASE CLASSES
30cdf0e10cSrcweir #include <cosv/persist.hxx>
31cdf0e10cSrcweir 	// COMPONENTS
32cdf0e10cSrcweir #include <cosv/ploc.hxx>
33cdf0e10cSrcweir 	// PARAMETERS
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace csv
36cdf0e10cSrcweir {
37cdf0e10cSrcweir namespace ploc
38cdf0e10cSrcweir {
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class DirectoryChain;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir enum E_Recursivity
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     flat,
45cdf0e10cSrcweir     recursive
46cdf0e10cSrcweir };
47cdf0e10cSrcweir 
48cdf0e10cSrcweir class Directory : public Persistent
49cdf0e10cSrcweir {
50cdf0e10cSrcweir   public:
51cdf0e10cSrcweir     // LIFECYCLE
52cdf0e10cSrcweir                         Directory();
53cdf0e10cSrcweir                         Directory(
54cdf0e10cSrcweir                             const Path &        i_rLocation );
55cdf0e10cSrcweir                         Directory(
56cdf0e10cSrcweir                             const char *        i_rLocation );
57cdf0e10cSrcweir                         Directory(
58cdf0e10cSrcweir                             const String &      i_rLocation );
59cdf0e10cSrcweir                         Directory(
60cdf0e10cSrcweir                             const Directory &   i_rDir );
61cdf0e10cSrcweir     virtual             ~Directory();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     // OPERATORS
64cdf0e10cSrcweir 	Directory &			operator+=(
65cdf0e10cSrcweir 							const String &      i_sName );
66cdf0e10cSrcweir 	Directory &			operator+=(
67cdf0e10cSrcweir 							const DirectoryChain &
68cdf0e10cSrcweir                                                 i_sDirChain );
69cdf0e10cSrcweir 	Directory &			operator-=(
70cdf0e10cSrcweir 							uintt               i_nLevels );
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     // OPERATIONS
73cdf0e10cSrcweir     bool                PhysicalCreate(
74cdf0e10cSrcweir                             bool                i_bCreateParentsIfNecessary = true ) const;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     // INQUIRY
77cdf0e10cSrcweir 	void				GetContainedDirectories(
78cdf0e10cSrcweir 							StringVector &		o_rResult ) const;
79cdf0e10cSrcweir     /** @param i_sFilter
80cdf0e10cSrcweir         Currently only filters of the form "*.ending" or "*.*"
81cdf0e10cSrcweir         (the default) are processed correctly under UNIX. Under WNT this
82cdf0e10cSrcweir         restriction does not apply.
83cdf0e10cSrcweir     */
84cdf0e10cSrcweir 	void				GetContainedFiles(
85cdf0e10cSrcweir 							StringVector &		o_rResult,
86cdf0e10cSrcweir 							const char *		i_sFilter = "*.*",
87cdf0e10cSrcweir                             E_Recursivity       i_eRecursivity = flat ) const;
88cdf0e10cSrcweir   private:
89cdf0e10cSrcweir     // Interface Peristent:
90cdf0e10cSrcweir 	virtual const Path &
91cdf0e10cSrcweir                         inq_MyPath() const;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // Locals:
94cdf0e10cSrcweir     /** @return
95cdf0e10cSrcweir         true, if parent(!) directory exists or could be created.
96cdf0e10cSrcweir         false, if this is a root directory.
97cdf0e10cSrcweir     */
98cdf0e10cSrcweir     bool                Check_Parent() const;
99cdf0e10cSrcweir     bool                PhysicalCreate_Dir(
100cdf0e10cSrcweir                             const char *        i_sStr ) const;
101cdf0e10cSrcweir     // DATA
102cdf0e10cSrcweir     Path                aPath;
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 
107cdf0e10cSrcweir }   // namespace ploc
108cdf0e10cSrcweir }   // namespace csv
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112cdf0e10cSrcweir #endif
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 
115