# 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  * $Revision: 24177 $
    00030  * $Author: rjongbloed $
    00031  * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
    00032  */
    00033
    00034 #ifndef PTLIB_FILEPATH_H
    00035 #define PTLIB_FILEPATH_H
    00036
    00037 #ifdef P_USE_PRAGMA
    00038 #pragma interface
    00039 #endif
    00040
    00041
    00042 #ifdef DOC_PLUS_PLUS
    00043
    00048 class PFilePathString : public PString { };
    00049 #endif
    00050
    00051
    00053 // File Specification
    00054
    00065 class PFilePath : public PFilePathString
    00066 {
    00067   PCLASSINFO(PFilePath, PFilePathString);
    00068
    00069   public:
    00074     PFilePath();
    00075
    00086     PFilePath(
    00087       const char * cstr
    00088     );
    00089
    00100     PFilePath(
    00101       const PString & str
    00102     );
    00103
    00106     PFilePath(
    00107       const PFilePath & path
    00108     );
    00109
    00115     PFilePath(
    00116       const char * prefix,
    00117       const char * dir
    00118     );
    00119
    00122     PFilePath & operator=(
    00123       const PFilePath & path
    00124     );
    00135     PFilePath & operator=(
    00136       const PString & str
    00137     );
    00148     PFilePath & operator=(
    00149       const char * cstr
    00150     );
    00152
    00160     PFilePath & operator+=(
    00161       const PString & str
    00162     );
    00163
    00173     PFilePath & operator+=(
    00174       const char * cstr
    00175     );
    00176
    00186     PFilePath & operator+=(
    00187       char ch   // Character to concatenate.
    00188     );
    00190
    00201     PFilePathString GetVolume() const;
    00202
    00211     PFilePathString GetPath() const;
    00212
    00219     PFilePathString GetTitle() const;
    00220
    00232     PFilePathString GetType() const;
    00233
    00243     PFilePathString GetFileName() const;
    00244
    00257     PDirectory GetDirectory() const;
    00258
    00262     void SetType(
    00263       const PFilePathString & type
    00264     );
    00266
    00274     static PBoolean IsValid(
    00275       char c
    00276     );
    00277
    00283     static PBoolean IsValid(
    00284       const PString & str
    00285     );
    00286
    00289     static bool IsAbsolutePath(
    00290       const PString & path
    00291     );
    00293
    00294
    00295   protected:
    00296     virtual void AssignContents(const PContainer & cont);
    00297
    00298
    00299 // Include platform dependent part of class
    00300 #ifdef _WIN32
    00301 #include "msos/ptlib/filepath.h"
    00302 #else
    00303 #include "unix/ptlib/filepath.h"
    00304 #endif
    00305 };
    00306
    00307
    00308 #endif // PTLIB_FILEPATH_H
    00309
    00310
    00311 // End Of File ///////////////////////////////////////////////////////////////