OSDN Git Service

l7vs::parameter::error_codeをerror_codeに変更
authornakai <nakai@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 22 Jan 2009 11:52:40 +0000 (11:52 +0000)
committernakai <nakai@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 22 Jan 2009 11:52:40 +0000 (11:52 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-shamshel@6244 1ed66053-1c2d-0410-8867-f7571e6e31d3

parameter/parameter.cpp
parameter/parameter.h
parameter/parameter_enum.h
parameter/parameter_impl.cpp
parameter/parameter_impl.h

index 343a978..5872bc8 100644 (file)
@@ -55,7 +55,7 @@ bool l7vs::Parameter::read_file(PARAMETER_COMPONENT_TAG comp){
  */
 int l7vs::Parameter::get_int(  const l7vs::PARAMETER_COMPONENT_TAG comp,
                                                                const std::string& key,
-                                                               l7vs::parameter::error_code& err ){
+                                                               l7vs::error_code& err ){
        ParameterImpl&  impl = ParameterImpl::get_instance();
        return impl.get_int( comp, key, err );
 }
@@ -68,7 +68,7 @@ int l7vs::Parameter::get_int( const l7vs::PARAMETER_COMPONENT_TAG comp,
  */
 std::string l7vs::Parameter::get_string(               const l7vs::PARAMETER_COMPONENT_TAG comp,
                                                                                                const std::string& key,
-                                                                                               l7vs::parameter::error_code& err ){
+                                                                                               l7vs::error_code& err ){
        ParameterImpl&  impl = ParameterImpl::get_instance();
        return impl.get_string( comp, key, err );
 }
index 1f3fa39..ed41869 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <string>
 #include "parameter_enum.h"
+#include "error_code.h"
 
 namespace l7vs{
 
@@ -38,14 +39,14 @@ public:
        //!     @param[in]      parameter key
        //! @param[out] error code
        //!     @return intvalue
-       int             get_int(const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+       int             get_int(const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
 
        //! parameter string value getter
        //! @param[in]  parametercategory
        //!     @param[in]      parameter key
        //! @param[out] error code
        //!     @return string value
-       std::string     get_string(const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+       std::string     get_string(const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
 };
 
 }      //namespace l7vs
index 7a0694d..4edaec4 100644 (file)
 
 namespace l7vs{
 
-namespace parameter{
-
-//! @class     error_code
-//!    @brief  getValue error
-//! @brief     this class is POD
-class  error_code{
-protected:
-       bool    flag;   //!<    errorcode_flag
-public:
-       error_code() : flag(false){}    //!< constractor
-       bool    operator==( const bool in )const { return ( flag == in ); } //!< operator== orverload
-       bool    operator!=( const bool in )const { return ( flag != in ); } //!< operator!= orverload
-       bool    operator!() const { return !flag; } //!< operator! orverload
-       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
-       void    set_flag( bool in ){ flag = in; } //!< flag setter
-};
-}      //namespace parameter
-
 //! @enum      PARAMTER_COMPONENT_TAG
 //!    @brief  parameter key tags
 enum PARAMETER_COMPONENT_TAG {
index a430702..cdc1f77 100644 (file)
@@ -223,14 +223,14 @@ bool      l7vs::ParameterImpl::read_file( const l7vs::PARAMETER_COMPONENT_TAG comp ){
 //! @return            integer value
 int    l7vs::ParameterImpl::get_int(   const l7vs::PARAMETER_COMPONENT_TAG comp,
                                                                        const std::string& key,
-                                                                       l7vs::parameter::error_code& err ){
+                                                                       l7vs::error_code& err ){
        boost::mutex::scoped_lock       lock( param_mutex );
        std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator      section_table_iterator = tag_section_table_map.find( comp );
        int_map_type::iterator intmap_iterator = intMap.find( section_table_iterator->second + "." + key );
        if( intmap_iterator != intMap.end() )
                        return intmap_iterator->second;
        else
-               err.set_flag( true );
+               err.setter( true, "don't find key" );
 
        return 0;
 }
@@ -243,13 +243,13 @@ int       l7vs::ParameterImpl::get_int(   const l7vs::PARAMETER_COMPONENT_TAG comp,
 
 std::string    l7vs::ParameterImpl::get_string( const l7vs::PARAMETER_COMPONENT_TAG comp,
                                                                                         const std::string& key,
-                                                                                        l7vs::parameter::error_code& err ){
+                                                                                        l7vs::error_code& err ){
        boost::mutex::scoped_lock       lock( param_mutex );
        std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator      section_table_iterator = tag_section_table_map.find( comp );
        string_map_type::iterator strmap_iterator = stringMap.find( section_table_iterator->second + "." + key );
        if( strmap_iterator != stringMap.end() )
                return strmap_iterator->second;
        else
-               err.set_flag( true );
+               err.setter( true, "don't find key" );
        return std::string("");
 }
index da587fa..8d2aafb 100644 (file)
@@ -14,6 +14,7 @@
 #define PARAMETER_IMPL_H
 
 #include "parameter_enum.h"
+#include "error_code.h"
 #include <string>
 #include <map>
 #include <boost/function.hpp>
@@ -66,14 +67,14 @@ public:
        //! @param[in]  keystring
        //! @param[out] errorcode
        //! @return             int value
-       int     get_int( const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+       int     get_int( const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
 
        //! string value getter
        //! @param[in]  component tag
        //! @param[in]  keystring
        //! @param[out] errorcode
        //! @return             string value
-       std::string     get_string( const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+       std::string     get_string( const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
 };
 
 }