28#ifndef __RenderSystemCapabilitiesSerializer_H__
29#define __RenderSystemCapabilitiesSerializer_H__
71 enum CapabilityKeywordType {UNDEFINED_CAPABILITY_TYPE = 0, SET_STRING_METHOD, SET_INT_METHOD, SET_BOOL_METHOD, SET_REAL_METHOD,
72 SET_CAPABILITY_ENUM_BOOL, ADD_SHADER_PROFILE_STRING};
105 mCapabilitiesMap.insert(CapabilitiesMap::value_type(name, cap));
122 mKeywordTypeMap.insert(KeywordTypeMap::value_type(keyword, type));
127 KeywordTypeMap::const_iterator it = mKeywordTypeMap.find(keyword);
128 if(it != mKeywordTypeMap.end())
132 logParseError(
"Can't find the type for keyword: " + keyword);
133 return UNDEFINED_CAPABILITY_TYPE;
139 mSetStringMethodDispatchTable.insert(SetStringMethodDispatchTable::value_type(keyword, method));
144 SetStringMethodDispatchTable::iterator methodIter = mSetStringMethodDispatchTable.find(keyword);
145 if (methodIter != mSetStringMethodDispatchTable.end())
147 SetStringMethod m = (*methodIter).second;
148 (mCurrentCapabilities->*m)(val);
152 logParseError(
"undefined keyword: " + keyword);
159 mSetIntMethodDispatchTable.insert(SetIntMethodDispatchTable::value_type(keyword, method));
164 SetIntMethodDispatchTable::iterator methodIter = mSetIntMethodDispatchTable.find(keyword);
165 if (methodIter != mSetIntMethodDispatchTable.end())
167 SetIntMethod m = (*methodIter).second;
168 (mCurrentCapabilities->*m)(val);
172 logParseError(
"undefined keyword: " + keyword);
179 mSetBoolMethodDispatchTable.insert(SetBoolMethodDispatchTable::value_type(keyword, method));
184 SetBoolMethodDispatchTable::iterator methodIter = mSetBoolMethodDispatchTable.find(keyword);
185 if (methodIter != mSetBoolMethodDispatchTable.end())
187 SetBoolMethod m = (*methodIter).second;
188 (mCurrentCapabilities->*m)(val);
192 logParseError(
"undefined keyword: " + keyword);
199 mSetRealMethodDispatchTable.insert(SetRealMethodDispatchTable::value_type(keyword, method));
204 SetRealMethodDispatchTable::iterator methodIter = mSetRealMethodDispatchTable.find(keyword);
205 if (methodIter != mSetRealMethodDispatchTable.end())
207 SetRealMethod m = (*methodIter).second;
208 (mCurrentCapabilities->*m)(val);
212 logParseError(
"undefined keyword: " + keyword);
218 mCurrentCapabilities->addShaderProfile(val);
224 if(mCapabilitiesMap.find(name) == mCapabilitiesMap.end())
226 logParseError(
"Undefined capability: " + name);
233 mCurrentCapabilities->setCapability(cap);
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Class for serializing RenderSystemCapabilities to / from a .rendercaps script.
void initialiaseDispatchTables()
SetIntMethodDispatchTable mSetIntMethodDispatchTable
map< String, SetStringMethod >::type SetStringMethodDispatchTable
void callSetRealMethod(String &keyword, Real val)
SetStringMethodDispatchTable mSetStringMethodDispatchTable
void writeScript(const RenderSystemCapabilities *caps, String name, String filename)
Writes a RenderSystemCapabilities object to a data stream.
void addSetRealMethod(String keyword, SetRealMethod method)
map< String, Capabilities >::type CapabilitiesMap
void callSetIntMethod(String &keyword, ushort val)
void parseScript(DataStreamPtr &stream)
Parses a RenderSystemCapabilities script file passed as a stream.
void addCapabilitiesMapping(String name, Capabilities cap)
void addShaderProfile(String &val)
map< String, SetRealMethod >::type SetRealMethodDispatchTable
SetBoolMethodDispatchTable mSetBoolMethodDispatchTable
void logParseError(const String &error) const
String writeString(const RenderSystemCapabilities *caps, String name)
Writes a RenderSystemCapabilities object to a string.
void addSetBoolMethod(String keyword, SetBoolMethod method)
CapabilitiesMap mCapabilitiesMap
void parseCapabilitiesLines(CapabilitiesLinesList &linesList)
virtual ~RenderSystemCapabilitiesSerializer()
default destructor
map< String, SetIntMethod >::type SetIntMethodDispatchTable
CapabilityKeywordType getKeywordType(const String &keyword) const
void addSetIntMethod(String keyword, SetIntMethod method)
void callSetStringMethod(String &keyword, String &val)
void setCapabilityEnumBool(String &name, bool val)
vector< std::pair< String, int > >::type CapabilitiesLinesList
map< String, SetBoolMethod >::type SetBoolMethodDispatchTable
RenderSystemCapabilitiesSerializer()
default constructor
map< String, CapabilityKeywordType >::type KeywordTypeMap
RenderSystemCapabilities * mCurrentCapabilities
KeywordTypeMap mKeywordTypeMap
void callSetBoolMethod(String &keyword, bool val)
void addKeywordType(String keyword, CapabilityKeywordType type)
void addSetStringMethod(String keyword, SetStringMethod method)
SetRealMethodDispatchTable mSetRealMethodDispatchTable
DataStreamPtr mCurrentStream
singleton class for storing the capabilities of the graphics card.
Capabilities
Enum describing the different hardware capabilities we want to check for OGRE_CAPS_VALUE(a,...
float Real
Software floating point type.
std::map< K, V, P, A > type