PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
filepath.h
Go to the documentation of this file.
1 /*
2  * filepath.h
3  *
4  * File system path string abstraction class.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 24177 $
30  * $Author: rjongbloed $
31  * $Date: 2010-04-05 21:52:04 +1000 (Mon, 05 Apr 2010) $
32  */
33 
34 #ifndef PTLIB_FILEPATH_H
35 #define PTLIB_FILEPATH_H
36 
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40 
41 
42 #ifdef DOC_PLUS_PLUS
43 
48 class PFilePathString : public PString { };
49 #endif
50 
51 
53 // File Specification
54 
65 class PFilePath : public PFilePathString
66 {
67  PCLASSINFO(PFilePath, PFilePathString);
68 
69  public:
74  PFilePath();
75 
86  PFilePath(
87  const char * cstr
88  );
89 
100  PFilePath(
101  const PString & str
102  );
103 
106  PFilePath(
107  const PFilePath & path
108  );
109 
115  PFilePath(
116  const char * prefix,
117  const char * dir
118  );
119 
123  const PFilePath & path
124  );
136  const PString & str
137  );
149  const char * cstr
150  );
152 
161  const PString & str
162  );
163 
174  const char * cstr
175  );
176 
187  char ch // Character to concatenate.
188  );
190 
201  PFilePathString GetVolume() const;
202 
211  PFilePathString GetPath() const;
212 
219  PFilePathString GetTitle() const;
220 
232  PFilePathString GetType() const;
233 
244 
257  PDirectory GetDirectory() const;
258 
262  void SetType(
263  const PFilePathString & type
264  );
266 
274  static PBoolean IsValid(
275  char c
276  );
277 
283  static PBoolean IsValid(
284  const PString & str
285  );
286 
289  static bool IsAbsolutePath(
290  const PString & path
291  );
293 
294 
295  protected:
296  virtual void AssignContents(const PContainer & cont);
297 
298 
299 // Include platform dependent part of class
300 #ifdef _WIN32
301 #include "msos/ptlib/filepath.h"
302 #else
303 #include "unix/ptlib/filepath.h"
304 #endif
305 };
306 
307 
308 #endif // PTLIB_FILEPATH_H
309 
310 
311 // End Of File ///////////////////////////////////////////////////////////////