00001 00034 #ifndef LL_METACLASS_H 00035 #define LL_METACLASS_H 00036 00037 #include <string> 00038 #include <map> 00039 00040 #include "stdtypes.h" 00041 00042 class LLReflective; 00043 class LLMetaProperty; 00044 class LLMetaMethod; 00045 class LLMetaClass 00046 { 00047 public: 00048 00049 LLMetaClass(); 00050 virtual ~LLMetaClass(); 00051 00052 // Create instance of this MetaClass. NULL if class is abstract. 00053 // Gives ownership of returned object. 00054 // virtual LLReflective* create() const = 0; 00055 00056 // Returns named property or NULL. 00057 const LLMetaProperty* findProperty(const std::string& name) const; 00058 00059 // Add property to metaclass. Takes ownership of given property. 00060 void addProperty(const LLMetaProperty* property); 00061 00062 typedef std::map<std::string, const LLMetaProperty*>::const_iterator PropertyIterator; 00063 00064 U32 getPropertyCount() const; 00065 00066 PropertyIterator beginProperties() const; 00067 PropertyIterator endProperties() const; 00068 00069 // Returns named property or NULL. 00070 // const LLMetaMethod* findMethod(const std::string& name) const; 00071 00072 // Add method to metaclass. Takes ownership of given method. 00073 // void addMethod(const LLMetaMethod* method); 00074 00075 // Find MetaClass by name. NULL if name is unknown. 00076 // static LLMetaClass* findClass(const std::string& name); 00077 00078 // True if object is instance of this meta class. 00079 bool isInstance(const LLReflective* object) const; 00080 00081 private: 00082 00083 typedef std::map<std::string, const LLMetaProperty*> PropertyMap; 00084 PropertyMap mProperties; 00085 }; 00086 00087 #endif // LL_METACLASS_H