⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 waroption.h

📁 ftpserver very good sample
💻 H
字号:
/** */#ifndef WAR_OPTION_H#define WAR_OPTION_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_SMART_POINTER_H#   include "WarSmartPointer.h"#endif#ifndef WAR_COLLECTOR_H#   include "WarCollector.h"#endif#ifndef WAR_AUTO_LOCK_H#   include "WarAutoLock.h"#endif#ifndef WAR_PTR_WRAPPER_H#   include "WarPtrWrapper.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */class WarOptionList;#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarOption{public:    typedef WarCollector<char> buffer_t;    enum WarOptionTypeE    {        OT_BOOL,        OT_STRING,        OT_INT,        OT_INVALID    };    enum OptLevelE    {        OL_SERVER,        OL_SITE,        OL_USER    };    // LIFECYCLE        /**    * Default constructor.    */    WarOption(war_ccstr_t value = NULL)        throw(WarException)        : mValue(value ? value : "")    {}    WarOption(const std::string& value)        throw(WarException)        : mValue(value)    {}    /**    * Copy constructor.    *    * @param from The value to copy to this object.    */    WarOption(const WarOption& from)    {        operator = (from);    }        /**    * Destructor.    */    virtual ~WarOption(void) {}        // OPERATORS        /**    * Assignment operator.    *    * @param from THe value to assign to this object.    *    * @return A reference to this object.    */    WarOption& operator = (const WarOption& from)    {        mValue = from.GetValue();        return *this;    }        // OPERATIONS      // ACCESS    virtual const std::string GetValue() const        throw(WarException)    {        return mValue;    }    virtual const int GetIntValue() const        throw(WarException)    {        return mValue.empty()             ? 0              : atoi(mValue.c_str());    }        // INQUIRY        virtual bool IsEmpty() const        throw(WarException)    {        return mValue.empty();    }    protected:    /** This table defines all the options that the library      * Expects to find.       */private:    friend class WarOptionList;    std::string mValue;};/* INLINE METHODS *//* EXTERNAL REFERENCES */template <class charT>WarCollector<charT>& operator << (WarCollector<charT>& o,                                   const WarOption::WarOptionTypeE v){    war_ccstr_t p = "";    switch(v)    {    case WarOption::OT_BOOL:        p = "bool";        break;    case WarOption::OT_STRING:        p = "string";        break;    case WarOption::OT_INT:        p = "int";        break;    }        return o << p;}#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_OPTION_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -