PageRenderTime 3ms CodeModel.GetById 14ms app.highlight 5ms 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
 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
29#ifndef LL_METAPROPERTY_H
30#define LL_METAPROPERTY_H
31
32#include "stdtypes.h"
33#include "llsd.h"
34#include "reflective.h"
35
36class LLMetaClass;
37class LLReflective;
38class LL_COMMON_API LLMetaProperty
39{
40public:
41	LLMetaProperty(const std::string& name, const LLMetaClass& object_class);
42  virtual ~LLMetaProperty();
43  
44  // Get property name.
45  const std::string& getName() const {return mName;}
46
47  // Get value of this property.
48  virtual const LLReflective* get(const LLReflective* object) const = 0;
49  
50  // Set value of this property.
51  // virtual void set(LLReflective* object, const LLReflective* value) = 0;
52  
53  // Get value of this property as LLSD. Default returns undefined LLSD.
54  virtual LLSD getLLSD(const LLReflective* object) const = 0;
55  
56  // Get the MetaClass of legal values of this property.
57  // const LLMetaClass& getValueMetaClass();
58  
59  // Get the meta class that this property is a member of.
60  const LLMetaClass& getObjectMetaClass() const;
61
62protected:
63
64  // Check object is instance of object class, throw exception if not.
65  void checkObjectClass(const LLReflective* object) const;
66
67private:
68
69	std::string mName;
70	const LLMetaClass& mObjectClass;
71};
72
73#endif // LL_METAPROPERTY_H