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/internal/platform_types.h

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////////
00002  * File:        recls/internal/platform_types.h
00003  *
00004  * Purpose:     Platform discrimination for the recls API.
00005  *
00006  * Created:     18th August 2003
00007  * Updated:     16th June 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_INTERNAL_H_PLATFORM_TYPES
00042 #define RECLS_INCL_RECLS_INTERNAL_H_PLATFORM_TYPES
00043 
00044 /* File version */
00045 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00046 # define RECLS_VER_RECLS_INTERNAL_H_PLATFORM_TYPES_MAJOR     3
00047 # define RECLS_VER_RECLS_INTERNAL_H_PLATFORM_TYPES_MINOR     1
00048 # define RECLS_VER_RECLS_INTERNAL_H_PLATFORM_TYPES_REVISION  1
00049 # define RECLS_VER_RECLS_INTERNAL_H_PLATFORM_TYPES_EDIT      22
00050 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00051 
00058 /* /////////////////////////////////////////////////////////////////////////////
00059  * Includes
00060  */
00061 
00062 #ifndef RECLS_INCL_RECLS_INTERNAL_H_PLATFORM
00063 # error recls/internal/platform_types.h must not be included directly. You should include recls/recls.h
00064 #endif /* !RECLS_INCL_RECLS_INTERNAL_H_PLATFORM */
00065 
00066 #if defined(RECLS_PURE_API) || \
00067     defined(RECLS_PLATFORM_IS_UNIX)
00068 # include <time.h>
00069 # include <sys/types.h>
00070 #elif defined(RECLS_PLATFORM_IS_WIN32)
00071 # include <windows.h>
00072 #elif defined(RECLS_OVERRIDE_PLATFORM)
00073  /* You're expected to ensure that the appropriate inclusions are made */
00074 #else
00075 # error Platform not (yet) recognised
00076 #endif /* platform */
00077 
00078 /* /////////////////////////////////////////////////////////////////////////////
00079  * Namespace
00080  */
00081 
00082 #if !defined(RECLS_NO_NAMESPACE)
00083 namespace recls
00084 {
00085 #endif /* !RECLS_NO_NAMESPACE */
00086 
00087 /* /////////////////////////////////////////////////////////////////////////////
00088  * Platform-dependent types
00089  */
00090 
00100 #if defined(RECLS_PURE_API) || \
00101     defined(RECLS_PLATFORM_IS_UNIX)
00102 
00103  typedef time_t                     recls_time_t;
00104  typedef off_t                      recls_filesize_t;
00105 
00106 #elif defined(RECLS_PLATFORM_IS_WIN32)
00107 
00108  typedef FILETIME                   recls_time_t;
00109  typedef ULARGE_INTEGER             recls_filesize_t;
00110 
00111 #elif defined(RECLS_OVERRIDE_PLATFORM)
00112 
00113 # ifndef RECLS_CUSTOM_TIME_T
00114 #  error Must define RECLS_CUSTOM_TIME_T if compiling with RECLS_OVERRIDE_PLATFORM
00115 # endif /* !RECLS_CUSTOM_TIME_T */
00116 
00117 # ifndef RECLS_CUSTOM_FILESIZE_T
00118 #  error Must define RECLS_CUSTOM_FILESIZE_T if compiling with RECLS_OVERRIDE_PLATFORM
00119 # endif /* !RECLS_CUSTOM_TIME_T */
00120 
00121  typedef RECLS_CUSTOM_TIME_T        recls_time_t;
00122  typedef RECLS_CUSTOM_FILESIZE_T    recls_filesize_t;
00123 
00124 #else
00125 
00126 # error Platform not (yet) recognised
00127 
00128  typedef <platform-dependent-type>  recls_time_t;
00129  typedef <platform-dependent-type>  recls_filesize_t;
00130 
00131 #endif /* platform */
00132 
00133 /* /////////////////////////////////////////////////////////////////////////////
00134  * Typedefs
00135  */
00136 
00137 #if defined(_UNICODE) && \
00138     !defined(UNICODE)
00139 # define UNICODE
00140 #endif /* _UNICODE && !UNICODE */
00141 
00142 #if defined(UNICODE) && \
00143     !defined(_UNICODE)
00144 # define _UNICODE
00145 #endif /* UNICODE && !_UNICODE */
00146 
00147 #ifdef RECLS_CHAR_TYPE_IS_CHAR
00148 # undef RECLS_CHAR_TYPE_IS_CHAR
00149 #endif /* RECLS_CHAR_TYPE_IS_CHAR */
00150 
00151 #ifdef RECLS_CHAR_TYPE_IS_WCHAR
00152 # undef RECLS_CHAR_TYPE_IS_WCHAR
00153 #endif /* RECLS_CHAR_TYPE_IS_WCHAR */
00154 
00156 #if defined(UNICODE) && \
00157     !defined(RECLS_NO_UNICODE)
00158 typedef recls_char_w_t              recls_char_t;
00159 # define RECLS_CHAR_TYPE_IS_WCHAR
00160 # define RECLS_LITERAL(x)           L ## x
00161 #else /* ? UNICODE && !RECLS_NO_UNICODE */
00162 typedef recls_char_a_t              recls_char_t;
00163 # define RECLS_CHAR_TYPE_IS_CHAR
00164 # define RECLS_LITERAL(x)           x
00165 #endif /* UNICODE && !RECLS_NO_UNICODE */
00166 
00167 
00169 struct recls_strptrs_t
00170 {
00172     recls_char_t const  *begin;
00174     recls_char_t const  *end;
00175 };
00176 
00178 struct recls_strptrsptrs_t
00179 {
00181     struct recls_strptrs_t const    *begin;
00183     struct recls_strptrs_t const    *end;
00184 };
00185 
00190 #if !defined(RECLS_PURE_API)
00191 struct recls_fileinfo_t
00192 {
00196     recls_uint32_t              attributes;
00204     struct recls_strptrs_t      path;
00205 # if defined(RECLS_PLATFORM_IS_WIN32)
00206 
00211     struct recls_strptrs_t      shortFile;
00213     recls_char_t                drive;
00214 # endif /* RECLS_PLATFORM_IS_WIN32 */
00215 
00219     struct recls_strptrs_t      directory;
00224     struct recls_strptrs_t      fileName;
00229     struct recls_strptrs_t      fileExt;
00234     struct recls_strptrsptrs_t  directoryParts;
00238 # if defined(RECLS_PLATFORM_IS_WIN32)
00239 
00243     recls_time_t                creationTime;
00244 # endif /* RECLS_PLATFORM_IS_WIN32 */
00245 
00246     recls_time_t                modificationTime;
00248     recls_time_t                lastAccessTime;
00249 # if defined(RECLS_PLATFORM_IS_UNIX)
00250 
00254     recls_time_t                lastStatusChangeTime;
00255 # endif /* RECLS_PLATFORM_IS_UNIX */
00256 
00260     recls_filesize_t            size;
00268     struct recls_strptrs_t      searchDirectory;
00272     struct recls_strptrs_t      searchRelativePath;
00274 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00275 /* data */
00277     recls_uint64_t              checkSum;
00279     recls_uint32_t              extendedFlags[2];
00285     recls_byte_t                data[1];
00286     /*
00287      *
00288      * - full path
00289      * - directory parts
00290      *
00291      */
00292 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00293 };
00294 #endif /* !RECLS_PURE_API */
00295 
00296 /* /////////////////////////////////////////////////////////////////////////////
00297  * Namespace
00298  */
00299 
00300 #if !defined(RECLS_NO_NAMESPACE)
00301 } /* namespace recls */
00302 #endif /* !RECLS_NO_NAMESPACE */
00303 
00304 /* ////////////////////////////////////////////////////////////////////////// */
00305 
00306 #endif /* !RECLS_INCL_RECLS_INTERNAL_H_PLATFORM_TYPES */
00307 
00308 /* ////////////////////////////////////////////////////////////////////////// */

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