PageRenderTime 17ms CodeModel.GetById 9ms app.highlight 6ms RepoModel.GetById 1ms 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
 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
29#ifndef LL_METACLASS_H
30#define LL_METACLASS_H
31
32#include <string>
33#include <map>
34
35#include "stdtypes.h"
36
37class LLReflective;
38class LLMetaProperty;
39class LLMetaMethod;
40class LL_COMMON_API LLMetaClass
41{
42public:
43
44	LLMetaClass();
45	virtual ~LLMetaClass();
46  
47	// Create instance of this MetaClass. NULL if class is abstract. 
48	// Gives ownership of returned object.
49	// virtual LLReflective* create() const = 0;
50  
51	// Returns named property or NULL.
52	const LLMetaProperty* findProperty(const std::string& name) const;
53  
54	// Add property to metaclass. Takes ownership of given property.
55	void addProperty(const LLMetaProperty* property);
56	
57	typedef std::map<std::string, const LLMetaProperty*>::const_iterator PropertyIterator;
58	
59	U32 getPropertyCount() const;
60	
61	PropertyIterator beginProperties() const;
62	PropertyIterator endProperties() const;
63  
64	// Returns named property or NULL.
65	// const LLMetaMethod* findMethod(const std::string& name) const;
66  
67	// Add method to metaclass. Takes ownership of given method.
68	// void addMethod(const LLMetaMethod* method);
69  
70	// Find MetaClass by name. NULL if name is unknown.
71	// static LLMetaClass* findClass(const std::string& name);
72	
73	// True if object is instance of this meta class.
74	bool isInstance(const LLReflective* object) const;
75  
76private:
77
78	typedef std::map<std::string, const LLMetaProperty*> PropertyMap;
79	PropertyMap mProperties;
80};
81
82#endif // LL_METACLASS_H