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

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/include/recls_platform_types.h

Go to the documentation of this file.
00001 /* 
00002  * File:        recls_platform_types.h
00003  *
00004  * Purpose:     Platform discrimination for the recls API.
00005  *
00006  * Created:     18th August 2003
00007  * Updated:     4th March 2005
00008  *
00009  * Home:        http://recls.org/
00010  *
00011  * Copyright 2003-2005, 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_H_RECLS_PLATFORM_TYPES
00042 #define RECLS_INCL_H_RECLS_PLATFORM_TYPES
00043 
00044 /* File version */
00045 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00046 # define RECLS_VER_H_RECLS_PLATFORM_TYPES_MAJOR     2
00047 # define RECLS_VER_H_RECLS_PLATFORM_TYPES_MINOR     0
00048 # define RECLS_VER_H_RECLS_PLATFORM_TYPES_REVISION  2
00049 # define RECLS_VER_H_RECLS_PLATFORM_TYPES_EDIT      16
00050 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00051 
00054 /* 
00055  * Includes
00056  */
00057 
00058 #ifndef RECLS_INCL_H_RECLS_PLATFORM
00059 # error recls_platform_types.h must not be included directly. You should include recls.h
00060 #endif /* !RECLS_INCL_H_RECLS_PLATFORM */
00061 
00062 #if defined(RECLS_PURE_API) || \
00063     defined(RECLS_PLATFORM_IS_UNIX)
00064 # include <time.h>
00065 # include <sys/types.h>
00066 #elif defined(RECLS_PLATFORM_IS_WIN32)
00067 # include <windows.h>
00068 #elif defined(RECLS_OVERRIDE_PLATFORM)
00069  /* You're expected to ensure that the appropriate inclusions are made */
00070 #else
00071 # error Platform not (yet) recognised
00072 #endif /* platform */
00073 
00074 /* 
00075  * Namespace
00076  */
00077 
00078 #if !defined(RECLS_NO_NAMESPACE)
00079 namespace recls
00080 {
00081 #endif /* !RECLS_NO_NAMESPACE */
00082 
00083 /* 
00084  * Platform-dependent types
00085  */
00086 
00090 #if defined(RECLS_PURE_API) || \
00091     defined(RECLS_PLATFORM_IS_UNIX)
00092 
00093  typedef time_t                     recls_time_t;
00094  typedef off_t                      recls_filesize_t;
00095 
00096 #elif defined(RECLS_PLATFORM_IS_WIN32)
00097 
00098  typedef FILETIME                   recls_time_t;
00099  typedef ULARGE_INTEGER             recls_filesize_t;
00100 
00101 #elif defined(RECLS_OVERRIDE_PLATFORM)
00102 
00103 # ifndef RECLS_CUSTOM_TIME_T
00104 #  error Must define RECLS_CUSTOM_TIME_T if compiling with RECLS_OVERRIDE_PLATFORM
00105 # endif /* !RECLS_CUSTOM_TIME_T */
00106 
00107 # ifndef RECLS_CUSTOM_FILESIZE_T
00108 #  error Must define RECLS_CUSTOM_FILESIZE_T if compiling with RECLS_OVERRIDE_PLATFORM
00109 # endif /* !RECLS_CUSTOM_TIME_T */
00110 
00111  typedef RECLS_CUSTOM_TIME_T        recls_time_t;
00112  typedef RECLS_CUSTOM_FILESIZE_T    recls_filesize_t;
00113 
00114 #else
00115 
00116 # error Platform not (yet) recognised
00117 
00118  typedef <platform-dependent-type>  recls_time_t;
00119  typedef <platform-dependent-type>  recls_filesize_t;
00120 
00121 #endif /* platform */
00122 
00123 /* 
00124  * Typedefs
00125  */
00126 
00127 #if defined(_UNICODE) && \
00128     !defined(UNICODE)
00129 # define UNICODE
00130 #endif /* _UNICODE && !UNICODE */
00131 
00132 #if defined(UNICODE) && \
00133     !defined(_UNICODE)
00134 # define _UNICODE
00135 #endif /* UNICODE && !_UNICODE */
00136 
00137 #ifdef RECLS_CHAR_TYPE_IS_CHAR
00138 # undef RECLS_CHAR_TYPE_IS_CHAR
00139 #endif /* RECLS_CHAR_TYPE_IS_CHAR */
00140 
00141 #ifdef RECLS_CHAR_TYPE_IS_WCHAR
00142 # undef RECLS_CHAR_TYPE_IS_WCHAR
00143 #endif /* RECLS_CHAR_TYPE_IS_WCHAR */
00144 
00146 #if defined(UNICODE) && \
00147     !defined(RECLS_NO_UNICODE)
00148 typedef recls_char_w_t              recls_char_t;
00149 # define RECLS_CHAR_TYPE_IS_WCHAR
00150 # define RECLS_LITERAL(x)           L ## x
00151 #else /* ? UNICODE && !RECLS_NO_UNICODE */
00152 typedef recls_char_a_t              recls_char_t;
00153 # define RECLS_CHAR_TYPE_IS_CHAR
00154 # define RECLS_LITERAL(x)           x
00155 #endif /* UNICODE && !RECLS_NO_UNICODE */
00156 
00157 
00159 struct recls_strptrs_t
00160 {
00162     recls_char_t const  *begin;
00164     recls_char_t const  *end;
00165 };
00166 
00168 struct recls_strptrsptrs_t
00169 {
00171     struct recls_strptrs_t const    *begin;
00173     struct recls_strptrs_t const    *end;
00174 };
00175 
00180 #if !defined(RECLS_PURE_API)
00181 struct recls_fileinfo_t
00182 {
00186     recls_uint32_t              attributes;
00194     struct recls_strptrs_t      path;
00195 # if defined(RECLS_PLATFORM_IS_WIN32)
00196 
00201     struct recls_strptrs_t      shortFile;
00203     recls_char_t                drive;
00204 # endif /* RECLS_PLATFORM_IS_WIN32 */
00205 
00209     struct recls_strptrs_t      directory;
00214     struct recls_strptrs_t      fileName;
00219     struct recls_strptrs_t      fileExt;
00224     struct recls_strptrsptrs_t  directoryParts;
00228 # if defined(RECLS_PLATFORM_IS_WIN32)
00229 
00233     recls_time_t                creationTime;
00234 # endif /* RECLS_PLATFORM_IS_WIN32 */
00235 
00236     recls_time_t                modificationTime;
00238     recls_time_t                lastAccessTime;
00239 # if defined(RECLS_PLATFORM_IS_UNIX)
00240 
00244     recls_time_t                lastStatusChangeTime;
00245 # endif /* RECLS_PLATFORM_IS_UNIX */
00246 
00250     recls_filesize_t            size;
00252 /* data */
00256     recls_byte_t                data[1];
00257     /*
00258      *
00259      * - full path
00260      * - directory parts
00261      *
00262      */
00263 };
00264 #endif /* !RECLS_PURE_API */
00265 
00266 /* 
00267  * Namespace
00268  */
00269 
00270 #if !defined(RECLS_NO_NAMESPACE)
00271 } /* namespace recls */
00272 #endif /* !RECLS_NO_NAMESPACE */
00273 
00274 /* 
00275 
00276 #endif /* !RECLS_INCL_H_RECLS_PLATFORM_TYPES */
00277 
00278 /* 

recls Library documentation Synesis Software Pty Ltd, 2001-2005