C/C++ User's Journal STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - where the Standard Template Library meets the Active Template Library COMSTL - where the Standard Template Library meets the Component Object Model
Synesis Software InetSTL - where the Standard Template Library meets the Internet UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

recls/cpp/fileentry.hpp

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////////
00002  * File:        recls/cpp/fileentry.hpp
00003  *
00004  * Purpose:     recls C++ mapping - FileEntry class.
00005  *
00006  * Created:     18th August 2003
00007  * Updated:     15th August 2006
00008  *
00009  * Home:        http://recls.org/
00010  *
00011  * Copyright (c) 2003-2006, Matthew Wilson and Synesis Software
00012  * All rights reserved.
00013  *
00014  * Redistribution and use in source and binary forms, with or without 
00015  * modification, are permitted provided that the following conditions are met:
00016  *
00017  * - Redistributions of source code must retain the above copyright notice, this
00018  *   list of conditions and the following disclaimer. 
00019  * - Redistributions in binary form must reproduce the above copyright notice,
00020  *   this list of conditions and the following disclaimer in the documentation
00021  *   and/or other materials provided with the distribution.
00022  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
00023  *   any contributors may be used to endorse or promote products derived from
00024  *   this software without specific prior written permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00027  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00029  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00030  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00031  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00032  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00033  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00034  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00035  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00036  * POSSIBILITY OF SUCH DAMAGE.
00037  *
00038  * ////////////////////////////////////////////////////////////////////////// */
00039 
00040 
00041 #ifndef RECLS_INCL_RECLS_CPP_HPP_FILEENTRY
00042 #define RECLS_INCL_RECLS_CPP_HPP_FILEENTRY
00043 
00044 /* File version */
00045 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00046 # define RECLS_VER_RECLS_CPP_HPP_FILEENTRY_MAJOR    3
00047 # define RECLS_VER_RECLS_CPP_HPP_FILEENTRY_MINOR    3
00048 # define RECLS_VER_RECLS_CPP_HPP_FILEENTRY_REVISION 1
00049 # define RECLS_VER_RECLS_CPP_HPP_FILEENTRY_EDIT     44
00050 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00051 
00052 #ifdef RECLS_DOCUMENTATION_SKIP_SECTION
00053 # define DirectoryParts_class   DirectoryParts
00054 #endif /* RECLS_DOCUMENTATION_SKIP_SECTION */
00055 
00066 /* /////////////////////////////////////////////////////////////////////////////
00067  * Includes
00068  */
00069 
00070 #include <recls/cpp/recls.hpp>
00071 #include <recls/assert.h>
00072 
00073 #include <stlsoft/util/operator_bool.hpp>    // For operator bool() stuff
00074 #if defined(RECLS_PLATFORM_IS_WIN32)
00075 # include <winstl/filesystem/file_path_buffer.hpp>
00076 #elif defined(RECLS_PLATFORM_IS_UNIX)
00077 # include <unixstl/filesystem/file_path_buffer.hpp>
00078 #else
00079 # error Platform not (yet) recognised
00080 #endif /* platform */
00081 
00082 /* /////////////////////////////////////////////////////////////////////////////
00083  * Namespace
00084  */
00085 
00086 #if !defined(RECLS_NO_NAMESPACE)
00087 namespace recls
00088 {
00089 
00090 namespace cpp
00091 {
00092 #endif /* !RECLS_NO_NAMESPACE */
00093 
00094 #if defined(RECLS_PLATFORM_IS_WIN32)
00095 typedef winstl::basic_file_path_buffer<recls_char_t>    file_path_buffer;
00096 #elif defined(RECLS_PLATFORM_IS_UNIX)
00097 typedef unixstl::basic_file_path_buffer<recls_char_t>   file_path_buffer;
00098 #else
00099 # error Platform not (yet) recognised
00100 #endif /* platform */
00101 
00102 /* /////////////////////////////////////////////////////////////////////////////
00103  * Forward declarations
00104  */
00105 
00106 class FileEntry;
00107 class FileSearch;
00108 
00109 /* /////////////////////////////////////////////////////////////////////////////
00110  * Classes
00111  */
00112 
00116 class DirectoryParts_class
00117 {
00118 public:
00119     typedef recls_char_t            char_type;
00120     typedef DirectoryParts_class    class_type;
00121 
00122 // Construction
00123 private:
00124     friend class FileEntry;
00125     DirectoryParts_class(recls_info_t info);
00126 
00129 public:
00131     DirectoryParts_class();
00133     DirectoryParts_class(class_type const &rhs);
00135     ~DirectoryParts_class();
00136 
00138     class_type &operator =(class_type const &rhs);
00139 
00141 
00144 public:
00146     size_t      size() const;
00152     string_t    operator [](size_t index) const;
00153 
00155 
00156 // Implementation
00157 private:
00158     static recls_info_t copy_info_(recls_info_t info);
00159 
00160 // Members
00161 private:
00162     recls_info_t    m_info;
00163 };
00164 
00168 class FileEntry
00169 {
00170 public:
00171     typedef recls_char_t    char_type;
00172     typedef FileEntry       class_type;
00173 
00174 // Construction
00175 private:
00176     friend class Search;
00177     FileEntry(recls_info_t info);
00178 
00181 public:
00183     FileEntry();
00185     FileEntry(FileEntry const &rhs);
00187     ~FileEntry();
00188 
00190     FileEntry &operator =(FileEntry const &rhs);
00192 
00195 private:
00196     STLSOFT_DEFINE_OPERATOR_BOOL_TYPES(class_type, boolean_generator_type, boolean_type);
00197 public:
00199     operator boolean_type() const
00200     {
00201         return boolean_generator_type::translate(NULL != m_info);
00202     }
00203 
00204 #ifndef STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT
00206     bool operator !() const;
00207 #endif /* !STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT */
00208 
00210 
00213 public:
00214 #ifndef RECLS_PURE_API
00216     char_type const     *c_str() const;
00217 
00219     size_t              length() const;
00220 #endif /* !RECLS_PURE_API */
00221 
00223     string_t            GetPath() const;
00225     string_t            GetSearchDirectory() const;
00227     string_t            GetSearchRelativePath() const;
00228 #ifdef RECLS_PLATFORM_API_WIN32
00230     char_type           GetDrive() const;
00231 #endif /* RECLS_PLATFORM_API_WIN32 */
00233     string_t            GetDirectory() const;
00235     string_t            GetDirectoryPath() const;
00237     string_t            GetUNCDrive() const;
00239     DirectoryParts_class      GetDirectoryParts() const;
00241     string_t            GetFile() const;
00245     string_t            GetShortFile() const;
00247     string_t            GetFileName() const;
00249     string_t            GetFileExt() const;
00250 
00254     recls_time_t        GetCreationTime() const;
00256     recls_time_t        GetModificationTime() const;
00258     recls_time_t        GetLastAccessTime() const;
00262     recls_time_t        GetLastStatusChangeTime() const;
00263 
00265     recls_filesize_t    GetSize() const;
00266 
00268     recls_bool_t        IsReadOnly() const;
00270     recls_bool_t        IsDirectory() const;
00272     recls_bool_t        IsLink() const;
00274     recls_bool_t        IsUNC() const;
00275 
00277     recls_bool_t        Exists() const;
00279 
00281 public:
00282 #ifdef RECLS_CPP_METHOD_PROPERTY_SUPPORT
00283     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, Path);
00284     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, SearchDirectory);
00285     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, SearchRelativePath);
00286 #ifdef RECLS_CPP_PLATFORM_API_WIN32
00287     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, Drive);
00288 #endif /* RECLS_CPP_PLATFORM_API_WIN32 */
00289     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, Directory);
00290     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, DirectoryPath);
00291     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, UNCDrive);
00292 #ifndef RECLS_CPP_PURE_API
00293     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, DirectoryParts);
00294 #endif /* !RECLS_CPP_PURE_API */
00295     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, File);
00296     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, ShortFile);
00297     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, FileName);
00298     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, FileExt);
00299     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, CreationTime);
00300     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, ModificationTime);
00301     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, LastAccessTime);
00302     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, LastStatusChangeTime);
00303     RECLS_CPP_OPT_METHOD_PROPERTY_DEFINE_OFFSET(class_type, Size);
00304 union
00305 {
00306     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetPath, Path);
00307     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetSearchDirectory, SearchDirectory);
00308     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetSearchRelativePath, SearchRelativePath);
00309 #ifdef RECLS_CPP_PLATFORM_API_WIN32
00310     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(char_type, class_type, GetDrive, Drive);
00311 #endif /* RECLS_CPP_PLATFORM_API_WIN32 */
00312     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetDirectory, Directory);
00313     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetDirectoryPath, DirectoryPath);
00314     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetUNCDrive, UNCDrive);
00315 #ifndef RECLS_CPP_PURE_API
00316     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(DirectoryParts_class, class_type, GetDirectoryParts, DirectoryParts);
00317 #endif /* !RECLS_CPP_PURE_API */
00318     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetFile, File);
00319     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetShortFile, ShortFile);
00320     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetFileName, FileName);
00321     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(string_t, class_type, GetFileExt, FileExt);
00322     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(recls_time_t, class_type, GetCreationTime, CreationTime);
00323     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(recls_time_t, class_type, GetModificationTime, ModificationTime);
00324     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(recls_time_t, class_type, GetLastAccessTime, LastAccessTime);
00325     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(recls_time_t, class_type, GetLastStatusChangeTime, LastStatusChangeTime);
00326     RECLS_CPP_OPT_METHOD_PROPERTY_GET_PROP(recls_filesize_t, class_type, GetSize, Size);
00327 };
00328 #endif /* RECLS_CPP_METHOD_PROPERTY_SUPPORT */
00330 
00331 // Implementation
00332 private:
00333     static recls_info_t copy_info_(recls_info_t info);
00334 #ifdef RECLS_PURE_API
00335     // Note: this has to be inside the class because GCC is a real dummy n this regard.
00336     static string_t     get_string_(size_t (RECLS_CALLCONV_DEFAULT *pfn)(recls_info_t, recls_char_t *, size_t), recls_info_t info);
00337     {
00338         file_path_buffer    buffer;
00339         size_t              cch =   pfn(info, &buffer[0], buffer.size());
00340 
00341         return string_t(&buffer[0], cch);
00342     }
00343 #endif /* RECLS_PURE_API */
00344 
00345 // Members
00346 private:
00347     recls_info_t    m_info;
00348 };
00349 
00350 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00351 typedef DirectoryParts_class    DirectoryParts;
00352 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00353 
00354 /* /////////////////////////////////////////////////////////////////////////////
00355  * Shims
00356  */
00357 
00358 #ifndef RECLS_PURE_API
00370 inline FileEntry::char_type const *c_str_ptr(FileEntry const &fe)
00371 {
00372     return fe.c_str();
00373 }
00374 
00375 inline FileEntry::char_type const *c_str_data(FileEntry const &fe)
00376 {
00377     return fe.c_str();
00378 }
00379 
00380 inline size_t c_str_len(FileEntry const &fe)
00381 {
00382     return fe.length();
00383 }
00384 
00385 # ifdef RECLS_CHAR_TYPE_IS_CHAR
00386 inline recls_char_t const *c_str_ptr_a(FileEntry const &fe)
00387 {
00388     return c_str_ptr(fe);
00389 }
00390 
00391 inline recls_char_t const *c_str_data_a(FileEntry const &fe)
00392 {
00393     return c_str_data(fe);
00394 }
00395 
00396 inline size_t c_str_len_a(FileEntry const &fe)
00397 {
00398     return c_str_len(fe);
00399 }
00400 # endif /* RECLS_CHAR_TYPE_IS_CHAR */
00401 
00402 # ifdef RECLS_CHAR_TYPE_IS_WCHAR
00403 inline recls_char_t const *c_str_ptr_w(FileEntry const &fe)
00404 {
00405     return c_str_ptr(fe);
00406 }
00407 
00408 inline recls_char_t const *c_str_data_w(FileEntry const &fe)
00409 {
00410     return c_str_data(fe);
00411 }
00412 
00413 inline size_t c_str_len_w(FileEntry const &fe)
00414 {
00415     return c_str_len(fe);
00416 }
00417 # endif /* RECLS_CHAR_TYPE_IS_WCHAR */
00418 
00419 #endif /* !RECLS_PURE_API */
00420 
00421 /* /////////////////////////////////////////////////////////////////////////////
00422  * Implementation
00423  */
00424 
00425 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00426 
00427 inline /* static */ recls_info_t DirectoryParts_class::copy_info_(recls_info_t info)
00428 {
00429     recls_info_t    newInfo;
00430 
00431     if( NULL == info ||
00432         RECLS_FAILED(Recls_CopyDetails(info, &newInfo)))
00433     {
00434         newInfo = NULL;
00435     }
00436 
00437     return newInfo;
00438 }
00439 
00440 inline DirectoryParts_class::DirectoryParts_class(recls_info_t info)
00441     : m_info(copy_info_(info))
00442 {}
00443 
00444 inline DirectoryParts_class::DirectoryParts_class()
00445     : m_info(NULL)
00446 {}
00447 
00448 inline DirectoryParts_class::DirectoryParts_class(DirectoryParts_class const &rhs)
00449     : m_info(copy_info_(rhs.m_info))
00450 {}
00451 
00452 inline DirectoryParts_class::~DirectoryParts_class()
00453 {
00454     Recls_CloseDetails(m_info);
00455 }
00456 
00457 inline DirectoryParts_class &DirectoryParts_class::operator =(DirectoryParts_class const &rhs)
00458 {
00459     Recls_CloseDetails(m_info);
00460 
00461     m_info = copy_info_(rhs.m_info);
00462 
00463     return *this;
00464 }
00465 
00466 inline size_t DirectoryParts_class::size() const
00467 {
00468     return Recls_GetDirectoryPartProperty(m_info, -1, NULL, 0);
00469 }
00470 
00471 inline string_t DirectoryParts_class::operator [](size_t index) const
00472 {
00473     file_path_buffer    dirPart;
00474 
00475     RECLS_ASSERT(NULL != m_info);
00476     RECLS_ASSERT(index < size());
00477 
00478     return Recls_GetDirectoryPartProperty(m_info, static_cast<int>(index), &dirPart[0], dirPart.size()) ? string_t(dirPart.c_str()) : string_t();
00479 }
00480 
00481 inline /* static */ recls_info_t FileEntry::copy_info_(recls_info_t info)
00482 {
00483     recls_info_t    newInfo;
00484 
00485     if( NULL == info ||
00486         RECLS_FAILED(Recls_CopyDetails(info, &newInfo)))
00487     {
00488         newInfo = NULL;
00489     }
00490 
00491     return newInfo;
00492 }
00493 
00494 inline FileEntry::FileEntry(recls_info_t info)
00495     : m_info(info)
00496 {}
00497 
00498 inline FileEntry::FileEntry()
00499     : m_info(NULL)
00500 {}
00501 
00502 inline FileEntry::FileEntry(FileEntry const &rhs)
00503     : m_info(copy_info_(rhs.m_info))
00504 {}
00505 
00506 inline FileEntry::~FileEntry()
00507 {
00508     if(NULL != m_info)
00509     {
00510         Recls_CloseDetails(m_info);
00511     }
00512 }
00513 
00514 inline FileEntry &FileEntry::operator =(FileEntry const &rhs)
00515 {
00516     if(NULL != m_info)
00517     {
00518         Recls_CloseDetails(m_info);
00519     }
00520 
00521     m_info = copy_info_(rhs.m_info);
00522 
00523     return *this;
00524 }
00525 
00526 #ifndef STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT
00527 inline bool FileEntry::operator !() const
00528 {
00529     return (*this) ? false : true;
00530 }
00531 #endif /* !STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT */
00532 
00533 
00534 #ifndef RECLS_PURE_API
00535 inline FileEntry::char_type const *FileEntry::c_str() const
00536 {
00537     static const char_type  s_empty[1] = { '\0' };
00538 
00539     return (NULL != m_info) ? m_info->path.begin : s_empty;
00540 }
00541 
00542 inline size_t FileEntry::length() const
00543 {
00544     return (NULL != m_info) ? static_cast<size_t>(m_info->path.end - m_info->path.begin) : 0;
00545 }
00546 #endif /* !RECLS_PURE_API */
00547 
00548 inline string_t FileEntry::GetPath() const
00549 {
00550     RECLS_ASSERT(NULL != m_info);
00551 
00552 #ifdef RECLS_PURE_API
00553     return get_string_(Recls_GetPathProperty, m_info);
00554 #else /* ? RECLS_PURE_API */
00555     return string_t(m_info->path.begin, m_info->path.end);
00556 #endif /* RECLS_PURE_API */
00557 }
00558 
00559 inline string_t FileEntry::GetSearchDirectory() const
00560 {
00561     RECLS_ASSERT(NULL != m_info);
00562 
00563 #ifdef RECLS_PURE_API
00564     return get_string_(Recls_GetSearchDirectoryProperty, m_info);
00565 #else /* ? RECLS_PURE_API */
00566     return string_t(m_info->searchDirectory.begin, m_info->searchDirectory.end);
00567 #endif /* RECLS_PURE_API */
00568 }
00569 
00570 inline string_t FileEntry::GetSearchRelativePath() const
00571 {
00572     RECLS_ASSERT(NULL != m_info);
00573 
00574 #ifdef RECLS_PURE_API
00575     return get_string_(Recls_GetSearchRelativePathProperty, m_info);
00576 #else /* ? RECLS_PURE_API */
00577     return string_t(m_info->searchRelativePath.begin, m_info->searchRelativePath.end);
00578 #endif /* RECLS_PURE_API */
00579 }
00580 
00581 #ifdef RECLS_PLATFORM_API_WIN32
00582 inline FileEntry::char_type FileEntry::GetDrive() const
00583 {
00584     char_type chDrive;
00585 
00586     return (Recls_GetDriveProperty(m_info, &chDrive), chDrive);
00587 }
00588 #endif /* RECLS_PLATFORM_API_WIN32 */
00589 
00590 inline string_t FileEntry::GetDirectory() const
00591 {
00592     RECLS_ASSERT(NULL != m_info);
00593 
00594 #ifdef RECLS_PURE_API
00595     return get_string_(Recls_GetDirectoryProperty, m_info);
00596 #else /* ? RECLS_PURE_API */
00597     return string_t(m_info->directory.begin, m_info->directory.end);
00598 #endif /* RECLS_PURE_API */
00599 }
00600 
00601 inline string_t FileEntry::GetDirectoryPath() const
00602 {
00603     RECLS_ASSERT(NULL != m_info);
00604 
00605 #ifdef RECLS_PURE_API
00606     return get_string_(Recls_GetDirectoryPathProperty, m_info);
00607 #else /* ? RECLS_PURE_API */
00608     return string_t(m_info->path.begin, m_info->directory.end);
00609 #endif /* RECLS_PURE_API */
00610 }
00611 
00612 inline string_t FileEntry::GetUNCDrive() const
00613 {
00614     RECLS_ASSERT(NULL != m_info);
00615 
00616 #if 0
00617     if(!IsUNC())
00618     {
00619         return string_t();
00620     }
00621     else
00622     {
00623 #ifdef RECLS_PURE_API
00624         string_t    directoryPath   =   GetDirectoryPath();
00625         size_t      directoryLen    =   Recls_GetDirectoryProperty(m_info, NULL, 0);
00626 
00627         return string_t(directoryPath, 0, directoryPath.length() - directoryLen);
00628 #else /* ? RECLS_PURE_API */
00629         return string_t(m_info->path.begin, m_info->directory.begin);
00630 #endif /* RECLS_PURE_API */
00631     }
00632 #else /* ? 0 */
00633 # ifdef RECLS_PURE_API
00634     return get_string_(Recls_GetUNCDriveProperty, m_info);
00635 # else /* ? RECLS_PURE_API */
00636     return string_t(m_info->path.begin, m_info->directory.begin);
00637 # endif /* RECLS_PURE_API */
00638 #endif /* 0 */
00639 }
00640 
00641 inline recls::cpp::DirectoryParts_class FileEntry::GetDirectoryParts() const
00642 {
00643     RECLS_ASSERT(NULL != m_info);
00644 
00645     return recls::cpp::DirectoryParts_class(m_info);
00646 }
00647 
00648 inline string_t FileEntry::GetFile() const
00649 {
00650     RECLS_ASSERT(NULL != m_info);
00651 
00652 #ifdef RECLS_PURE_API
00653     return get_string_(Recls_GetFileProperty, m_info);
00654 #else /* ? RECLS_PURE_API */
00655     RECLS_ASSERT(m_info->fileName.begin <= m_info->fileExt.end);
00656     return string_t(m_info->fileName.begin, m_info->fileExt.end);
00657 #endif /* RECLS_PURE_API */
00658 }
00659 
00660 inline string_t FileEntry::GetShortFile() const
00661 {
00662 #ifdef RECLS_PLATFORM_API_WIN32
00663     RECLS_ASSERT(NULL != m_info);
00664 
00665     return string_t(m_info->shortFile.begin, m_info->shortFile.end);
00666 #else
00667     return GetFile();
00668 #endif /* RECLS_PLATFORM_API_WIN32 */
00669 }
00670 
00671 inline string_t FileEntry::GetFileName() const
00672 {
00673     RECLS_ASSERT(NULL != m_info);
00674 
00675 #ifdef RECLS_PURE_API
00676     return get_string_(Recls_GetFileNameProperty, m_info);
00677 #else /* ? RECLS_PURE_API */
00678     return string_t(m_info->fileName.begin, m_info->fileName.end);
00679 #endif /* RECLS_PURE_API */
00680 }
00681 
00682 inline string_t FileEntry::GetFileExt() const
00683 {
00684     RECLS_ASSERT(NULL != m_info);
00685 
00686 #ifdef RECLS_PURE_API
00687     return get_string_(Recls_GetFileExtProperty, m_info);
00688 #else /* ? RECLS_PURE_API */
00689     return string_t(m_info->fileExt.begin, m_info->fileExt.end);
00690 #endif /* RECLS_PURE_API */
00691 }
00692 
00693 inline recls_time_t FileEntry::GetCreationTime() const
00694 {
00695     RECLS_ASSERT(NULL != m_info);
00696 
00697     return Recls_GetCreationTime(m_info);
00698 }
00699 
00700 inline recls_time_t FileEntry::GetModificationTime() const
00701 {
00702     RECLS_ASSERT(NULL != m_info);
00703 
00704     return Recls_GetModificationTime(m_info);
00705 }
00706 
00707 inline recls_time_t FileEntry::GetLastAccessTime() const
00708 {
00709     RECLS_ASSERT(NULL != m_info);
00710 
00711     return Recls_GetLastAccessTime(m_info);
00712 }
00713 
00714 inline recls_time_t FileEntry::GetLastStatusChangeTime() const
00715 {
00716     RECLS_ASSERT(NULL != m_info);
00717 
00718     return Recls_GetLastStatusChangeTime(m_info);
00719 }
00720 
00721 inline recls_filesize_t FileEntry::GetSize() const
00722 {
00723     RECLS_ASSERT(NULL != m_info);
00724 
00725 #ifdef RECLS_PURE_API
00726     recls_filesize_t    size;
00727 
00728     return (Recls_GetSizeProperty(m_info, &size), size);
00729 #else /* ? RECLS_PURE_API */
00730     return m_info->size;
00731 #endif /* RECLS_PURE_API */
00732 }
00733 
00734 inline recls_bool_t FileEntry::IsReadOnly() const
00735 {
00736     RECLS_ASSERT(NULL != m_info);
00737 
00738     return Recls_IsFileReadOnly(m_info);
00739 }
00740 
00741 inline recls_bool_t FileEntry::IsDirectory() const
00742 {
00743     RECLS_ASSERT(NULL != m_info);
00744 
00745     return Recls_IsFileDirectory(m_info);
00746 }
00747 
00748 inline recls_bool_t FileEntry::IsLink() const
00749 {
00750     RECLS_ASSERT(NULL != m_info);
00751 
00752     return Recls_IsFileLink(m_info);
00753 }
00754 
00755 inline recls_bool_t FileEntry::IsUNC() const
00756 {
00757     RECLS_ASSERT(NULL != m_info);
00758 
00759     return Recls_IsFileUNC(m_info);
00760 }
00761 
00762 inline recls_bool_t FileEntry::Exists() const
00763 {
00764     RECLS_ASSERT(NULL != m_info);
00765 
00766     return Recls_DoesEntryExist(m_info);
00767 }
00768 
00769 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00770 
00771 /* /////////////////////////////////////////////////////////////////////////////
00772  * Namespace
00773  */
00774 
00775 #if !defined(RECLS_NO_NAMESPACE)
00776 } /* namespace cpp */
00777 } /* namespace recls */
00778 
00779 #ifdef RECLS_DOCUMENTATION_SKIP_SECTION
00780 
00785 #endif /* RECLS_DOCUMENTATION_SKIP_SECTION */
00786 namespace stlsoft
00787 {
00788 //    using ::recls::cpp::c_str_ptr_null_a;
00789 //    using ::recls::cpp::c_str_ptr_null;
00790     using ::recls::cpp::c_str_ptr_a;
00791     using ::recls::cpp::c_str_ptr;
00792     using ::recls::cpp::c_str_data_a;
00793     using ::recls::cpp::c_str_data;
00794     using ::recls::cpp::c_str_len_a;
00795     using ::recls::cpp::c_str_len;
00796 }
00797 
00798 #endif /* !RECLS_NO_NAMESPACE */
00799 
00800 /* ////////////////////////////////////////////////////////////////////////// */
00801 
00802 #ifdef RECLS_DOCUMENTATION_SKIP_SECTION
00803 # undef DirectoryParts_class
00804 #endif /* RECLS_DOCUMENTATION_SKIP_SECTION */
00805 
00806 /* ////////////////////////////////////////////////////////////////////////// */
00807 
00808 #endif /* !RECLS_INCL_RECLS_CPP_HPP_FILEENTRY */
00809 
00810 /* ////////////////////////////////////////////////////////////////////////// */

recls Library documentation © Synesis Software Pty Ltd, 2001-2006