Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

filepath.h

Go to the documentation of this file.
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.21  2003/09/17 05:41:58  csoutheren
00031  * Removed recursive includes
00032  *
00033  * Revision 1.20  2003/09/17 01:18:02  csoutheren
00034  * Removed recursive include file system and removed all references
00035  * to deprecated coooperative threading support
00036  *
00037  * Revision 1.19  2002/11/19 10:32:26  robertj
00038  * Changed PFilePath so can be empty string, indicating illegal path.
00039  *
00040  * Revision 1.18  2002/09/16 01:08:59  robertj
00041  * Added #define so can select if #pragma interface/implementation is used on
00042  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00043  *
00044  * Revision 1.17  2001/05/22 12:49:32  robertj
00045  * Did some seriously wierd rewrite of platform headers to eliminate the
00046  *   stupid GNU compiler warning about braces not matching.
00047  *
00048  * Revision 1.16  2001/02/13 04:39:08  robertj
00049  * Fixed problem with operator= in container classes. Some containers will
00050  *   break unless the copy is virtual (eg PStringStream's buffer pointers) so
00051  *   needed to add a new AssignContents() function to all containers.
00052  *
00053  * Revision 1.15  1999/03/09 02:59:49  robertj
00054  * Changed comments to doc++ compatible documentation.
00055  *
00056  * Revision 1.14  1999/02/16 08:07:11  robertj
00057  * MSVC 6.0 compatibility changes.
00058  *
00059  * Revision 1.13  1998/11/30 08:57:16  robertj
00060  * Fixed problem where if += is used on PFilePath, it no longer may be normalised.
00061  *
00062  * Revision 1.12  1998/09/23 06:20:37  robertj
00063  * Added open source copyright license.
00064  *
00065  * Revision 1.11  1998/02/16 00:14:57  robertj
00066  * Added functions to validate characters in a filename.
00067  *
00068  * Revision 1.10  1995/07/31 12:03:37  robertj
00069  * Added copy constructor and assignment operator for right types.
00070  *
00071  * Revision 1.9  1995/04/22 00:43:43  robertj
00072  * Added Move() function and changed semantics of Rename().
00073  * Changed all file name strings to PFilePath objects.
00074  *
00075  * Revision 1.8  1995/03/14 12:41:25  robertj
00076  * Updated documentation to use HTML codes.
00077  *
00078  * Revision 1.7  1994/12/21  11:52:57  robertj
00079  * Documentation and variable normalisation.
00080  *
00081  * Revision 1.6  1994/10/24  00:06:58  robertj
00082  * Changed PFilePath and PDirectory so descends from either PString or
00083  *     PCaselessString depending on the platform.
00084  *
00085  * Revision 1.5  1994/08/23  11:32:52  robertj
00086  * Oops
00087  *
00088  * Revision 1.4  1994/08/22  00:46:48  robertj
00089  * Added pragma fro GNU C++ compiler.
00090  *
00091  * Revision 1.3  1994/08/21  23:43:02  robertj
00092  * Changed parameter before variable argument list to NOT be a reference.
00093  *
00094  * Revision 1.2  1994/06/25  11:55:15  robertj
00095  * Unix version synchronisation.
00096  *
00097  * Revision 1.1  1994/04/20  12:17:44  robertj
00098  * Initial revision
00099  *
00100  */
00101 
00102 #ifndef _PFILEPATH
00103 #define _PFILEPATH
00104 
00105 #ifdef P_USE_PRAGMA
00106 #pragma interface
00107 #endif
00108 
00109 
00110 #ifdef DOC_PLUS_PLUS
00111 
00116 class PFilePathString : public PString { };
00117 #endif
00118 
00119 
00121 // File Specification
00122 
00133 class PFilePath : public PFilePathString
00134 {
00135   PCLASSINFO(PFilePath, PFilePathString);
00136 
00137   public:
00142     PFilePath();
00143 
00154     PFilePath(
00155       const char * cstr   
00156     );
00157 
00168     PFilePath(
00169       const PString & str 
00170     );
00171 
00174     PFilePath(
00175       const PFilePath & path 
00176     );
00177 
00183     PFilePath(
00184       const char * prefix,  
00185       const char * dir      
00186     );
00187 
00190     PFilePath & operator=(
00191       const PFilePath & path 
00192     );
00203     PFilePath & operator=(
00204       const PString & str 
00205     );
00216     PFilePath & operator=(
00217       const char * cstr 
00218     );
00220 
00228     PFilePath & operator+=(
00229       const PString & str   
00230     );
00231 
00241     PFilePath & operator+=(
00242       const char * cstr  
00243     );
00244 
00254     PFilePath & operator+=(
00255       char ch   // Character to concatenate.
00256     );
00258 
00269     PFilePathString GetVolume() const;
00270       
00279     PFilePathString GetPath() const;
00280 
00287     PFilePathString GetTitle() const;
00288 
00300     PFilePathString GetType() const;
00301 
00311     PFilePathString GetFileName() const;
00312 
00325     PDirectory GetDirectory() const;
00326 
00330     void SetType(
00331       const PFilePathString & type  
00332     );
00334 
00342     static BOOL IsValid(
00343       char c    
00344     );
00345 
00351     static BOOL IsValid(
00352       const PString & str   
00353     );
00355 
00356 
00357   protected:
00358     virtual void AssignContents(const PContainer & cont);
00359 
00360 
00361 // Include platform dependent part of class
00362 #ifdef _WIN32
00363 #include "msos/ptlib/filepath.h"
00364 #else
00365 #include "unix/ptlib/filepath.h"
00366 #endif
00367 };
00368 
00369 #endif
00370 
00371 // End Of File ///////////////////////////////////////////////////////////////

Generated on Sat Dec 22 16:46:50 2007 for PWLib by  doxygen 1.4.2