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

📄 enum.h

📁 QT4的utils库源码包.解压后运行./configure配置,然后make.使用时在.pro文件中加入两行:LIBS+=-L$$(CPPLIBS)-lutils及INCLUDEPATH+=$$(C
💻 H
字号:
#ifndef OOENUM_H#define OOENUM_H#include "myexport.h"#include <QStringList>#include <QTextStream>#include <QMap>typedef QMap<QString, int> NameMap;//start/** @short An object-oriented enumerator class which  uses strings instead of compiler symbols,  and provides bidirectional mapping between  QStrings and int values. No compiler symbols  are introduced.  */class UTILS_EXPORT Enum {public:    Enum(int enumval = 0);    virtual ~Enum();    /** Converts from the int value to a String */    virtual QString toString() const;    /** Converts from a string to the internal enum value.          returns false if an invalid string is passed in. */    virtual bool fromString(QString str) =0;    virtual operator int() const ;    bool operator=(int other);    bool operator=(QString other);        bool operator==(const Enum& other) const {        return m_Val == other.m_Val;    }            virtual QStringList names() const = 0;protected:    //end    /** Adds symbols to the map with enum values starting           at 0         @param nameMap - the map containing strings to numbers         @param nameList - a string list of names to add to the map         @param initialized - if true, do nothing (to avoid repeat-redundant calls                  - if false, set to true after initializing.    */    static NameMap& initMap(NameMap& nameMap,                            QStringList nameList, bool  & initialized, int startIndex = 0);    //start    int m_Val;};/* optional */QTextStream& operator<<(QTextStream& ts, const Enum& pref);//end#endif 

⌨️ 快捷键说明

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