00001 #ifndef ATTRIBUTE_H 00002 #define ATTRIBUTE_H 00003 00004 #include "Any.h" 00005 #include "logger.h" 00006 class FCO; 00007 00008 class AttributeRep : public Any 00009 { 00010 public: 00011 typedef enum { 00012 ENUM, 00013 BOOL, 00014 FIELD 00015 } ATTR_TYPE; 00016 00017 AttributeRep( BON::FCO& ptr); 00018 virtual ~AttributeRep(); 00019 /*virtual*/ inline Any::KIND_TYPE getMyKind() const { return Any::ATTRIBUTE; } 00020 /*virtual*/ std::string getName() const; 00021 /*virtual*/ std::string doDump() { return ""; } 00022 00023 virtual std::string doDumpAttr(const std::string& mm = "") = 0; 00024 virtual ATTR_TYPE getType() = 0; 00025 00026 bool isGlobal(); 00027 bool isViewable(); 00028 std::string getPrompt(); 00029 std::string getMetaRef(const std::string & owner); 00030 std::string dumpHelp(); 00031 void getXY( unsigned int * x, unsigned int *y) const; 00032 bool lessThan( const AttributeRep * rep) const; 00033 00034 void addOwner( FCO * owner_fco); 00035 int hasAnyOwner() const; 00036 00037 protected: 00038 ATTR_TYPE attr; 00039 std::vector<FCO*> m_ownerList; 00040 00041 private: 00042 AttributeRep( const AttributeRep&); 00043 const AttributeRep& operator=( const AttributeRep &); 00044 }; 00045 00046 00047 class EnumAttributeRep : public AttributeRep 00048 { 00049 public: 00050 EnumAttributeRep( BON::FCO& ptr); 00051 virtual ~EnumAttributeRep() { } 00052 ATTR_TYPE getType() { return ENUM; } 00053 bool getMenuItems(); 00054 /*virtual*/ std::string doDumpAttr(const std::string& mm = ""); 00055 00056 protected: 00057 std::vector<std::string> m_items; 00058 std::vector<std::string> m_itemsVal; 00059 int m_noOfItems; 00060 int m_noOfDefault; 00061 }; 00062 00063 class BoolAttributeRep : public AttributeRep 00064 { 00065 public: 00066 BoolAttributeRep( BON::FCO& ptr): AttributeRep( ptr) { } 00067 virtual ~BoolAttributeRep() { } 00068 ATTR_TYPE getType() { return BOOL; } 00069 /*virtual*/ std::string doDumpAttr(const std::string& mm = ""); 00070 }; 00071 00072 class FieldAttributeRep : public AttributeRep 00073 { 00074 public: 00075 FieldAttributeRep( BON::FCO& ptr): AttributeRep( ptr) { } 00076 virtual ~FieldAttributeRep() { } 00077 ATTR_TYPE getType() { return FIELD; } 00078 /*virtual*/ std::string doDumpAttr(const std::string& mm = ""); 00079 }; 00080 00081 #endif // ATTRIBUTE_H 00082