- Timestamp:
- Aug 21, 2010, 9:52:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/ConsoleCommand.h
r7186 r7198 88 88 { 89 89 public: 90 ConsoleCommand( Functor*functor, const std::string& name = "");90 ConsoleCommand(const FunctorPtr& functor, const std::string& name = ""); 91 91 92 92 ConsoleCommand& description(const std::string& description); … … 159 159 }; 160 160 161 inline ConsoleCommand* createConsoleCommand( Functor*functor, const std::string& name = "")161 inline ConsoleCommand* createConsoleCommand(const FunctorPtr& functor, const std::string& name = "") 162 162 { 163 163 return new ConsoleCommand(functor, name); … … 212 212 inline _ConsoleCommandManipulator& setFunction(F function, O* object, bool bForce = false) 213 213 { if (this->command_) { this->command_->setFunctor(createFunctor(function, object), bForce); } return *this; } 214 inline _ConsoleCommandManipulator& setFunction( Functor*functor, bool bForce = false)214 inline _ConsoleCommandManipulator& setFunction(const FunctorPtr& functor, bool bForce = false) 215 215 { if (this->command_) { this->command_->setFunctor(functor, bForce); } return *this; } 216 216 … … 221 221 inline _ConsoleCommandManipulator& pushFunction(F function, O* object, bool bForce = false) 222 222 { if (this->command_) { this->command_->pushFunctor(createFunctor(function, object), bForce); } return *this; } 223 inline _ConsoleCommandManipulator& pushFunction( Functor*functor, bool bForce = false)223 inline _ConsoleCommandManipulator& pushFunction(const FunctorPtr& functor, bool bForce = false) 224 224 { if (this->command_) { this->command_->pushFunctor(functor, bForce); } return *this; } 225 225 … … 245 245 246 246 public: 247 _ConsoleCommand(const std::string& group, const std::string& name, Functor*functor, bool bInitialized = true);247 _ConsoleCommand(const std::string& group, const std::string& name, const FunctorPtr& functor, bool bInitialized = true); 248 248 249 249 _ConsoleCommand& addShortcut(); … … 271 271 static void registerCommand(const std::string& group, const std::string& name, _ConsoleCommand* command); 272 272 273 bool setFunctor( Functor*functor, bool bForce = false);274 void pushFunctor( Functor*functor, bool bForce = false);273 bool setFunctor(const FunctorPtr& functor, bool bForce = false); 274 void pushFunctor(const FunctorPtr& functor, bool bForce = false); 275 275 void popFunctor(); 276 Functor*getFunctor() const;277 278 bool functionHeaderMatches( Functor*functor) const;276 const FunctorPtr& getFunctor() const; 277 278 bool functionHeaderMatches(const FunctorPtr& functor) const; 279 279 280 280 void setObject(void* object); … … 286 286 bool bInitialized_; 287 287 const std::type_info& functionHeader_; 288 std::stack<Functor *> functorStack_;288 std::stack<FunctorPtr> functorStack_; 289 289 std::stack<void*> objectStack_; 290 290 }; 291 291 292 inline _ConsoleCommand* _createConsoleCommand(const std::string& name, Functor*functor, bool bInitialized = true)292 inline _ConsoleCommand* _createConsoleCommand(const std::string& name, const FunctorPtr& functor, bool bInitialized = true) 293 293 { 294 294 return new _ConsoleCommand("", name, functor, bInitialized); 295 295 } 296 296 297 inline _ConsoleCommand* _createConsoleCommand(const std::string& group, const std::string& name, Functor*functor, bool bInitialized = true)297 inline _ConsoleCommand* _createConsoleCommand(const std::string& group, const std::string& name, const FunctorPtr& functor, bool bInitialized = true) 298 298 { 299 299 return new _ConsoleCommand(group, name, functor, bInitialized);
Note: See TracChangeset
for help on using the changeset viewer.