PageRenderTime 23ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llcommon/metaclass.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 82 lines | 25 code | 18 blank | 39 comment | 0 complexity | 1974a2aa29ca3cd0451ff2737c035d3c MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file metaclass.h
  3. * @author Babbage
  4. * @date 2006-05-15
  5. * @brief Reflective meta information describing a class.
  6. *
  7. * $LicenseInfo:firstyear=2006&license=viewerlgpl$
  8. * Second Life Viewer Source Code
  9. * Copyright (C) 2010, Linden Research, Inc.
  10. *
  11. * This library is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public
  13. * License as published by the Free Software Foundation;
  14. * version 2.1 of the License only.
  15. *
  16. * This library is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with this library; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. *
  25. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  26. * $/LicenseInfo$
  27. */
  28. #ifndef LL_METACLASS_H
  29. #define LL_METACLASS_H
  30. #include <string>
  31. #include <map>
  32. #include "stdtypes.h"
  33. class LLReflective;
  34. class LLMetaProperty;
  35. class LLMetaMethod;
  36. class LL_COMMON_API LLMetaClass
  37. {
  38. public:
  39. LLMetaClass();
  40. virtual ~LLMetaClass();
  41. // Create instance of this MetaClass. NULL if class is abstract.
  42. // Gives ownership of returned object.
  43. // virtual LLReflective* create() const = 0;
  44. // Returns named property or NULL.
  45. const LLMetaProperty* findProperty(const std::string& name) const;
  46. // Add property to metaclass. Takes ownership of given property.
  47. void addProperty(const LLMetaProperty* property);
  48. typedef std::map<std::string, const LLMetaProperty*>::const_iterator PropertyIterator;
  49. U32 getPropertyCount() const;
  50. PropertyIterator beginProperties() const;
  51. PropertyIterator endProperties() const;
  52. // Returns named property or NULL.
  53. // const LLMetaMethod* findMethod(const std::string& name) const;
  54. // Add method to metaclass. Takes ownership of given method.
  55. // void addMethod(const LLMetaMethod* method);
  56. // Find MetaClass by name. NULL if name is unknown.
  57. // static LLMetaClass* findClass(const std::string& name);
  58. // True if object is instance of this meta class.
  59. bool isInstance(const LLReflective* object) const;
  60. private:
  61. typedef std::map<std::string, const LLMetaProperty*> PropertyMap;
  62. PropertyMap mProperties;
  63. };
  64. #endif // LL_METACLASS_H