📄 pdirect.h
字号:
/* * pdirect.h * * File system directory 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): ______________________________________. * * $Log: pdirect.h,v $ * Revision 1.32 2000/06/26 11:17:19 robertj * Nucleus++ port (incomplete). * * Revision 1.31 2000/04/03 18:41:27 robertj * Fixed BeOS compatibility problem with openlog() function. * * Revision 1.30 1999/03/09 02:59:50 robertj * Changed comments to doc++ compatible documentation. * * Revision 1.29 1999/02/16 08:11:09 robertj * MSVC 6.0 compatibility changes. * * Revision 1.28 1998/09/23 06:21:06 robertj * Added open source copyright license. * * Revision 1.27 1998/03/05 12:44:34 robertj * Added cluster size. * * Revision 1.26 1997/03/31 11:34:00 robertj * Fixed default permissions for directories , different from that for files. * * Revision 1.25 1997/01/12 04:22:21 robertj * Added function to get disk size and free space. * * Revision 1.24 1995/12/23 03:45:31 robertj * Added constructor for C string literals. * * Revision 1.23 1995/11/09 12:17:23 robertj * Added platform independent base type access classes. * * Revision 1.22 1995/10/14 15:02:22 robertj * Added function to get parent directory. * * Revision 1.21 1995/06/17 11:12:52 robertj * Documentation update. * * Revision 1.20 1995/03/14 12:42:00 robertj * Updated documentation to use HTML codes. * * Revision 1.19 1995/03/12 04:42:48 robertj * Updated documentation. * Changed return type of functions to the correct case string. * * Revision 1.18 1995/02/22 10:50:33 robertj * Changes required for compiling release (optimised) version. * * Revision 1.17 1995/01/06 10:42:25 robertj * Moved identifiers into different scope. * Changed file size to 64 bit integer. * Documentation * * Revision 1.16 1994/10/24 00:07:03 robertj * Changed PFilePath and PDirectory so descends from either PString or * PCaselessString depending on the platform. * * Revision 1.15 1994/10/23 04:49:25 robertj * Chnaged PDirectory to descend of PString. * Added PDirectory Exists() function. * * Revision 1.14 1994/08/23 11:32:52 robertj * Oops * * Revision 1.13 1994/08/22 00:46:48 robertj * Added pragma fro GNU C++ compiler. * * Revision 1.12 1994/06/25 11:55:15 robertj * Unix version synchronisation. * * Revision 1.11 1994/04/20 12:17:44 robertj * Split name into PFilePath * * Revision 1.10 1994/04/11 14:16:27 robertj * Added function for determining if character is a valid directory separator. * * Revision 1.9 1994/04/01 14:14:57 robertj * Put platform independent file permissions and type codes back. * * Revision 1.7 1994/01/13 03:17:55 robertj * Added functions to get the name of the volume the directory is contained in * and a function to determine if the directory is a root directory of the * volume (ie is does not have a parent directory). * * Revision 1.6 1994/01/03 04:42:23 robertj * Mass changes to common container classes and interactors etc etc etc. * * Revision 1.5 1993/12/31 06:45:38 robertj * Made inlines optional for debugging purposes. * * Revision 1.4 1993/08/21 01:50:33 robertj * Made Clone() function optional, default will assert if called. * * Revision 1.3 1993/07/14 12:49:16 robertj * Fixed RCS keywords. * */#define _PDIRECTORY#ifdef __GNUC__#pragma interface#endif#ifdef Fifo#undef Fifo#endif///////////////////////////////////////////////////////////////////////////////// File System/**Class containing the system information on a file path. Information can be obtained on any directory entry event if it is not a "file" in the strictest sense. Sub-directories, devices etc may also have information retrieved. */class PFileInfo : public PObject{ PCLASSINFO(PFileInfo, PObject); public: /**All types that a particular file path may be. Not all platforms support all of the file types. For example under DOS no file may be of the type #SymbolicLink#. */ enum FileTypes { /// Ordinary disk file. RegularFile = 1, /// File path is a symbolic link. SymbolicLink = 2, /// File path is a sub-directory SubDirectory = 4, /// File path is a character device name. CharDevice = 8, /// File path is a block device name. BlockDevice = 16, /// File path is a fifo (pipe) device. Fifo = 32, /// File path is a socket device. SocketDevice = 64, /// File path is of an unknown type. UnknownFileType = 256, /// Mask for all file types. AllFiles = 0x1ff }; /// File type for this file. Only one bit is set at a time here. FileTypes type; /**Time of file creation of the file. Not all platforms support a separate creation time in which case the last modified time is returned. */ PTime created; /// Time of last modifiaction of the file. PTime modified; /**Time of last access to the file. Not all platforms support a separate access time in which case the last modified time is returned. */ PTime accessed; /**Size of the file in bytes. This is a quadword or 8 byte value to allow for files greater than 4 gigabytes. */ PUInt64 size; /// File access permissions for the file. enum Permissions { /// File has world execute permission WorldExecute = 1, /// File has world write permission WorldWrite = 2, /// File has world read permission WorldRead = 4, /// File has group execute permission GroupExecute = 8, /// File has group write permission GroupWrite = 16, /// File has group read permission GroupRead = 32, /// File has owner execute permission UserExecute = 64, /// File has owner write permission UserWrite = 128, /// File has owner read permission UserRead = 256, /// All possible permissions. AllPermissions = 0x1ff, /// Owner read & write plus group and world read permissions. DefaultPerms = UserRead|UserWrite|GroupRead|WorldRead, /// Owner read & write & execute plus group and world read & exectute permissions. DefaultDirPerms = DefaultPerms|UserExecute|GroupExecute|WorldExecute }; /**A bit mask of all the file acces permissions. See the #Permissions enum# for the possible bit values. Not all platforms support all permissions. */ int permissions; /**File is a hidden file. What constitutes a hidden file is platform dependent, for example under unix it is a file beginning with a '.' character while under MS-DOS there is a file system attribute for it. */ BOOL hidden;};/**Class to represent a directory in the operating system file system. A directory is a special file that contains a list of file paths. The directory paths are highly platform dependent and a minimum number of assumptions should be made. The PDirectory object is a string consisting of a possible volume name, and a series directory names in the path from the volumes root to the directory that the object represents. Each directory is separated by the platform dependent separator character which is defined by the PDIR_SEPARATOR macro. The path always has a trailing separator. Some platforms allow more than one character to act as a directory separator so when doing any processing the #IsSeparator()# function should be used to determine if a character is a possible separator. The directory may be opened to gain access to the list of files that it contains. Note that the directory does {\bf not} contain the "." and ".." entries that some platforms support. The ancestor class is dependent on the platform. For file systems that are case sensitive, eg Unix, the ancestor is #PString#. For other platforms, the ancestor class is #PCaselessString#. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -