4 // (C) Copyright 2009- Norihisa Nakai
5 // Distributed under the Boost Software License, Version 1.0
6 // (See accompanying file LICENSE_1_0.txt http://www.boost.org/LICENSE_1_0.txt)
10 namespace ultramonkey{
13 //! @brief getValue error
14 //! @brief this class is POD
17 bool flag; //!< errorcode flag
18 std::string msg; //!< errorcode message
20 error_code() : flag(false){} //!< constractor
21 //! setter constractor
23 //! @param[in] error message
24 error_code( const bool inflg, const std::string& instr ) : flag( inflag ), msg( instr ){}
25 bool operator==( const bool in ) const { return ( flag == in ); } //!< operator== orverload
26 bool operator!=( const bool in ) const { return ( flag != in ); } //!< operator!= orverload
27 bool operator!() const { return !flag; } //!< operator! orverload
28 typedef void (*unspecified_bool_type)(); //!< if return function
29 static void unspecified_bool_true() {} //!< if true orverload function
30 operator unspecified_bool_type() const { return flag == 0 ? 0 : unspecified_bool_true; } //!< if() orverload
31 const std::string& get_message() const { return msg; } //!< message getter
34 //! @param[in] error message
35 void setter( const bool flg, const std::string& instr ){
43 #endif // ERROR_CODE_H