00001 /* 00002 * filepath.h 00003 * 00004 * File system path string abstraction class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-1998 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions are Copyright (C) 1993 Free Software Foundation, Inc. 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Log: filepath.h,v $ 00030 * Revision 1.22 2005/11/25 03:43:47 csoutheren 00031 * Fixed function argument comments to be compatible with Doxygen 00032 * 00033 * Revision 1.21 2003/09/17 05:41:58 csoutheren 00034 * Removed recursive includes 00035 * 00036 * Revision 1.20 2003/09/17 01:18:02 csoutheren 00037 * Removed recursive include file system and removed all references 00038 * to deprecated coooperative threading support 00039 * 00040 * Revision 1.19 2002/11/19 10:32:26 robertj 00041 * Changed PFilePath so can be empty string, indicating illegal path. 00042 * 00043 * Revision 1.18 2002/09/16 01:08:59 robertj 00044 * Added #define so can select if #pragma interface/implementation is used on 00045 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00046 * 00047 * Revision 1.17 2001/05/22 12:49:32 robertj 00048 * Did some seriously wierd rewrite of platform headers to eliminate the 00049 * stupid GNU compiler warning about braces not matching. 00050 * 00051 * Revision 1.16 2001/02/13 04:39:08 robertj 00052 * Fixed problem with operator= in container classes. Some containers will 00053 * break unless the copy is virtual (eg PStringStream's buffer pointers) so 00054 * needed to add a new AssignContents() function to all containers. 00055 * 00056 * Revision 1.15 1999/03/09 02:59:49 robertj 00057 * Changed comments to doc++ compatible documentation. 00058 * 00059 * Revision 1.14 1999/02/16 08:07:11 robertj 00060 * MSVC 6.0 compatibility changes. 00061 * 00062 * Revision 1.13 1998/11/30 08:57:16 robertj 00063 * Fixed problem where if += is used on PFilePath, it no longer may be normalised. 00064 * 00065 * Revision 1.12 1998/09/23 06:20:37 robertj 00066 * Added open source copyright license. 00067 * 00068 * Revision 1.11 1998/02/16 00:14:57 robertj 00069 * Added functions to validate characters in a filename. 00070 * 00071 * Revision 1.10 1995/07/31 12:03:37 robertj 00072 * Added copy constructor and assignment operator for right types. 00073 * 00074 * Revision 1.9 1995/04/22 00:43:43 robertj 00075 * Added Move() function and changed semantics of Rename(). 00076 * Changed all file name strings to PFilePath objects. 00077 * 00078 * Revision 1.8 1995/03/14 12:41:25 robertj 00079 * Updated documentation to use HTML codes. 00080 * 00081 * Revision 1.7 1994/12/21 11:52:57 robertj 00082 * Documentation and variable normalisation. 00083 * 00084 * Revision 1.6 1994/10/24 00:06:58 robertj 00085 * Changed PFilePath and PDirectory so descends from either PString or 00086 * PCaselessString depending on the platform. 00087 * 00088 * Revision 1.5 1994/08/23 11:32:52 robertj 00089 * Oops 00090 * 00091 * Revision 1.4 1994/08/22 00:46:48 robertj 00092 * Added pragma fro GNU C++ compiler. 00093 * 00094 * Revision 1.3 1994/08/21 23:43:02 robertj 00095 * Changed parameter before variable argument list to NOT be a reference. 00096 * 00097 * Revision 1.2 1994/06/25 11:55:15 robertj 00098 * Unix version synchronisation. 00099 * 00100 * Revision 1.1 1994/04/20 12:17:44 robertj 00101 * Initial revision 00102 * 00103 */ 00104 00105 #ifndef _PFILEPATH 00106 #define _PFILEPATH 00107 00108 #ifdef P_USE_PRAGMA 00109 #pragma interface 00110 #endif 00111 00112 00113 #ifdef DOC_PLUS_PLUS 00114 00119 class PFilePathString : public PString { }; 00120 #endif 00121 00122 00124 // File Specification 00125 00136 class PFilePath : public PFilePathString 00137 { 00138 PCLASSINFO(PFilePath, PFilePathString); 00139 00140 public: 00145 PFilePath(); 00146 00157 PFilePath( 00158 const char * cstr 00159 ); 00160 00171 PFilePath( 00172 const PString & str 00173 ); 00174 00177 PFilePath( 00178 const PFilePath & path 00179 ); 00180 00186 PFilePath( 00187 const char * prefix, 00188 const char * dir 00189 ); 00190 00193 PFilePath & operator=( 00194 const PFilePath & path 00195 ); 00206 PFilePath & operator=( 00207 const PString & str 00208 ); 00219 PFilePath & operator=( 00220 const char * cstr 00221 ); 00223 00231 PFilePath & operator+=( 00232 const PString & str 00233 ); 00234 00244 PFilePath & operator+=( 00245 const char * cstr 00246 ); 00247 00257 PFilePath & operator+=( 00258 char ch // Character to concatenate. 00259 ); 00261 00272 PFilePathString GetVolume() const; 00273 00282 PFilePathString GetPath() const; 00283 00290 PFilePathString GetTitle() const; 00291 00303 PFilePathString GetType() const; 00304 00314 PFilePathString GetFileName() const; 00315 00328 PDirectory GetDirectory() const; 00329 00333 void SetType( 00334 const PFilePathString & type 00335 ); 00337 00345 static BOOL IsValid( 00346 char c 00347 ); 00348 00354 static BOOL IsValid( 00355 const PString & str 00356 ); 00358 00359 00360 protected: 00361 virtual void AssignContents(const PContainer & cont); 00362 00363 00364 // Include platform dependent part of class 00365 #ifdef _WIN32 00366 #include "msos/ptlib/filepath.h" 00367 #else 00368 #include "unix/ptlib/filepath.h" 00369 #endif 00370 }; 00371 00372 #endif 00373 00374 // End Of File ///////////////////////////////////////////////////////////////