diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-02-03 12:13:08 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-02-03 12:13:08 +0000 |
commit | a189474f7fc0a2ecffc9292179ad5dc60d130391 (patch) | |
tree | 9ea66bcf0b5f717937ae31fabd798a1e6bef4bb6 /sal/inc/osl | |
parent | 3c313516bde2d2587b4738545a88477f34748c80 (diff) |
INTEGRATION: CWS sal05 (1.30.64); FILE MERGED
2004/01/26 18:56:40 tra 1.30.64.9: #104528#update after code inspection of createPath
2004/01/26 15:13:13 tra 1.30.64.8: #104528#update after osl_createDirectoryPath code inspection
2004/01/26 14:19:13 tra 1.30.64.7: #104528#updates after code inspection
2004/01/08 10:10:59 tra 1.30.64.6: small update of createPath documentation
2004/01/05 11:13:17 tra 1.30.64.5: RESYNC: (1.30-1.31); FILE MERGED
2003/12/18 08:54:54 tra 1.30.64.4: #104528#onDirectoryCreated is now a standalone function which calls only a public function of the DirectoryCreateObserver class so there is no need for friendship
2003/11/24 18:53:26 tra 1.30.64.3: #104528#removed friendship of onDirectoryCreated
2003/11/24 09:36:45 tra 1.30.64.2: #104528#onDirectoryCreated now inline function with C linkage, this function is friend of class osl::Directory
2003/11/21 16:01:10 tra 1.30.64.1: #104528#Directory::createDirectoryPath and DirectoryCreationObserver introduced
Diffstat (limited to 'sal/inc/osl')
-rw-r--r-- | sal/inc/osl/file.hxx | 105 |
1 files changed, 101 insertions, 4 deletions
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx index d42086710a30..c053a6247bdf 100644 --- a/sal/inc/osl/file.hxx +++ b/sal/inc/osl/file.hxx @@ -2,9 +2,9 @@ * * $RCSfile: file.hxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: vg $ $Date: 2003-12-17 17:07:51 $ + * last change: $Author: hr $ $Date: 2004-02-03 13:13:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1595,7 +1595,42 @@ public: friend class Directory; }; -// ----------------------------------------------------------------------------- +//########################################### + +/** Base class for observers of directory creation notifications. + + Clients which uses the method createDirectoryPath of the class + Directory may want to be informed about the directories that + have been created. This may be accomplished by deriving from + this base class and overwriting the virtual function + DirectoryCreated. + + @see Directory::createPath +*/ +class DirectoryCreationObserver +{ +public: + virtual ~DirectoryCreationObserver() {}; + + /** This method will be called when a new directory has been + created and needs to be overwritten by derived classes. + You must not delete the directory that was just created + otherwise you will run into an endless loop. + + @param aDirectoryUrl + [in]The absolute file URL of the directory that was just created by + ::osl::Directory::createPath. + */ + virtual void DirectoryCreated(const rtl::OUString& aDirectoryUrl) = 0; +}; + +//########################################### +// This just an internal helper function for +// private use. +extern "C" inline void SAL_CALL onDirectoryCreated(void* pData, rtl_uString* aDirectoryUrl) +{ + (static_cast<DirectoryCreationObserver*>(pData))->DirectoryCreated(aDirectoryUrl); +} /** The directory class object provides a enumeration of DirectoryItems. @@ -1853,9 +1888,71 @@ public: { return (RC) osl_removeDirectory( ustrDirectoryURL.pData ); } + + /** Create a directory path. + + The osl_createDirectoryPath function creates a specified directory path. + All nonexisting sub directories will be created. + <p><strong>PLEASE NOTE:</strong> You cannot rely on getting the error code + E_EXIST for existing directories. Programming against this error code is + in general a strong indication of a wrong usage of osl_createDirectoryPath.</p> + + @param aDirectoryUrl + [in] The absolute file URL of the directory path to create. + A relative file URL will not be accepted. + + @param aDirectoryCreationObserver + [in] Pointer to an instance of type DirectoryCreationObserver that will + be informed about the creation of a directory. The value of this + parameter may be NULL, in this case notifications will not be sent. + + @return + <dl> + <dt>E_None</dt> + <dd>On success</dd> + <dt>E_INVAL</dt> + <dd>The format of the parameters was not valid</dd> + <dt>E_ACCES</dt> + <dd>Permission denied</dd> + <dt>E_EXIST</dt> + <dd>The final node of the specified directory path already exist</dd> + <dt>E_NAMETOOLONG</dt> + <dd>The name of the specified directory path exceeds the maximum allowed length</dd> + <dt>E_NOTDIR</dt> + <dd>A component of the specified directory path already exist as file in any part of the directory path</dd> + <dt>E_ROFS</dt> + <dd>Read-only file system</dd> + <dt>E_NOSPC</dt> + <dd>No space left on device</dd> + <dt>E_DQUOT</dt> + <dd>Quota exceeded</dd> + <dt>E_FAULT</dt> + <dd>Bad address</dd> + <dt>E_IO</dt> + <dd>I/O error</dd> + <dt>E_LOOP</dt> + <dd>Too many symbolic links encountered</dd> + <dt>E_NOLINK</dt> + <dd>Link has been severed</dd> + <dt>E_invalidError</dt> + <dd>An unknown error occurred</dd> + </dl> + + @see DirectoryCreationObserver + @see create + */ + static RC createPath( + const ::rtl::OUString& aDirectoryUrl, + DirectoryCreationObserver* aDirectoryCreationObserver = NULL) + { + return (RC)osl_createDirectoryPath( + aDirectoryUrl.pData, + (aDirectoryCreationObserver) ? onDirectoryCreated : NULL, + aDirectoryCreationObserver); + } }; -} +} /* namespace osl */ #endif /* __cplusplus */ #endif /* _OSL_FILE_HXX_ */ |