OSDN Git Service

error_codeクラスを追加
authornakai <nakai@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 22 Jan 2009 11:52:55 +0000 (11:52 +0000)
committernakai <nakai@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 22 Jan 2009 11:52:55 +0000 (11:52 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-shamshel@6245 1ed66053-1c2d-0410-8867-f7571e6e31d3

include/error_code.h

index 5e05ac8..5dd1505 100644 (file)
@@ -1,3 +1,14 @@
+#ifndef        ERROR_CODE_H
+#define        ERROR_CODE_H
+//
+//!    @file   error_code.h
+//!    @brief  error code and error messege impliment class
+//     coipyright (C) NTTComware corporation. 2008 - 2009
+//     mail: n.nakai at sdy.co.jp
+//
+//     Distributed under the Boost Software License, Version 1.0. (See accompanying
+//     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 #include <string>
 
 namespace l7vs{
@@ -10,7 +21,10 @@ protected:
        std::string     msg;
 public:
        error_code() : flag(false){}    //!< constractor
-       error_code( bool inflg, std::string& instr ){
+       //! copy constractor
+       //! @param[in]  flags
+       //! @param[in]  error message
+       error_code( const bool inflg, const std::string& instr ){
                flag = inflg;
                msg = instr;
        }
@@ -20,7 +34,16 @@ public:
        typedef void (*unspecified_bool_type)();        //!< if return function
        static void unspecified_bool_true() {}          //!< if true orverload function
        operator unspecified_bool_type() const { return flag == 0 ? 0 : unspecified_bool_true; } //!< if() orverload
-       const std::string&      get_message() const { return msg; }             //
+       const std::string&      get_message() const { return msg; }             //!< message getter
+       //! error setter
+       //! @param[in]  flags
+       //! @param[in]  error message
+       void    setter( const bool flg, const std::string& instr ){
+               flag = flg;
+               msg = instr;
+       }
 };
 
 }
+
+#endif // ERROR_CODE_H