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