1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
4 #include "Foundation.h"
8 //////////////////////////////////////////////////////////////////////////
9 CFoundation::CFoundation(const SGUID
& guid
, const char* name
)
14 //////////////////////////////////////////////////////////////////////////
15 SGUID
CFoundation::GetGUID() const
20 //////////////////////////////////////////////////////////////////////////
21 const char* CFoundation::GetName() const
23 return m_name
.c_str();
26 //////////////////////////////////////////////////////////////////////////
27 void CFoundation::SetDescription(const char* szDescription
)
29 m_description
= szDescription
;
32 //////////////////////////////////////////////////////////////////////////
33 const char* CFoundation::GetDescription() const
35 return m_description
.c_str();
38 //////////////////////////////////////////////////////////////////////////
39 void CFoundation::SetProperties(const IPropertiesPtr
& pProperties
)
41 m_pProperties
= pProperties
;
44 //////////////////////////////////////////////////////////////////////////
45 IPropertiesConstPtr
CFoundation::GetProperties() const
50 //////////////////////////////////////////////////////////////////////////
51 void CFoundation::UseNamespace(const char* szNamespace
)
53 CRY_ASSERT(szNamespace
&& szNamespace
[0]);
54 if(szNamespace
&& szNamespace
[0])
56 m_namespaces
.push_back(szNamespace
);
60 //////////////////////////////////////////////////////////////////////////
61 size_t CFoundation::GetNamespaceCount() const
63 return m_namespaces
.size();
66 //////////////////////////////////////////////////////////////////////////
67 const char* CFoundation::GetNamespace(size_t namespaceIdx
) const
69 return namespaceIdx
< m_namespaces
.size() ? m_namespaces
[namespaceIdx
].c_str() : "";
72 //////////////////////////////////////////////////////////////////////////
73 void CFoundation::AddAbstractInterface(const SGUID
& guid
)
75 m_abstractInterfaces
.push_back(guid
);
78 //////////////////////////////////////////////////////////////////////////
79 size_t CFoundation::GetAbstractInterfaceCount() const
81 return m_abstractInterfaces
.size();
84 //////////////////////////////////////////////////////////////////////////
85 SGUID
CFoundation::GetAbstractInterfaceGUID(size_t iAbstractInterface
) const
87 return iAbstractInterface
< m_abstractInterfaces
.size() ? m_abstractInterfaces
[iAbstractInterface
] : SGUID();
90 //////////////////////////////////////////////////////////////////////////
91 void CFoundation::AddComponent(const SGUID
& guid
)
93 m_components
.push_back(guid
);
96 //////////////////////////////////////////////////////////////////////////
97 size_t CFoundation::GetComponentCount() const
99 return m_components
.size();
102 //////////////////////////////////////////////////////////////////////////
103 SGUID
CFoundation::GetComponentGUID(size_t iComponent
) const
105 return iComponent
< m_components
.size() ? m_components
[iComponent
] : SGUID();
108 //////////////////////////////////////////////////////////////////////////
109 bool CFoundation::AddExtension_Protected(const EnvTypeId
& typeId
, const IFoundationExtensionPtr
& pExtension
)
111 if(QueryExtension_Protected(typeId
) == NULL
)
113 m_extensions
.insert(TExtensionMap::value_type(typeId
, pExtension
));
119 //////////////////////////////////////////////////////////////////////////
120 IFoundationExtensionPtr
CFoundation::QueryExtension_Protected(const EnvTypeId
& typeId
) const
122 TExtensionMap::const_iterator iExtension
= m_extensions
.find(typeId
);
123 return iExtension
!= m_extensions
.end() ? iExtension
->second
: IFoundationExtensionPtr();