PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcommon/metaclass.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 81 lines | 40 code | 12 blank | 29 comment | 3 complexity | 465eee00efe1ba823b4a2ee206ddf717 MD5 | raw file
 1/** 
 2 * @file metaclass.cpp
 3 * @author Babbage
 4 * @date 2006-05-15
 5 * @brief Implementation of LLMetaClass
 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#include "linden_common.h" 
30
31#include "metaclass.h"
32
33#include "metaproperty.h"
34#include "reflective.h"
35
36LLMetaClass::LLMetaClass()
37{
38}
39
40//virtual 
41LLMetaClass::~LLMetaClass()
42{
43}
44
45const LLMetaProperty* LLMetaClass::findProperty(const std::string& name) const
46{
47	PropertyIterator iter = mProperties.find(name);
48	if(iter == mProperties.end())
49	{
50		return NULL;
51	}
52	return (*iter).second;
53}
54
55void LLMetaClass::addProperty(const LLMetaProperty* property)
56{
57	mProperties.insert(std::make_pair(property->getName(), property));
58}
59
60U32 LLMetaClass::getPropertyCount() const
61{
62	return mProperties.size();
63}
64
65LLMetaClass::PropertyIterator LLMetaClass::beginProperties() const
66{
67	return mProperties.begin();
68}
69
70LLMetaClass::PropertyIterator LLMetaClass::endProperties() const
71{
72	return mProperties.end();
73}
74
75bool LLMetaClass::isInstance(const LLReflective* object) const
76{
77	// TODO: Babbage: Search through super classes of objects MetaClass.
78	const LLMetaClass* object_meta_class = &(object->getMetaClass());
79	return (object_meta_class == this);
80}
81