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/stl/recls.hpp

Go to the documentation of this file.
00001 /* 
00002  * File:        recls/stl/recls.hpp
00003  *
00004  * Purpose:     recls STL mapping.
00005  *
00006  * Created:     10th September 2003
00007  * Updated:     27th December 2005
00008  *
00009  * Home:        http://recls.org/
00010  *
00011  * Copyright (c) 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 
00043 #ifndef RECLS_INCL_RECLS_STL_HPP_RECLS
00044 #define RECLS_INCL_RECLS_STL_HPP_RECLS
00045 
00046 /* File version */
00047 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00048 # define RECLS_VER_RECLS_STL_HPP_RECLS_MAJOR    4
00049 # define RECLS_VER_RECLS_STL_HPP_RECLS_MINOR    0
00050 # define RECLS_VER_RECLS_STL_HPP_RECLS_REVISION 2
00051 # define RECLS_VER_RECLS_STL_HPP_RECLS_EDIT     18
00052 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00053 
00054 /* 
00055  * Includes
00056  */
00057 
00058 #include <recls/recls.h>
00059 
00060 #if RECLS_VER < RECLS_VER_1_9_1
00061 # error The recls STL mapping requires version 1.9.1 or later of the recls C API
00062 #endif /* RECLS_VER < 1.9.1 */
00063 
00064 // FTP?
00065 #if defined(RECLS_PLATFORM_IS_WIN32)
00066 # if !defined(RECLS_INCL_H_RECLS_FTP)
00067 #  include <recls/ftp.h>
00068 # endif /* !RECLS_INCL_H_RECLS_FTP */
00069 #endif /* RECLS_PLATFORM_IS_WIN32 */
00070 
00071 #include <stlsoft/stlsoft.h>    /* If the compiler cannot find this, you are not using STLSoft 1.9.1 or later, as required. */
00072 #if !defined(_STLSOFT_VER_1_9_1)
00073 # error STLSoft version 1.9.1 or greater required. (www.stlsoft.org/downloads.html)
00074 #endif /* STLSoft version */
00075 
00076 #ifdef RECLS_STL_STRING_HEADER
00077 # include RECLS_STL_STRING_HEADER
00078 #else
00079 # include <string>
00080 #endif /* RECLS_STL_STRING_HEADER */
00081 
00082 #ifdef RECLS_STL_METHOD_PROPERTY_SUPPORT
00083 # undef RECLS_STL_METHOD_PROPERTY_SUPPORT
00084 #endif /* RECLS_STL_METHOD_PROPERTY_SUPPORT */
00085 
00086 #if defined(RECLS_STL_FORCE_METHOD_PROPERTY_SUPPORT)
00087 # define RECLS_STL_METHOD_PROPERTY_SUPPORT
00088 #elif defined(RECLS_STL_NO_METHOD_PROPERTY_SUPPORT)
00089  /* Do not define RECLS_STL_METHOD_PROPERTY_SUPPORT */
00090 #else /* ? RECLS_STL_???_METHOD_PROPERTY_SUPPORT */
00091 # if defined(STLSOFT_COMPILER_IS_BORLAND)
00092  /* Do not define RECLS_STL_METHOD_PROPERTY_SUPPORT */
00093 # elif defined(STLSOFT_COMPILER_IS_DMC)
00094 #  define RECLS_STL_METHOD_PROPERTY_SUPPORT
00095 # elif defined(STLSOFT_COMPILER_IS_GCC) && \
00096        (   __GNUC__ >= 4 || \
00097            (   __GNUC__ == 3 && \
00098                __GNUC_MINOR__ >= 3))
00099 #  define RECLS_STL_METHOD_PROPERTY_SUPPORT
00100 # elif defined(STLSOFT_COMPILER_IS_INTEL)
00101 #  define RECLS_STL_METHOD_PROPERTY_SUPPORT
00102 # elif defined(STLSOFT_COMPILER_IS_MSVC)
00103 #  if _MSC_VER >= 1310
00104 #   define RECLS_STL_METHOD_PROPERTY_SUPPORT
00105 #  endif /* _MSC_VER */
00106 # elif defined(STLSOFT_COMPILER_IS_MWERKS)
00107 #  define RECLS_STL_METHOD_PROPERTY_SUPPORT
00108 # endif /* compiler */
00109 #endif /* RECLS_STL_???_METHOD_PROPERTY_SUPPORT */
00110 
00111 #ifdef RECLS_STL_METHOD_PROPERTY_SUPPORT
00112 # include <stlsoft/method_properties.hpp>
00113 #endif /* RECLS_STL_METHOD_PROPERTY_SUPPORT */
00114 
00115 /* 
00116  * Property Macros - borrowed from STLSoft's XMLSTL sub-project
00117  */
00118 
00119 #ifdef RECLS_STL_METHOD_PROPERTY_SUPPORT
00120 # define RECLS_STL_OPT_METHOD_PROPERTY_GET(V, R, C, GM, P)                  STLSOFT_METHOD_PROPERTY_GET(V, R, C, GM, P)
00121 # define RECLS_STL_OPT_METHOD_PROPERTY_GET_PROP(R, C, GM, P)                STLSOFT_METHOD_PROPERTY_GET_EXTERNAL_PROP(R, C, GM, P)
00122 # define RECLS_STL_OPT_METHOD_PROPERTY_GETSET(V, RG, RS, C, GM, SM, P)      STLSOFT_METHOD_PROPERTY_GETSET_EXTERNAL(RG, RS, C, GM, SM, P)
00123 # define RECLS_STL_OPT_METHOD_PROPERTY_DEFINE_OFFSET(C, P)                  STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P)
00124 # define RECLS_STL_OPT_METHOD_PROPERTY_GETSET_PROP(RG, RS, C, GM, SM, P)    STLSOFT_METHOD_PROPERTY_GETSET_EXTERNAL_PROP(RG, RS, C, GM, SM, P)
00125 #else /* ? RECLS_STL_METHOD_PROPERTY_SUPPORT */
00126 # define RECLS_STL_OPT_METHOD_PROPERTY_GET(V, R, C, GM, P)
00127 # define RECLS_STL_OPT_METHOD_PROPERTY_GET_PROP(R, C, GM, P)
00128 # define RECLS_STL_OPT_METHOD_PROPERTY_GETSET(V, RG, RS, C, GM, SM, P)
00129 # define RECLS_STL_OPT_METHOD_PROPERTY_DEFINE_OFFSET(C, P)
00130 # define RECLS_STL_OPT_METHOD_PROPERTY_GETSET_PROP(RG, RS, C, GM, SM, P)
00131 #endif /* RECLS_STL_METHOD_PROPERTY_SUPPORT */
00132 
00133 /* 
00134  * Namespace
00135  */
00136 
00137 #if !defined(RECLS_NO_NAMESPACE)
00138 namespace recls
00139 {
00140 
00141 namespace stl
00142 {
00143 #endif /* !RECLS_NO_NAMESPACE */
00144 
00145 /* 
00146  * Typedefs
00147  */
00148 
00149 #ifdef RECLS_DOCUMENTATION_SKIP_SECTION
00150 
00159 typedef std::string             string_t;
00160 
00161 #else /* ? RECLS_DOCUMENTATION_SKIP_SECTION */
00162 
00163 # ifdef RECLS_STL_STRING_HEADER
00164 #  ifndef RECLS_STL_STRING_T
00165 #   error RECLS_STL_STRING_T must be defined when RECLS_STL_STRING_HEADER is defined
00166 #  endif /* !RECLS_STRING_T */
00167 typedef RECLS_STL_STRING_T          string_t;
00168 # else /* ? RECLS_STRING_HEADER */
00169 typedef stlsoft_ns_qual_std(string) string_t;
00170 # endif /* RECLS_STRING_HEADER */
00171 #endif /* RECLS_DOCUMENTATION_SKIP_SECTION */
00172 
00173 /* 
00174  * Classes
00175  */
00176 
00178 class recls_exception
00179     : public std::exception
00180 {
00183 public:
00184     typedef std::exception      parent_class_type;
00185     typedef recls_exception  class_type;
00187 
00190 public:
00192     explicit recls_exception(recls_rc_t rc)
00193         : m_rc(rc)
00194         , m_message(create_message_(rc))
00195     {}
00196 #ifdef STLSOFT_COMPILER_IS_GCC
00197     virtual ~recls_exception() throw()
00198     {}
00199 #endif /* STLSOFT_COMPILER_IS_GCC */
00200 
00201 
00204 public:
00206     recls_rc_t rc() const
00207     {
00208         return m_rc;
00209     }
00210 
00212     virtual char const *what() const throw()
00213     {
00214         return m_message.c_str();
00215     }
00217 
00220 private:
00221     static string_t create_message_(recls_rc_t rc)
00222     {
00223         string_t    msg(recls::Recls_GetErrorString(rc, NULL, 0), '~');
00224 
00225         recls::Recls_GetErrorString(rc, &msg[0], msg.size());
00226 
00227         return msg;
00228     }
00230 
00233 private:
00234     const recls_rc_t    m_rc;
00235     const string_t      m_message;
00237 
00238 // Not to be implemented
00239 private:
00240     class_type &operator =(class_type const &);
00241 };
00242 
00243 /* 
00244  * Namespace
00245  */
00246 
00247 #if !defined(RECLS_NO_NAMESPACE)
00248 } /* namespace stl */
00249 } /* namespace recls */
00250 namespace reclstl = ::recls::stl;
00251 #endif /* !RECLS_NO_NAMESPACE */
00252 
00253 /* 
00254 
00255 #endif /* !RECLS_INCL_RECLS_STL_HPP_RECLS */
00256 
00257 /* 

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