PageRenderTime 148ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcommon/metaproperty.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 73 lines | 23 code | 14 blank | 36 comment | 0 complexity | 312a2a1d7a961a7c008227974ebd35ee MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file metaproperty.h
  3. * @author Babbage
  4. * @date 2006-05-15
  5. * @brief Reflective meta information describing a property of 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_METAPROPERTY_H
  29. #define LL_METAPROPERTY_H
  30. #include "stdtypes.h"
  31. #include "llsd.h"
  32. #include "reflective.h"
  33. class LLMetaClass;
  34. class LLReflective;
  35. class LL_COMMON_API LLMetaProperty
  36. {
  37. public:
  38. LLMetaProperty(const std::string& name, const LLMetaClass& object_class);
  39. virtual ~LLMetaProperty();
  40. // Get property name.
  41. const std::string& getName() const {return mName;}
  42. // Get value of this property.
  43. virtual const LLReflective* get(const LLReflective* object) const = 0;
  44. // Set value of this property.
  45. // virtual void set(LLReflective* object, const LLReflective* value) = 0;
  46. // Get value of this property as LLSD. Default returns undefined LLSD.
  47. virtual LLSD getLLSD(const LLReflective* object) const = 0;
  48. // Get the MetaClass of legal values of this property.
  49. // const LLMetaClass& getValueMetaClass();
  50. // Get the meta class that this property is a member of.
  51. const LLMetaClass& getObjectMetaClass() const;
  52. protected:
  53. // Check object is instance of object class, throw exception if not.
  54. void checkObjectClass(const LLReflective* object) const;
  55. private:
  56. std::string mName;
  57. const LLMetaClass& mObjectClass;
  58. };
  59. #endif // LL_METAPROPERTY_H