Ver código fonte

Renaming ControlCreator into ControlActivator and correcting missing
return value in ControlFactory::registerCustomControl

SAUVAGEOT Paul-Arthur 12 anos atrás
pai
commit
1f86e80080
2 arquivos alterados com 6 adições e 5 exclusões
  1. 3 2
      gameplay/src/ControlFactory.cpp
  2. 3 3
      gameplay/src/ControlFactory.h

+ 3 - 2
gameplay/src/ControlFactory.cpp

@@ -26,14 +26,15 @@ namespace gameplay {
 		return instance;
 		return instance;
 	}
 	}
 
 
-	bool ControlFactory::registerCustomControl(const std::string &name, ControlCreator controlCreator) {
+	bool ControlFactory::registerCustomControl(const std::string &name, ControlActivator controlCreator) {
 		if (_registeredControls.find(name) != _registeredControls.end())
 		if (_registeredControls.find(name) != _registeredControls.end())
 			return false;
 			return false;
 		_registeredControls[name] = controlCreator;
 		_registeredControls[name] = controlCreator;
+		return true;
 	}
 	}
 
 
 	void ControlFactory::unregisterCustomControl(const std::string &name) {
 	void ControlFactory::unregisterCustomControl(const std::string &name) {
-		std::map<std::string, ControlCreator>::iterator it;
+		std::map<std::string, ControlActivator>::iterator it;
 
 
 		if ((it = _registeredControls.find(name)) != _registeredControls.end())
 		if ((it = _registeredControls.find(name)) != _registeredControls.end())
 			_registeredControls.erase(it);
 			_registeredControls.erase(it);

+ 3 - 3
gameplay/src/ControlFactory.h

@@ -14,16 +14,16 @@ namespace gameplay {
 	class ControlFactory {
 	class ControlFactory {
 		
 		
 		public :
 		public :
-			typedef Control *(*ControlCreator)(Theme::Style *, Properties *, Theme *);
+			typedef Control *(*ControlActivator)(Theme::Style *, Properties *, Theme *);
 
 
 			static ControlFactory	&getInstance();
 			static ControlFactory	&getInstance();
 
 
-			bool					registerCustomControl(const std::string &controlName, ControlCreator controlCreator);
+			bool					registerCustomControl(const std::string &controlName, ControlActivator controlCreator);
 			void					unregisterCustomControl(const std::string &controlName);
 			void					unregisterCustomControl(const std::string &controlName);
 			Control					*createControl(const std::string &controlName, Theme::Style *style, Properties *properties, Theme *theme = NULL);
 			Control					*createControl(const std::string &controlName, Theme::Style *style, Properties *properties, Theme *theme = NULL);
 
 
 		private :
 		private :
-			std::map<std::string, ControlCreator>	_registeredControls;
+			std::map<std::string, ControlActivator>	_registeredControls;
 			
 			
 			ControlFactory();
 			ControlFactory();
 			ControlFactory(const ControlFactory &);
 			ControlFactory(const ControlFactory &);