/usr/include/ptlib/filepath.h is in libpt-dev 2.10.11~dfsg-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | /*
* filepath.h
*
* File system path string abstraction class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 24177 $
* $Author: rjongbloed $
* $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
*/
#ifndef PTLIB_FILEPATH_H
#define PTLIB_FILEPATH_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#ifdef DOC_PLUS_PLUS
/** Base string type for a file path.
For platforms where filenames are case significant (eg Unix) this class
is a synonym for <code>PString</code>. If it is for a platform where case is not
significant (eg Win32, Mac) then this is a synonym for <code>PCaselessString</code>.
*/
class PFilePathString : public PString { };
#endif
///////////////////////////////////////////////////////////////////////////////
// File Specification
/**This class describes a full description for a file on the particular
platform. This will always uniquely identify the file on currently mounted
volumes.
An empty string for a PFilePath indicates an illegal path.
The ancestor class is dependent on the platform. For file systems that are
case sensitive, eg Unix, the ancestor is <code>PString</code>. For other
platforms, the ancestor class is <code>PCaselessString</code>.
*/
class PFilePath : public PFilePathString
{
PCLASSINFO(PFilePath, PFilePathString);
public:
/**@name Construction */
//@{
/**Create a file specification object.
*/
PFilePath();
/**Create a file specification object with the specified file name.
The string passed in may be a full or partial specification for a file
as determined by the platform. It is unusual for this to be a literal
string, unless only the file title is specified, as that would be
platform specific.
The partial file specification is translated into a canonical form
which always absolutely references the file.
*/
PFilePath(
const char * cstr ///< Partial C string for file name.
);
/**Create a file specification object with the specified file name.
The string passed in may be a full or partial specification for a file
as determined by the platform. It is unusual for this to be a literal
string, unless only the file title is specified, as that would be
platform specific.
The partial file specification is translated into a canonical form
which always absolutely references the file.
*/
PFilePath(
const PString & str ///< Partial PString for file name.
);
/**Create a file specification object with the specified file name.
*/
PFilePath(
const PFilePath & path ///< Previous path for file name.
);
/**Create a file spec object with a generated temporary name. The first
parameter is a prefix for the filename to which a unique number is
appended. The second parameter is the directory in which the file is to
be placed. If this is NULL a system standard directory is used.
*/
PFilePath(
const char * prefix, ///< Prefix string for file title.
const char * dir ///< Directory in which to place the file.
);
/**Change the file specification object to the specified file name.
*/
PFilePath & operator=(
const PFilePath & path ///< Previous path for file name.
);
/**Change the file specification object to the specified file name.
The string passed in may be a full or partial specifiaction for a file
as determined by the platform. It is unusual for this to be a literal
string, unless only the file title is specified, as that would be
platform specific.
The partial file specification is translated into a canonical form
which always absolutely references the file.
*/
PFilePath & operator=(
const PString & str ///< Partial PString for file name.
);
/**Change the file specification object to the specified file name.
The string passed in may be a full or partial specifiaction for a file
as determined by the platform. It is unusual for this to be a literal
string, unless only the file title is specified, as that would be
platform specific.
The partial file specification is translated into a canonical form
which always absolutely references the file.
*/
PFilePath & operator=(
const char * cstr ///< Partial "C" string for file name.
);
//@}
/**@name Path addition functions */
//@{
/**Concatenate a string to the file path, modifiying that path.
@return
reference to string that was concatenated to.
*/
PFilePath & operator+=(
const PString & str ///< String to concatenate.
);
/**Concatenate a C string to a path, modifiying that path. The
<code>cstr</code> parameter is typically a literal string, eg:
<pre><code>
myStr += "fred";
</code></pre>
@return
reference to string that was concatenated to.
*/
PFilePath & operator+=(
const char * cstr ///< C string to concatenate.
);
/**Concatenate a single character to a path. The <code>ch</code>
parameter is typically a literal, eg:
<pre><code>
myStr += '!';
</code></pre>
@return
new string with concatenation of the object and parameter.
*/
PFilePath & operator+=(
char ch // Character to concatenate.
);
//@}
/**@name Path decoding access functions */
//@{
/**Get the drive/volume name component of the full file specification. This
is very platform specific. For example in DOS & NT it is the drive
letter followed by a colon ("C:"), for Macintosh it is the volume name
("Untitled") and for Unix it is empty ("").
@return
string for the volume name part of the file specification..
*/
PFilePathString GetVolume() const;
/**Get the directory path component of the full file specification. This
will include leading and trailing directory separators. For example
on DOS this could be "\SRC\PWLIB\", for Macintosh ":Source:PwLib:" and
for Unix "/users/equivalence/src/pwlib/".
@return
string for the path part of the file specification.
*/
PFilePathString GetPath() const;
/**Get the title component of the full file specification, eg for the DOS
file "C:\SRC\PWLIB\FRED.DAT" this would be "FRED".
@return
string for the title part of the file specification.
*/
PFilePathString GetTitle() const;
/**Get the file type of the file. Note that on some platforms this may
actually be part of the full name string. eg for DOS file
"C:\SRC\PWLIB\FRED.TXT" this would be ".TXT" but on the Macintosh this
might be "TEXT".
Note there are standard translations from file extensions, eg ".TXT"
and some Macintosh file types, eg "TEXT".
@return
string for the type part of the file specification.
*/
PFilePathString GetType() const;
/**Get the actual directory entry name component of the full file
specification. This may be identical to
<code>GetTitle() + GetType()</code> or simply <code>GetTitle()</code>
depending on the platform. eg for DOS file "C:\SRC\PWLIB\FRED.TXT" this
would be "FRED.TXT".
@return
string for the file name part of the file specification.
*/
PFilePathString GetFileName() const;
/**Get the the directory that the file is contained in. This may be
identical to <code>GetVolume() + GetPath()</code> depending on the
platform. eg for DOS file "C:\SRC\PWLIB\FRED.TXT" this would be
"C:\SRC\PWLIB\".
Note that for Unix platforms, this returns the {\b physical} path
of the directory. That is all symlinks are resolved. Thus the directory
returned may not be the same as the value of <code>GetPath()</code>.
@return
Directory that the file is contained in.
*/
PDirectory GetDirectory() const;
/**Set the type component of the full file specification, eg for the DOS
file "C:\SRC\PWLIB\FRED.DAT" would become "C:\SRC\PWLIB\FRED.TXT".
*/
void SetType(
const PFilePathString & type ///< New type of the file.
);
//@}
/**@name Miscellaneous functions */
//@{
/**Test if the character is valid in a filename.
@return
true if the character is valid for a filename.
*/
static PBoolean IsValid(
char c ///< Character to test for validity.
);
/**Test if all the characters are valid in a filename.
@return
true if the character is valid for a filename.
*/
static PBoolean IsValid(
const PString & str ///< String to test for validity.
);
/**Test if path is an absolute path or relative path.
*/
static bool IsAbsolutePath(
const PString & path ///< path name
);
//@}
protected:
virtual void AssignContents(const PContainer & cont);
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/filepath.h"
#else
#include "unix/ptlib/filepath.h"
#endif
};
#endif // PTLIB_FILEPATH_H
// End Of File ///////////////////////////////////////////////////////////////
|