00001
00002 #ifndef GENCPPCLASS_H
00003 #define GENCPPCLASS_H
00004
00005
00006 #include <qstring.h>
00007 #include "capelmodule.h"
00008
00022 enum CppFlags {
00023 NONE = 0x0000,
00024 NO_SET = 0x0001,
00025 NO_GET = 0x0002,
00026 SET_CONST_REFERENCE = 0x0004,
00027 GET_CONST_REFERENCE = 0x0008,
00028 CONST_REFERENCE = SET_CONST_REFERENCE | GET_CONST_REFERENCE
00029 };
00030
00031 class GetSetArray {
00032 public:
00033 CppFlags flags;
00034 QString sType;
00035 QString sName;
00036 QString sDefValue;
00037 QString sToFunc;
00038 QString sDoc;
00039 QString getReturnType() const {
00040 if( flags & GET_CONST_REFERENCE )
00041 return "const " + sType + "&";
00042 else
00043 return sType;
00044 }
00045 QString getArgumentType() const {
00046 if( flags & SET_CONST_REFERENCE )
00047 return "const " + sType + "&";
00048 else
00049 return sType;
00050 }
00051 };
00052
00053 class GenCppClass
00054 {
00055 public:
00056 GenCppClass(const QString &path = ""): mPath(path) {};
00057 virtual ~GenCppClass();
00059 void genClassGetSet(const QString &filename, const QString &classname,
00060 GetSetArray *array, int nelem, bool constructor);
00061 virtual void genDerivedClassGetSet(const QString &filename,
00062 const QString &basename, GetSetArray *arraybase, int nelembase,
00063 const QString &classname, GetSetArray *array, int nelem,
00064 bool constructor);
00065 virtual void genDebugPrint(const QString &filename, const QString &classname,
00066 GetSetArray *array, int nelem);
00067
00068 QString equivType(const QString &type);
00069 QString printfType(const QString &type);
00070 QString getDefaultLiteral(QString ctype, QString literal);
00071 protected:
00072 QString mPath;
00073 };
00074
00075 #endif
00076