err_code.hpp

См. документацию.
00001 /*
00002 
00003 Copyright (c) 2002-2005, Yauheni Akhotnikau
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009 - Redistributions of source code must retain the above copyright notice, this
00010 list of conditions and the following disclaimer.
00011 
00012 - Redistributions in binary form must reproduce the above copyright notice, this
00013 list of conditions and the following disclaimer in the documentation and/or
00014 other materials provided with the distribution.
00015 
00016 - The name of the author may not be used to endorse or promote products derived
00017 from this software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00020 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00022 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00024 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00027 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00028 OF SUCH DAMAGE.
00029 
00030 */
00031 
00037 #if !defined( _OESS_1__DEFS__ERR_CODE_HPP_ )
00038 #define _OESS_1__DEFS__ERR_CODE_HPP_
00039 
00040 #include <oess_1/defs/h/declspec.hpp>
00041 
00042 #include <iostream>
00043 
00044 #include <string>
00045 
00046 #include <oess_1/defs/h/types.hpp>
00047 
00048 namespace oess_1 {
00049 
00051 
00056 struct OESS_1__DEFS__TYPE err_code_t {
00058   int_t m_code;
00059 
00061   std::string m_file;
00062 
00065 
00070   int m_line;
00071 
00073 
00083   std::string m_desc;
00084 
00090   err_code_t(
00092     const std::string & file,
00095     int line );
00096 
00100   err_code_t(
00102     int_t code,
00104     const std::string & file,
00107     int line,
00109     const std::string & desc );
00110 
00112   err_code_t(
00113     const err_code_t & o );
00114 
00115   ~err_code_t();
00116 
00118   err_code_t &
00119   operator=(
00120     const err_code_t & o );
00121 
00123 
00127   inline
00128   operator bool() const {
00129     return ( 0 != m_code );
00130   }
00131 
00133 
00139   inline bool
00140   operator==( int c ) const {
00141     return ( c == m_code );
00142   }
00143 
00145 
00148   inline bool
00149   operator==( const err_code_t & o ) const {
00150     return ( m_code == o.m_code );
00151   }
00152 
00154 
00160   inline bool
00161   operator!=( int c ) const {
00162     return ( c != m_code );
00163   }
00164 
00166 
00169   inline bool
00170   operator!=( const err_code_t & o ) const {
00171     return ( m_code != o.m_code );
00172   }
00173 
00175 
00180   inline bool
00181   operator!() const {
00182     return ( !m_code );
00183   }
00184 };
00185 
00187 
00206 #define oess_1_make_err(code, desc) oess_1::err_code_t(code, __FILE__, __LINE__, desc)
00207 
00209 
00217 OESS_1__DEFS__FUNC( std::ostream & )
00218 err_code_to_std_ostream( std::ostream & o, const err_code_t & c );
00219 
00221 
00226 inline std::ostream &
00227 operator<<( std::ostream & o, const err_code_t & c )
00228 {
00229   return err_code_to_std_ostream( o, c );
00230 }
00231 
00232 } /* namespace oess_1 */
00233 
00234 #endif

Документация по ObjESSty. Последние изменения: Fri Oct 13 18:35:36 2006. Создано системой  doxygen 1.4.7
Hosted by uCoz