[Scummvm-cvs-logs] SF.net SVN: scummvm:[49396] tools/branches/gsoc2010-decompiler/decompiler
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Wed Jun 2 20:11:09 CEST 2010
Revision: 49396
http://scummvm.svn.sourceforge.net/scummvm/?rev=49396&view=rev
Author: lordhoto
Date: 2010-06-02 18:11:09 +0000 (Wed, 02 Jun 2010)
Log Message:
-----------
Made some methods const.
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/instruction.h
tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/instruction.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/instruction.h 2010-06-02 17:04:55 UTC (rev 49395)
+++ tools/branches/gsoc2010-decompiler/decompiler/instruction.h 2010-06-02 18:11:09 UTC (rev 49396)
@@ -65,9 +65,9 @@
struct Parameter {
ParamType _type; ///<Type of the parameter.
boost::variant<int32, uint32, std::string> _value; ///<Value of the parameter.
- int32 getSigned() { return boost::get<int32>(_value); }
- uint32 getUnsigned() { return boost::get<uint32>(_value); }
- std::string getString() { return boost::get<std::string>(_value); }
+ int32 getSigned() const { return boost::get<int32>(_value); }
+ uint32 getUnsigned() const { return boost::get<uint32>(_value); }
+ std::string getString() const { return boost::get<std::string>(_value); }
};
/**
Modified: tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h 2010-06-02 17:04:55 UTC (rev 49395)
+++ tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h 2010-06-02 18:11:09 UTC (rev 49396)
@@ -44,7 +44,8 @@
private:
typedef BaseType *(*CreateFunc)(); ///<Function pointer to the object creation function.
- std::map<std::string, CreateFunc> _registry; ///<Map from an identifier to a creation function.
+ typedef std::map<std::string, CreateFunc> RegistryMap;
+ RegistryMap _registry; ///<Map from an identifier to a creation function.
public:
/**
@@ -61,10 +62,11 @@
* @param name The name associated with the desired class.
* @return NULL if the name is not registered, else an instance of the associated class.
*/
- BaseType *create(std::string name) {
- if (_registry.find(name) == _registry.end())
+ BaseType *create(std::string name) const {
+ typename RegistryMap::const_iterator entry = _registry.find(name);
+ if (entry == _registry.end())
return NULL;
- return _registry[name]();
+ return (entry->second)();
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list