00001 #ifndef ATTRIBUTE_H 00002 #define ATTRIBUTE_H 00003 00004 #include "Any.h" 00005 #include "Method.h" 00006 #include "logger.h" 00007 class FCO; 00008 00009 class AttributeRep : public Any 00010 { 00011 public: 00012 typedef enum { 00013 ENUM, 00014 BOOL, 00015 FIELD 00016 } ATTR_TYPE; 00017 00018 AttributeRep( BON::FCO& ptr); 00019 virtual ~AttributeRep(); 00020 /*virtual*/ inline Any::KIND_TYPE getMyKind() const { return Any::ATTRIBUTE; } 00021 /*virtual*/ std::string doDump() { return ""; } 00022 virtual Method createMethodForAttr( FCO* ) = 0; 00023 virtual Method createSetMethodForAttr( FCO* ) = 0; 00024 virtual std::string doDumpErroneousAttrHdr() = 0; 00025 virtual std::string doDumpErroneousAttrSrc( FCO*) = 0; 00026 00027 virtual ATTR_TYPE getType() = 0; 00028 00029 bool isGlobal(); 00030 bool isViewable(); 00031 std::string getPrompt(); 00032 std::string getNameToUse(); 00033 virtual std::string getMethodName() = 0; 00034 virtual std::string getSetMethodName() = 0; 00035 00036 void addOwner( FCO * owner_fco); 00037 int hasAnyOwner() const; 00038 00039 protected: 00040 ATTR_TYPE attr; 00041 std::vector<FCO*> m_ownerList; 00042 00043 private: 00044 AttributeRep( const AttributeRep&); 00045 const AttributeRep& operator=( const AttributeRep &); 00046 }; 00047 00048 00049 class EnumAttributeRep : public AttributeRep 00050 { 00051 public: 00052 EnumAttributeRep( BON::FCO& ptr); 00053 virtual ~EnumAttributeRep() { } 00054 ATTR_TYPE getType() { return ENUM; } 00055 bool getMenuItems(); 00056 /*virtual*/ std::string doDumpErroneousAttrHdr(); 00057 /*virtual*/ std::string doDumpErroneousAttrSrc( FCO*); 00058 /*virtual*/ Method createMethodForAttr( FCO* ); 00059 /*virtual*/ Method createSetMethodForAttr( FCO* ); 00060 /*virtual*/ std::string getMethodName(); 00061 /*virtual*/ std::string getSetMethodName(); 00062 /*static*/ std::string enumTypeName( EnumAttributeRep * a); 00063 protected: 00064 std::vector<std::string> m_items; 00065 std::vector<std::string> m_itemsVal; 00066 int m_noOfItems; 00067 int m_noOfDefault; 00068 }; 00069 00070 class BoolAttributeRep : public AttributeRep 00071 { 00072 public: 00073 BoolAttributeRep( BON::FCO& ptr): AttributeRep( ptr) { } 00074 virtual ~BoolAttributeRep() { } 00075 ATTR_TYPE getType() { return BOOL; } 00076 /*virtual*/ std::string doDumpErroneousAttrHdr(); 00077 /*virtual*/ std::string doDumpErroneousAttrSrc( FCO*); 00078 /*virtual*/ Method createMethodForAttr( FCO* ); 00079 /*virtual*/ Method createSetMethodForAttr( FCO* ); 00080 /*virtual*/ std::string getMethodName(); 00081 /*virtual*/ std::string getSetMethodName(); 00082 }; 00083 00084 class FieldAttributeRep : public AttributeRep 00085 { 00086 public: 00087 FieldAttributeRep( BON::FCO& ptr): AttributeRep( ptr) { } 00088 virtual ~FieldAttributeRep() { } 00089 ATTR_TYPE getType() { return FIELD; } 00090 /*virtual*/ std::string doDumpErroneousAttrHdr(); 00091 /*virtual*/ std::string doDumpErroneousAttrSrc( FCO*); 00092 /*virtual*/ Method createMethodForAttr( FCO* ); 00093 /*virtual*/ Method createSetMethodForAttr( FCO* ); 00094 std::string getTypeStr(); 00095 std::string getSetTypeStr(); 00096 std::string getMethodStr(); 00097 /*virtual*/ std::string getMethodName(); 00098 /*virtual*/ std::string getSetMethodName(); 00099 }; 00100 00101 #endif // ATTRIBUTE_H 00102