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

📄 wartextmacro.h

📁 ftpserver very good sample
💻 H
字号:
/**     Virtual Base class for macros (typically in text-    strings) that are to be expanded. */#ifndef WAR_TEXT_MACRO_H#define WAR_TEXT_MACRO_H/* SYSTEM INCLUDES */#ifndef WAR_SET_INCLUDED#   define WAR_SET_INCLUDED#   include <set>#endif/* PROJECT INCLUDES */#ifndef WAR_SMART_POINTER_H#   include "WarSmartPointer.h"#endif#ifndef WAR_PTR_WRAPPER#   include "WarPtrWrapper.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarTextMacroEnums{public:    enum ExpandModesE    {        EXPAND_ALL,        EXPAND_ALL_BUT_FILES,        EXPAND_SAFE,        EXPAND_NONE    };};class WarTextMacro : public WarSmartPointer,    public WarTextMacroEnums{public:    // LIFECYCLE       WarTextMacro(war_ccstr_t name,         war_ccstr_t explanation = NULL,        bool isSafe = false) :        mIsSafe(isSafe),        mName(name),        mExplanation(explanation ? explanation : "")    {}        // OPERATORS    bool operator < (const WarTextMacro& from) const    {        return mName < from.mName;    }        bool operator == (const WarTextMacro& from) const    {        return mName == from.mName;    }    bool operator < (const std::string& from) const    {        return mName < from;    }        bool operator == (const std::string& from) const    {        return mName == from;    }    // OPERATIONS                           // ACCESS    // INQUIRY    virtual std::string Expand(war_ccstr_t argument = NULL)        throw(WarException)    {        WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL);    }    virtual const std::string GetName() const    {        return mName;    }    virtual bool IsSafe() const    {        return mIsSafe;    }    virtual bool IsFile() const    {        // Return true if the macro reads a file.         // This imposes problems with security, where        // users may try to display system-files,        // or recursive loops where files includes        // each others!        return false;    }    /** Get the default mode to expand the macro to.      * This concerns security, as macros returned      * by the macros will be expanded according      * to this level.       */    virtual ExpandModesE GetMode() const    {        return EXPAND_SAFE;    }protected:    ~WarTextMacro(void)    {}    bool mIsSafe; // Safe to expand - not exploitableprivate:    const std::string mName;    const std::string mExplanation;};/* INLINE METHODS *//* EXTERNAL REFERENCES */typedef WarPtrWrapper<WarTextMacro> war_macro_ptr_t;typedef std::set<war_macro_ptr_t> war_macro_set_t;#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_SVR_PROTOCOL_FTP_MACROS_H_ */

⌨️ 快捷键说明

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