sipxportlib  Version 3.3
OsDirBase.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _OsDirBase_h_
12 #define _OsDirBase_h_
13 
14 // SYSTEM INCLUDES
15 #include "os/OsStatus.h"
16 #include "os/OsDefs.h"
17 #include "os/OsFS.h"
18 
19 // APPLICATION INCLUDES
20 
21 // DEFINES
22 // MACROS
23 // EXTERNAL FUNCTIONS
24 // EXTERNAL VARIABLES
25 // CONSTANTS
26 // STRUCTS
27 // TYPEDEFS
28 // FORWARD DECLARATIONS
29 class OsFileInfoBase;
30 class OsPathBase;
31 //:Abstraction class to hande directory manipulations
32 class OsDirBase
33 {
34 
35 /* //////////////////////////// PUBLIC //////////////////////////////////// */
36 public:
37 
38 /* ============================ CREATORS ================================== */
39 
40 
41  OsDirBase(const char* pathname);
42  OsDirBase(const OsPathBase& rOsPath);
43 
44  OsDirBase(const OsDirBase& rOsDir);
45  //:Copy constructor
46 
47  virtual
48  ~OsDirBase();
49  //:Destructor
50 
51 /* ============================ MANIPULATORS ============================== */
52 
53  virtual OsStatus create() const;
54  //: Create the path specified by this object
55  // Returns OS_SUCCESS if successful, or OS_INVALID
56 
57  virtual OsStatus remove(UtlBoolean bRecursive, UtlBoolean bForce) const;
58  //: Removes the directory name specified by this object
59  //: Set bForce to TRUE to remove read-only directory
60  //: Set bRecursive to TRUE remove sub-directories
61  // Returns:
62  // OS_SUCCESS if successful
63  // OS_FILE_ACCESS_DENIED if directory is in use or contains files
64  // OS_FILE_PATH_NOT_FOUND if specifed directory is not found
65 
66  virtual OsStatus rename(const char* name);
67  //: Renames the current directory to the name specified
68  // Returns:
69  // OS_SUCCESS if successful
70  // OS_INVALID if failed
71 
72 /* ============================ ACCESSORS ================================= */
73 
74  virtual OsStatus getFileInfo(OsFileInfoBase& rFileInfo) const = 0;
75  //: Returns the file information for this objects path (see
76  //: OsFileInfo for more detail)
77  // Returns:
78  // OS_SUCCESS if successful
79  // OS_INVALID if failed
80 
81  virtual void getPath(OsPathBase& rOsPath) const;
82  //: Returns a reference to the full path stored in this object
83 
84 /* ============================ INQUIRY =================================== */
85 
86  virtual UtlBoolean exists();
87  //: Returns TRUE if the directory specified by this object exists
88 
89 /* //////////////////////////// PROTECTED ///////////////////////////////// */
90 protected:
91  OsDirBase& operator=(const OsDirBase& rhs);
92  //:Assignment operator
93 
95  //:Directory name
96 
97 /* //////////////////////////// PRIVATE /////////////////////////////////// */
98 private:
99 
100 };
101 
102 /* ============================ INLINE METHODS ============================ */
103 
104 #endif // _OsDirBase_h_
105 
106 
virtual OsStatus getFileInfo(OsFileInfoBase &rFileInfo) const =0
OsDirBase(const char *pathname)
Definition: OsDirBase.cpp:59
OsStatus
Definition: OsStatus.h:27
virtual ~OsDirBase()
Definition: OsDirBase.cpp:76
virtual OsStatus create() const
Definition: OsDirBase.cpp:91
Definition: OsFileInfoBase.h:34
virtual void getPath(OsPathBase &rOsPath) const
Definition: OsDirBase.cpp:110
OsPathBase mDirName
Definition: OsDirBase.h:94
int UtlBoolean
Definition: UtlDefs.h:41
virtual UtlBoolean exists()
Definition: OsDirBase.cpp:117
virtual OsStatus rename(const char *name)
Definition: OsDirBase.cpp:101
Definition: OsDirBase.h:32
OsDirBase & operator=(const OsDirBase &rhs)
Definition: OsDirBase.cpp:83
Definition: OsPathBase.h:34