Changeset 10765 for code/branches/cpp11_v2/src/libraries
- Timestamp:
- Nov 4, 2015, 10:25:42 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries
- Files:
-
- 78 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/ApplicationPaths.cc
r10624 r10765 84 84 // get executable module 85 85 TCHAR buffer[1024]; 86 if (GetModuleFileName( NULL, buffer, 1024) == 0)86 if (GetModuleFileName(nullptr, buffer, 1024) == 0) 87 87 ThrowException(General, "Could not retrieve executable path."); 88 88 -
code/branches/cpp11_v2/src/libraries/core/BaseObject.cc
r10624 r10765 205 205 Template* link; 206 206 assert(!(link = Template::getTemplate(temp->getLink())) || !link->isLink()); 207 link = NULL;207 link = nullptr; 208 208 } 209 209 else -
code/branches/cpp11_v2/src/libraries/core/BaseObject.h
r10624 r10765 265 265 return this->weakPtr_; 266 266 else 267 return NULL;267 return nullptr; 268 268 } 269 269 -
code/branches/cpp11_v2/src/libraries/core/ConfigurablePaths.cc
r10624 r10765 122 122 char* userDataPathPtr(getenv("APPDATA")); 123 123 #endif 124 if (userDataPathPtr == NULL)124 if (userDataPathPtr == nullptr) 125 125 ThrowException(General, "Could not retrieve user data path."); 126 126 bf::path userDataPath(userDataPathPtr); -
code/branches/cpp11_v2/src/libraries/core/Core.cc
r10624 r10765 95 95 96 96 Core::Core(const std::string& cmdLine) 97 : applicationPaths_( NULL)98 , configurablePaths_( NULL)99 , dynLibManager_( NULL)100 , signalHandler_( NULL)101 , configFileManager_( NULL)102 , languageInstance_( NULL)103 , loaderInstance_( NULL)104 , ioConsole_( NULL)105 , tclBind_( NULL)106 , tclThreadManager_( NULL)107 , rootScope_( NULL)108 , graphicsManager_( NULL)109 , inputManager_( NULL)110 , guiManager_( NULL)111 , graphicsScope_( NULL)97 : applicationPaths_(nullptr) 98 , configurablePaths_(nullptr) 99 , dynLibManager_(nullptr) 100 , signalHandler_(nullptr) 101 , configFileManager_(nullptr) 102 , languageInstance_(nullptr) 103 , loaderInstance_(nullptr) 104 , ioConsole_(nullptr) 105 , tclBind_(nullptr) 106 , tclThreadManager_(nullptr) 107 , rootScope_(nullptr) 108 , graphicsManager_(nullptr) 109 , inputManager_(nullptr) 110 , guiManager_(nullptr) 111 , graphicsScope_(nullptr) 112 112 , bGraphicsLoaded_(false) 113 , staticInitHandler_( NULL)114 , pluginManager_( NULL)115 , rootModule_( NULL)116 , config_( NULL)113 , staticInitHandler_(nullptr) 114 , pluginManager_(nullptr) 115 , rootModule_(nullptr) 116 , config_(nullptr) 117 117 , destructionHelper_(this) 118 118 { … … 176 176 177 177 // initialize root context 178 Context::setRootContext(new Context( NULL));178 Context::setRootContext(new Context(nullptr)); 179 179 180 180 // Do this soon after the ConfigFileManager has been created to open up the … … 326 326 module->deleteAllStaticallyInitializedInstances(); 327 327 this->dynLibManager_->unload(module->getDynLib()); 328 module->setDynLib( NULL);328 module->setDynLib(nullptr); 329 329 } 330 330 … … 471 471 } 472 472 // Process console events and status line 473 if (this->ioConsole_ != NULL)473 if (this->ioConsole_ != nullptr) 474 474 this->ioConsole_->preUpdate(time); 475 475 // Process thread commands -
code/branches/cpp11_v2/src/libraries/core/CoreConfig.cc
r10624 r10765 137 137 void CoreConfig::updateLastLevelTimestamp() 138 138 { 139 ModifyConfigValue(lastLevelTimestamp_, set, static_cast<long long>(time( NULL)));139 ModifyConfigValue(lastLevelTimestamp_, set, static_cast<long long>(time(nullptr))); 140 140 } 141 141 142 142 void CoreConfig::updateOgreConfigTimestamp() 143 143 { 144 ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time( NULL)));144 ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(nullptr))); 145 145 } 146 146 -
code/branches/cpp11_v2/src/libraries/core/CoreIncludes.h
r10624 r10765 120 120 */ 121 121 #define RegisterAbstractClass(ClassName) \ 122 RegisterClassWithFactory(ClassName, static_cast<ClassFactory<ClassName>*>( NULL), false)122 RegisterClassWithFactory(ClassName, static_cast<ClassFactory<ClassName>*>(nullptr), false) 123 123 124 124 /** -
code/branches/cpp11_v2/src/libraries/core/GUIManager.cc
r10624 r10765 268 268 */ 269 269 GUIManager::GUIManager(const std::pair<int, int>& mousePosition) 270 : guiRenderer_( NULL)271 , resourceProvider_( NULL)270 : guiRenderer_(nullptr) 271 , resourceProvider_(nullptr) 272 272 #ifndef ORXONOX_OLD_CEGUI 273 , rqListener_( NULL)274 , imageCodec_( NULL)275 #endif 276 , luaState_( NULL)277 , scriptModule_( NULL)278 , guiSystem_( NULL)279 , ceguiLogger_( NULL)280 , rootWindow_( NULL)281 , hudRootWindow_( NULL)282 , menuRootWindow_( NULL)283 , camera_( NULL)273 , rqListener_(nullptr) 274 , imageCodec_(nullptr) 275 #endif 276 , luaState_(nullptr) 277 , scriptModule_(nullptr) 278 , guiSystem_(nullptr) 279 , ceguiLogger_(nullptr) 280 , rootWindow_(nullptr) 281 , hudRootWindow_(nullptr) 282 , menuRootWindow_(nullptr) 283 , camera_(nullptr) 284 284 , destructionHelper_(this) 285 285 { … … 467 467 { 468 468 #ifdef ORXONOX_OLD_CEGUI 469 if (camera == NULL)469 if (camera == nullptr) 470 470 this->guiRenderer_->setTargetSceneManager(0); 471 471 else 472 472 this->guiRenderer_->setTargetSceneManager(camera->getSceneManager()); 473 473 #else 474 if (camera_ != NULL && camera_->getSceneManager() != NULL)474 if (camera_ != nullptr && camera_->getSceneManager() != nullptr) 475 475 camera_->getSceneManager()->removeRenderQueueListener(rqListener_); 476 if (camera != NULL && camera->getSceneManager() != NULL)476 if (camera != nullptr && camera->getSceneManager() != nullptr) 477 477 camera->getSceneManager()->addRenderQueueListener(rqListener_); 478 478 #endif … … 876 876 return; 877 877 878 CEGUI::Font* font = NULL;878 CEGUI::Font* font = nullptr; 879 879 CEGUI::XMLAttributes xmlAttributes; 880 880 … … 892 892 893 893 font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes); 894 if(font != NULL)894 if(font != nullptr) 895 895 font->load(); 896 896 #else -
code/branches/cpp11_v2/src/libraries/core/Game.cc
r10624 r10765 77 77 78 78 Game::Game(const std::string& cmdLine) 79 : gameClock_( NULL)80 , core_( NULL)79 : gameClock_(nullptr) 80 , core_(nullptr) 81 81 , bChangingState_(false) 82 82 , bAbort_(false) 83 , config_( NULL)83 , config_(nullptr) 84 84 , destructionHelper_(this) 85 85 { … … 398 398 // Check parent and all its grand parents 399 399 shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode; 400 while (currentNode != NULL)400 while (currentNode != nullptr) 401 401 { 402 402 if (currentNode->name_ == name) … … 405 405 requestedNodes.push_back(currentNode); 406 406 } 407 if (currentNode == NULL)407 if (currentNode == nullptr) 408 408 requestedNodes.clear(); 409 409 } -
code/branches/cpp11_v2/src/libraries/core/GraphicsManager.cc
r10624 r10765 178 178 void GraphicsManager::upgradeToGraphics() 179 179 { 180 if (renderWindow_ != NULL)180 if (renderWindow_ != nullptr) 181 181 return; 182 182 -
code/branches/cpp11_v2/src/libraries/core/GraphicsManager.h
r10624 r10765 96 96 void loadDebugOverlay(); 97 97 void unloadDebugOverlay(); 98 bool rendererLoaded() const { return renderWindow_ != NULL; }98 bool rendererLoaded() const { return renderWindow_ != nullptr; } 99 99 100 100 void setCamera(Ogre::Camera* camera); -
code/branches/cpp11_v2/src/libraries/core/Loader.cc
r10624 r10765 89 89 { 90 90 shared_ptr<ResourceInfo> info = Resource::getInfo(file->getFilename()); 91 if (info == NULL)91 if (info == nullptr) 92 92 { 93 93 orxout(user_error, context::loader) << "Could not find XML file '" << file->getFilename() << "'." << endl; -
code/branches/cpp11_v2/src/libraries/core/LuaState.cc
r10265 r10765 48 48 LuaState::LuaState() 49 49 : bIsRunning_(false) 50 , includeParseFunction_( NULL)50 , includeParseFunction_(nullptr) 51 51 { 52 52 // Create new lua state and configure it … … 84 84 shared_ptr<ResourceInfo> sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename); 85 85 // Continue search in root directories 86 if (sourceInfo == NULL&& !sourceFileInfo_->path.empty())86 if (sourceInfo == nullptr && !sourceFileInfo_->path.empty()) 87 87 sourceInfo = Resource::getInfo(filename); 88 88 return sourceInfo; … … 92 92 { 93 93 shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename); 94 if (sourceInfo != NULL)94 if (sourceInfo != nullptr) 95 95 return this->includeString(Resource::open(sourceInfo)->getAsString(), sourceInfo); 96 96 else … … 105 105 // Parse string with provided include parser (otherwise don't preparse at all) 106 106 std::string luaInput; 107 if (includeParseFunction_ != NULL)107 if (includeParseFunction_ != nullptr) 108 108 luaInput = (*includeParseFunction_)(code); 109 109 else 110 110 luaInput = code; 111 111 112 if (sourceFileInfo != NULL)112 if (sourceFileInfo != nullptr) 113 113 { 114 114 // Also fill a map with the actual source code. This is just for the include* commands … … 119 119 bool returnValue = this->doString(luaInput, sourceFileInfo); 120 120 121 if (sourceFileInfo != NULL)121 if (sourceFileInfo != nullptr) 122 122 { 123 123 // Delete source code entry 124 if (sourceFileInfo != NULL)124 if (sourceFileInfo != nullptr) 125 125 this->sourceCodeMap_.erase(sourceFileInfo->filename); 126 126 } … … 132 132 { 133 133 shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename); 134 if (sourceInfo != NULL)134 if (sourceInfo != nullptr) 135 135 return this->doString(Resource::open(sourceInfo)->getAsString(), sourceInfo); 136 136 else … … 146 146 shared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_; 147 147 // Only override if sourceFileInfo provides useful information 148 if (sourceFileInfo != NULL)148 if (sourceFileInfo != nullptr) 149 149 sourceFileInfo_ = sourceFileInfo; 150 150 151 151 std::string chunkname; 152 if (sourceFileInfo != NULL)152 if (sourceFileInfo != nullptr) 153 153 { 154 154 // Provide lua_load with the filename for debug purposes … … 286 286 { 287 287 shared_ptr<ResourceInfo> info = this->getFileInfo(filename); 288 if (info == NULL)288 if (info == nullptr) 289 289 return false; 290 290 else … … 301 301 return it->second; 302 302 shared_ptr<ResourceInfo> info = Resource::getInfo(filename); 303 if (info == NULL)303 if (info == nullptr) 304 304 return ""; 305 305 else -
code/branches/cpp11_v2/src/libraries/core/Resource.cc
r9675 r10765 102 102 ptr->size = it->uncompressedSize; 103 103 #if OGRE_VERSION >= 0x010800 104 if (dynamic_cast<const Ogre::FileSystemArchive*>(it->archive) != NULL)104 if (dynamic_cast<const Ogre::FileSystemArchive*>(it->archive) != nullptr) 105 105 #else 106 if (dynamic_cast<Ogre::FileSystemArchive*>(it->archive) != NULL)106 if (dynamic_cast<Ogre::FileSystemArchive*>(it->archive) != nullptr) 107 107 #endif 108 108 { -
code/branches/cpp11_v2/src/libraries/core/class/Identifiable.h
r9667 r10765 98 98 registered in the class hierarchy. 99 99 @return 100 Returns NULLif the no pointer was found.100 Returns nullptr if the no pointer was found. 101 101 */ 102 102 ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID) … … 107 107 return this->objectPointers_[i].second; 108 108 } 109 return NULL;109 return nullptr; 110 110 } 111 111 -
code/branches/cpp11_v2/src/libraries/core/class/Identifier.h
r10624 r10765 279 279 ClassIdentifier(const std::string& name, Factory* factory, bool bLoadable) : Identifier(name, factory, bLoadable) 280 280 { 281 OrxVerify(ClassIdentifier<T>::classIdentifier_s == NULL, "Assertion failed in ClassIdentifier of type " << typeid(T).name());281 OrxVerify(ClassIdentifier<T>::classIdentifier_s == nullptr, "Assertion failed in ClassIdentifier of type " << typeid(T).name()); 282 282 ClassIdentifier<T>::classIdentifier_s = this; 283 283 … … 334 334 /*static*/ inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier() 335 335 { 336 if (ClassIdentifier<T>::classIdentifier_s == NULL)336 if (ClassIdentifier<T>::classIdentifier_s == nullptr) 337 337 ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*) IdentifierManager::getInstance().getIdentifierByTypeInfo(typeid(T)); 338 338 339 OrxVerify(ClassIdentifier<T>::classIdentifier_s != NULL, "Did you forget to register the class of type " << typeid(T).name() << "?");339 OrxVerify(ClassIdentifier<T>::classIdentifier_s != nullptr, "Did you forget to register the class of type " << typeid(T).name() << "?"); 340 340 return ClassIdentifier<T>::classIdentifier_s; 341 341 } … … 451 451 void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const 452 452 { 453 this->updateConfigValues(updateChildren, static_cast<T*>( NULL));453 this->updateConfigValues(updateChildren, static_cast<T*>(nullptr)); 454 454 } 455 455 … … 483 483 registered in the class hierarchy. 484 484 @return 485 Returns NULLif the cast is not possible485 Returns nullptr if the cast is not possible 486 486 @note 487 In case of NULLreturn (and using MSVC), a dynamic_cast might still be possible if487 In case of nullptr return (and using MSVC), a dynamic_cast might still be possible if 488 488 a class forgot to register its objects. 489 489 Also note that the function is implemented differently for GCC/MSVC. … … 494 494 #ifdef ORXONOX_COMPILER_MSVC 495 495 typedef Loki::TypeTraits<typename Loki::TypeTraits<T>::PointeeType>::NonConstType ClassType; 496 if (source != NULL)496 if (source != nullptr) 497 497 return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID()); 498 498 else 499 return NULL;499 return nullptr; 500 500 #else 501 501 return dynamic_cast<T>(source); -
code/branches/cpp11_v2/src/libraries/core/class/IdentifierManager.cc
r10624 r10765 49 49 { 50 50 this->hierarchyCreatingCounter_s = 0; 51 this->recordTraceForIdentifier_ = NULL;51 this->recordTraceForIdentifier_ = nullptr; 52 52 } 53 53 … … 92 92 // iterate over all identifiers, create one instance of each class and initialize the identifiers 93 93 { 94 Context temporaryContext( NULL);94 Context temporaryContext(nullptr); 95 95 for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it) 96 96 { … … 108 108 Identifiable* temp = identifier->fabricate(&temporaryContext); 109 109 110 this->recordTraceForIdentifier_ = NULL;110 this->recordTraceForIdentifier_ = nullptr; 111 111 112 112 if (temp->getIdentifier() != identifier) … … 149 149 150 150 // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy 151 Context temporaryContext( NULL);151 Context temporaryContext(nullptr); 152 152 for (std::set<Identifier*>::const_iterator it1 = initializedIdentifiers.begin(); it1 != initializedIdentifiers.end(); ++it1) 153 153 { -
code/branches/cpp11_v2/src/libraries/core/class/SubclassIdentifier.h
r9667 r10765 127 127 else 128 128 { 129 orxout(internal_error) << "Can't assign NULLidentifier" << endl;129 orxout(internal_error) << "Can't assign nullptr identifier" << endl; 130 130 } 131 131 } -
code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.cc
r10624 r10765 119 119 /** 120 120 @brief Executes the command which was evaluated by this object and returns its return-value. 121 @param error A pointer to an integer (or NULL) which will be used to write error codes to (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")121 @param error A pointer to an integer (or nullptr) which will be used to write error codes to (see @ref CommandExecutorErrorCodes "CommandExecutor error codes") 122 122 @return Returns the result of the command (or MultiType::Null if there is no return value) 123 123 */ -
code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.h
r8079 r10765 137 137 static std::string getCommonBegin(const ArgumentCompletionList& list); 138 138 139 const ConsoleCommand* execCommand_; ///< The command that will be executed (can be NULLif the command is not valid)139 const ConsoleCommand* execCommand_; ///< The command that will be executed (can be nullptr if the command is not valid) 140 140 const ConsoleCommand* hintCommand_; ///< The command that is used to display hints and argument lists (can be different to execCommand_ in some cases) 141 141 SubString tokens_; ///< The single words of the command string, split into tokens -
code/branches/cpp11_v2/src/libraries/core/command/CommandExecutor.cc
r10624 r10765 81 81 @brief Executes a command and returns its return-value. 82 82 @param command A string containing the command 83 @param error A pointer to a value (or NULL) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes")83 @param error A pointer to a value (or nullptr) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes") 84 84 @param useTcl If true, the command is passed to tcl (see TclBind) 85 85 @return Returns the return-value of the command (if any - MultiType::Null otherwise) … … 127 127 @brief Executes a command and returns its return-value as string. 128 128 @param command A string containing the command 129 @param error A pointer to a value (or NULL) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes")129 @param error A pointer to a value (or nullptr) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes") 130 130 @param useTcl If true, the command is passed to tcl (see TclBind) 131 131 @return Returns the return-value of the command converted to a string (or "" if there's no return value) -
code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc
r10624 r10765 348 348 349 349 /** 350 @brief Sets the functor to NULL(which also deactivates the command).350 @brief Sets the functor to nullptr (which also deactivates the command). 351 351 */ 352 352 void ConsoleCommand::resetFunction() -
code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.h
r10624 r10765 195 195 { if (this->command_) { this->command_->popFunction(); } return *this; } 196 196 197 /// Sets the current function-pointer to NULL, which also deactivates the command.197 /// Sets the current function-pointer to nullptr, which also deactivates the command. 198 198 inline ConsoleCommandManipulator& resetFunction() 199 199 { if (this->command_) { this->command_->resetFunction(); } return *this; } … … 205 205 inline ConsoleCommandManipulator& pushObject(void* object) 206 206 { if (this->command_) { this->command_->pushObject(object); } return *this; } 207 /// Removes the current object from the object-stack and restores the old object (or NULLif there's no object left on the stack).207 /// Removes the current object from the object-stack and restores the old object (or nullptr if there's no object left on the stack). 208 208 inline ConsoleCommandManipulator& popObject() 209 209 { if (this->command_) { this->command_->popObject(); } return *this; } -
code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommandIncludes.h
r10624 r10765 331 331 @brief Returns a manipulator for a command with the given name. 332 332 333 @note If the command doesn't exist, the manipulator contains a NULL pointer to the command,333 @note If the command doesn't exist, the manipulator contains a nullptr to the command, 334 334 but it can still be used without checks, because all functions of ConsoleCommandManipulator 335 335 check internally if the command exists. … … 340 340 @brief Returns a manipulator for a command with the given group and name. 341 341 342 @note If the command doesn't exist, the manipulator contains a NULL pointer to the command,342 @note If the command doesn't exist, the manipulator contains a nullptr to the command, 343 343 but it can still be used without checks, because all functions of ConsoleCommandManipulator 344 344 check internally if the command exists. -
code/branches/cpp11_v2/src/libraries/core/command/Executor.cc
r9550 r10765 76 76 @brief Calls the wrapped function with arguments that are passed in a string. 77 77 @param arguments The arguments that should be passed to the function, separated by @a delimiter 78 @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")78 @param error A pointer to a variable (or nullptr) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes") 79 79 @param delimiter The delimiter that is used to separate the arguments in the string @a arguments 80 80 @param bPrintError If true, errors are printed to the console if the function couldn't be executed with the given arguments … … 89 89 @brief Calls the wrapped function with arguments that are passed as tokens in a SubString 90 90 @param arguments The arguments that should be passed to the function 91 @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")91 @param error A pointer to a variable (or nullptr) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes") 92 92 @param delimiter The delimiter that was used to separate the arguments in the SubString @a arguments (used to join the surplus arguments) 93 93 @param bPrintError If true, errors are printed to the console if the function couldn't be executed with the given arguments … … 127 127 @param arguments The arguments that should be converted 128 128 @param arg An array of MultiType where the converted arguments will be stored 129 @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")129 @param error A pointer to a variable (or nullptr) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes") 130 130 @param delimiter The delimiter that was used to separate the arguments in the SubString @a arguments (used to join the surplus arguments) 131 131 @return Returns the number of evaluated arguments -
code/branches/cpp11_v2/src/libraries/core/command/Functor.h
r9667 r10765 215 215 virtual void* getRawObjectPointer() const = 0; 216 216 217 /// Enables or disables the safe mode which causes the functor to change the object pointer to NULLif the object is deleted (only member functors).217 /// Enables or disables the safe mode which causes the functor to change the object pointer to nullptr if the object is deleted (only member functors). 218 218 virtual void setSafeMode(bool bSafeMode) = 0; 219 219 … … 245 245 virtual ~FunctorMember() { if (this->bSafeMode_) { this->unregisterObject(this->object_); } } 246 246 247 /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MultiType::Null otherwise)247 /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be nullptr. @return Returns the return-value of the function (if any; MultiType::Null otherwise) 248 248 virtual MultiType operator()(O* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) = 0; 249 249 … … 312 312 { this->object_ = 0; } 313 313 314 O* object_; ///< The stored object-pointer, used to execute a member-function (or NULLfor static functions)315 bool bSafeMode_; ///< If true, the functor is in safe mode and registers itself as listener at the object and changes the pointer to NULLif the object is deleted314 O* object_; ///< The stored object-pointer, used to execute a member-function (or nullptr for static functions) 315 bool bSafeMode_; ///< If true, the functor is in safe mode and registers itself as listener at the object and changes the pointer to nullptr if the object is deleted 316 316 }; 317 317 … … 324 324 FunctorMember(void* object = 0) {} 325 325 326 /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MultiType::Null otherwise)326 /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be nullptr. @return Returns the return-value of the function (if any; MultiType::Null otherwise) 327 327 virtual MultiType operator()(void* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) = 0; 328 328 -
code/branches/cpp11_v2/src/libraries/core/command/IOConsolePOSIX.cc
r9667 r10765 44 44 namespace orxonox 45 45 { 46 IOConsole* IOConsole::singletonPtr_s = NULL;46 IOConsole* IOConsole::singletonPtr_s = nullptr; 47 47 48 48 namespace EscapeMode … … 353 353 const char* s; 354 354 if (!this->terminalWidth_ && (s = getenv("COLUMNS"))) 355 this->terminalWidth_ = strtol(s, NULL, 10);355 this->terminalWidth_ = strtol(s, nullptr, 10); 356 356 if (!this->terminalWidth_) 357 357 this->terminalWidth_ = 80; 358 358 if (!this->terminalHeight_ && (s = getenv("LINES"))) 359 this->terminalHeight_ = strtol(s, NULL, 10);359 this->terminalHeight_ = strtol(s, nullptr, 10); 360 360 if (!this->terminalHeight_) 361 361 this->terminalHeight_ = 24; -
code/branches/cpp11_v2/src/libraries/core/command/IOConsoleWindows.cc
r9676 r10765 41 41 namespace orxonox 42 42 { 43 IOConsole* IOConsole::singletonPtr_s = NULL;43 IOConsole* IOConsole::singletonPtr_s = nullptr; 44 44 45 45 //! Redirects std::cout, creates the corresponding Shell and changes the terminal mode … … 300 300 this->terminalWidth_ - 1, this->inputLineRow_ + this->inputLineHeight_ + this->statusLines_ - 1); 301 301 this->inputLineRow_ += linesDown; 302 ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, NULL, makeCOORD(0, this->inputLineRow_), &fillChar);302 ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, nullptr, makeCOORD(0, this->inputLineRow_), &fillChar); 303 303 // Move cursor down to the new bottom so the user can see the status lines 304 304 COORD pos = makeCOORD(0, this->inputLineRow_ + this->inputLineHeight_ - 1 + this->statusLines_); … … 312 312 // Scroll output up 313 313 SMALL_RECT oldRect = makeSMALL_RECT(0, lines - linesDown, this->terminalWidth_ - 1, this->inputLineRow_ - 1); 314 ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, NULL, makeCOORD(0, 0), &fillChar);314 ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, nullptr, makeCOORD(0, 0), &fillChar); 315 315 } 316 316 } … … 360 360 SMALL_RECT oldRect = makeSMALL_RECT(0, statusLineRow, this->terminalWidth_ - 1, statusLineRow + this->statusLines_); 361 361 CHAR_INFO fillChar = {{' '}, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED}; 362 ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, NULL, makeCOORD(0, statusLineRow + newLines), &fillChar);362 ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, nullptr, makeCOORD(0, statusLineRow + newLines), &fillChar); 363 363 // Clear potential leftovers 364 364 if (-newLines - this->statusLines_ > 0) -
code/branches/cpp11_v2/src/libraries/core/command/TclBind.cc
r10624 r10765 228 228 @brief Executes Tcl-code and returns the return-value. 229 229 @param tclcode A string that contains Tcl-code 230 @param error A pointer to an integer (or NULL) that is used to write an error-code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")230 @param error A pointer to an integer (or nullptr) that is used to write an error-code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes") 231 231 @return Returns the return-value of the executed code (or an empty string if there's no return-value) 232 232 */ -
code/branches/cpp11_v2/src/libraries/core/config/ConfigFile.cc
r10733 r10765 275 275 276 276 /** 277 @brief Returns a pointer to the section with given name (or NULLif the section doesn't exist).277 @brief Returns a pointer to the section with given name (or nullptr if the section doesn't exist). 278 278 */ 279 279 ConfigFileSection* ConfigFile::getSection(const std::string& section) const … … 282 282 if ((*it)->getName() == section) 283 283 return (*it); 284 return NULL;284 return nullptr; 285 285 } 286 286 -
code/branches/cpp11_v2/src/libraries/core/config/ConfigFileManager.cc
r9559 r10765 44 44 ConfigFileManager* ConfigFileManager::singletonPtr_s = 0; 45 45 46 /// Constructor: Initializes the array of config files with NULL.46 /// Constructor: Initializes the array of config files with nullptr. 47 47 ConfigFileManager::ConfigFileManager() 48 48 { 49 this->configFiles_.assign( NULL);49 this->configFiles_.assign(nullptr); 50 50 } 51 51 -
code/branches/cpp11_v2/src/libraries/core/config/ConfigFileSection.cc
r9559 r10765 99 99 100 100 /** 101 @brief Returns the entry with given name (or NULLif it doesn't exist).101 @brief Returns the entry with given name (or nullptr if it doesn't exist). 102 102 103 103 @param name The name of the entry … … 110 110 return *it; 111 111 } 112 return NULL;112 return nullptr; 113 113 } 114 114 115 115 /** 116 @brief Returns the entry of a vector element with given name and index (or NULLif it doesn't exist).116 @brief Returns the entry of a vector element with given name and index (or nullptr if it doesn't exist). 117 117 118 118 @param name The name of the vector … … 126 126 return *it; 127 127 } 128 return NULL;128 return nullptr; 129 129 } 130 130 -
code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h
r9667 r10765 223 223 inline const std::string& getSectionName() const 224 224 { return this->sectionname_; } 225 /// Returns the associated identifier (can be NULL).225 /// Returns the associated identifier (can be nullptr). 226 226 inline Identifier* getIdentifier() const 227 227 { return this->identifier_; } -
code/branches/cpp11_v2/src/libraries/core/config/SettingsConfigFile.cc
r10624 r10765 106 106 void SettingsConfigFile::addConfigValueContainer(ConfigValueContainer* container) 107 107 { 108 if (container == NULL)108 if (container == nullptr) 109 109 return; 110 110 std::pair<std::string, ConfigValueContainer*> second(getLowercase(container->getName()), container); … … 118 118 void SettingsConfigFile::removeConfigValueContainer(ConfigValueContainer* container) 119 119 { 120 if (container == NULL)120 if (container == nullptr) 121 121 return; 122 122 const std::string& sectionLC = getLowercase(container->getSectionName()); … … 269 269 { 270 270 std::string value; 271 it->second.second->getValue<std::string, void>(&value, NULL);271 it->second.second->getValue<std::string, void>(&value, nullptr); 272 272 return value; 273 273 } -
code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc
r10624 r10765 210 210 catch (const std::exception& ex) 211 211 { 212 oisInputManager_ = NULL;212 oisInputManager_ = nullptr; 213 213 internalState_ |= Bad; 214 214 ThrowException(InitialisationFailed, "Could not initialise the input system: " << ex.what()); … … 312 312 BOOST_FOREACH(InputDevice*& device, devices_) 313 313 { 314 if (device == NULL)314 if (device == nullptr) 315 315 continue; 316 316 const std::string& className = device->getClassName(); … … 321 321 devices_.resize(InputDeviceEnumerator::FirstJoyStick); 322 322 323 assert(oisInputManager_ != NULL);323 assert(oisInputManager_ != nullptr); 324 324 try 325 325 { … … 331 331 << "Potential resource leak!" << endl; 332 332 } 333 oisInputManager_ = NULL;333 oisInputManager_ = nullptr; 334 334 335 335 internalState_ |= Bad; … … 388 388 // No event gets triggered here yet! 389 389 BOOST_FOREACH(InputDevice* device, devices_) 390 if (device != NULL)390 if (device != nullptr) 391 391 device->update(time); 392 392 … … 419 419 for (unsigned int i = 0; i < devices_.size(); ++i) 420 420 { 421 if (devices_[i] == NULL)421 if (devices_[i] == nullptr) 422 422 continue; 423 423 std::vector<InputState*>& states = devices_[i]->getStateListRef(); … … 439 439 std::set<InputState*> tempSet; 440 440 for (unsigned int i = 0; i < devices_.size(); ++i) 441 if (devices_[i] != NULL)441 if (devices_[i] != nullptr) 442 442 for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState) 443 443 tempSet.insert(devices_[i]->getStateListRef()[iState]); … … 467 467 { 468 468 BOOST_FOREACH(InputDevice* device, devices_) 469 if (device != NULL)469 if (device != nullptr) 470 470 device->clearBuffers(); 471 471 } … … 477 477 478 478 BOOST_FOREACH(InputDevice* device, devices_) 479 if (device != NULL)479 if (device != nullptr) 480 480 device->startCalibration(); 481 481 … … 488 488 { 489 489 BOOST_FOREACH(InputDevice* device, devices_) 490 if (device != NULL)490 if (device != nullptr) 491 491 device->stopCalibration(); 492 492 … … 509 509 { 510 510 Mouse* mouse = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse]); 511 if (mouse != NULL)511 if (mouse != nullptr) 512 512 { 513 513 const OIS::MouseState state = mouse->getOISDevice()->getMouseState(); -
code/branches/cpp11_v2/src/libraries/core/input/InputManager.h
r8729 r10765 134 134 Returns a pointer to a InputState referenced by name. 135 135 @return 136 Returns NULLif state was not found.136 Returns nullptr if state was not found. 137 137 */ 138 138 InputState* getState(const std::string& name); -
code/branches/cpp11_v2/src/libraries/core/input/InputState.cc
r8729 r10765 49 49 priority_ = 0; 50 50 51 handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), NULL);51 handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), nullptr); 52 52 } 53 53 … … 55 55 { 56 56 if (device < handlers_.size()) 57 return handlers_[device] != NULL;57 return handlers_[device] != nullptr; 58 58 else 59 59 return false; … … 64 64 { 65 65 unsigned int oldSize = handlers_.size(); 66 handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), NULL);66 handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), nullptr); 67 67 68 68 for (unsigned int i = oldSize; i < handlers_.size(); ++i) -
code/branches/cpp11_v2/src/libraries/core/input/InputState.h
r8729 r10765 179 179 { 180 180 for (unsigned int i = 0; i < handlers_.size(); ++i) 181 if (handlers_[i] != NULL)181 if (handlers_[i] != nullptr) 182 182 INPUT_STATE_PUSH_CALL(i, allDevicesUpdated, dt); 183 183 } … … 188 188 { 189 189 case InputDeviceEnumerator::Keyboard: 190 if (handlers_[keyboardIndex_s] != NULL)190 if (handlers_[keyboardIndex_s] != nullptr) 191 191 INPUT_STATE_PUSH_CALL(keyboardIndex_s, keyboardUpdated, dt); 192 192 break; 193 193 194 194 case InputDeviceEnumerator::Mouse: 195 if (handlers_[mouseIndex_s] != NULL)195 if (handlers_[mouseIndex_s] != nullptr) 196 196 INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseUpdated, dt); 197 197 break; 198 198 199 199 default: // joy sticks 200 if (handlers_[device] != NULL)200 if (handlers_[device] != nullptr) 201 201 INPUT_STATE_PUSH_CALL(device, joyStickUpdated, device - firstJoyStickIndex_s, dt); 202 202 break; … … 208 208 { 209 209 assert(device < handlers_.size()); 210 if (handlers_[device] != NULL)210 if (handlers_[device] != nullptr) 211 211 { 212 212 // We have to store the function pointer to tell the compiler about its actual type because of overloading … … 218 218 ORX_FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) 219 219 { 220 if (handlers_[mouseIndex_s] != NULL)220 if (handlers_[mouseIndex_s] != nullptr) 221 221 INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseMoved, abs, rel, clippingSize); 222 222 } … … 224 224 ORX_FORCEINLINE void InputState::mouseScrolled(int abs, int rel) 225 225 { 226 if (handlers_[mouseIndex_s] != NULL)226 if (handlers_[mouseIndex_s] != nullptr) 227 227 INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseScrolled, abs, rel); 228 228 } … … 231 231 { 232 232 assert(device < handlers_.size()); 233 if (handlers_[device] != NULL)233 if (handlers_[device] != nullptr) 234 234 INPUT_STATE_PUSH_CALL(device, axisMoved, device - firstJoyStickIndex_s, axis, value); 235 235 } -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc
r10624 r10765 53 53 : deriveTime_(0.0f) 54 54 , filename_(filename) 55 , configFile_( NULL)56 , fallbackConfigFile_( NULL)55 , configFile_(nullptr) 56 , fallbackConfigFile_(nullptr) 57 57 { 58 58 mouseRelative_[0] = 0; … … 170 170 171 171 // load the bindings if required 172 if (configFile_ != NULL)172 if (configFile_ != nullptr) 173 173 { 174 174 for (unsigned int iDev = oldValue; iDev < joySticks_.size(); ++iDev) -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.h
r9978 r10765 159 159 //! Name of the file used in this KeyBinder (constant!) 160 160 const std::string filename_; 161 //! Config file used. NULLin case of KeyDetector. Also indicates whether we've already loaded.161 //! Config file used. nullptr in case of KeyDetector. Also indicates whether we've already loaded. 162 162 ConfigFile* configFile_; 163 163 //! Config file from the data directory that only serves as fallback -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinderManager.cc
r10624 r10765 56 56 57 57 KeyBinderManager::KeyBinderManager() 58 : currentBinder_( NULL)58 : currentBinder_(nullptr) 59 59 , bDefaultFileLoaded_(true) 60 60 , bBinding_(false) -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinderManager.h
r9667 r10765 107 107 108 108 // KeyBinder management 109 KeyBinder* currentBinder_; //! Currently selected KeyBinder (never NULL!)109 KeyBinder* currentBinder_; //! Currently selected KeyBinder (never nullptr!) 110 110 std::map<std::string, KeyBinder*> binders_; //! All loaded KeyBinders 111 111 bool bDefaultFileLoaded_; //! Tells whether the default one is loaded -
code/branches/cpp11_v2/src/libraries/core/input/KeyDetector.cc
r10624 r10765 62 62 KeyDetector::~KeyDetector() 63 63 { 64 inputState_->setHandler( NULL);64 inputState_->setHandler(nullptr); 65 65 InputManager::getInstance().destroyState("detector"); 66 66 ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction(); -
code/branches/cpp11_v2/src/libraries/core/module/DynLib.cc
r10540 r10765 56 56 { 57 57 mName = name; 58 m_hInst = NULL;58 m_hInst = nullptr; 59 59 } 60 60 … … 127 127 FORMAT_MESSAGE_FROM_SYSTEM | 128 128 FORMAT_MESSAGE_IGNORE_INSERTS, 129 NULL,129 nullptr, 130 130 GetLastError(), 131 131 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 132 132 (LPTSTR) &lpMsgBuf, 133 133 0, 134 NULL134 nullptr 135 135 ); 136 136 std::string ret = (char*)lpMsgBuf; -
code/branches/cpp11_v2/src/libraries/core/module/DynLib.h
r10541 r10765 45 45 #if defined(ORXONOX_PLATFORM_WINDOWS) 46 46 # define DYNLIB_HANDLE hInstance 47 # define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )47 # define DYNLIB_LOAD( a ) LoadLibraryEx( a, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH ) 48 48 # define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b ) 49 49 # define DYNLIB_UNLOAD( a ) !FreeLibrary( a ) … … 104 104 the symbol. 105 105 @par 106 If the function fails, the returned value is <b> NULL</b>.106 If the function fails, the returned value is <b>nullptr</b>. 107 107 108 108 */ -
code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc
r10549 r10765 33 33 namespace orxonox 34 34 { 35 ModuleInstance* ModuleInstance::currentModuleInstance_s = NULL;35 ModuleInstance* ModuleInstance::currentModuleInstance_s = nullptr; 36 36 37 37 ModuleInstance::ModuleInstance(const std::string& libraryName) 38 38 : libraryName_(libraryName) 39 , dynLib_( NULL)39 , dynLib_(nullptr) 40 40 { 41 41 } -
code/branches/cpp11_v2/src/libraries/core/module/Plugin.cc
r10553 r10765 38 38 { 39 39 this->referenceCounter_ = 0; 40 this->moduleInstance_ = NULL;40 this->moduleInstance_ = nullptr; 41 41 } 42 42 43 43 Plugin::~Plugin() 44 44 { 45 if (this->moduleInstance_ != NULL)45 if (this->moduleInstance_ != nullptr) 46 46 { 47 47 this->referenceCounter_ = 1; // force unloading … … 77 77 Core::getInstance().unloadModule(this->moduleInstance_); 78 78 delete this->moduleInstance_; 79 this->moduleInstance_ = NULL;79 this->moduleInstance_ = nullptr; 80 80 } 81 81 else -
code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc
r10580 r10765 56 56 PluginManager::~PluginManager() 57 57 { 58 ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject( NULL);59 ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject( NULL);58 ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject(nullptr); 59 ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr); 60 60 61 61 for (std::map<std::string, PluginReference*>::iterator it = this->references_.begin(); it != this->references_.end(); ++it) … … 89 89 { 90 90 Plugin* plugin = this->plugins_[name]; 91 if (plugin != NULL)91 if (plugin != nullptr) 92 92 plugin->load(); 93 93 else … … 98 98 { 99 99 Plugin* plugin = this->plugins_[name]; 100 if (plugin != NULL)100 if (plugin != nullptr) 101 101 plugin->unload(); 102 102 else … … 109 109 void PluginManager::loadPlugin(const std::string& name) 110 110 { 111 if (this->references_[name] == NULL)111 if (this->references_[name] == nullptr) 112 112 { 113 113 this->references_[name] = new PluginReference(name); … … 124 124 { 125 125 PluginReference* reference = this->references_[name]; 126 if (reference != NULL)126 if (reference != nullptr) 127 127 { 128 this->references_[name] = NULL;128 this->references_[name] = nullptr; 129 129 delete reference; 130 130 } -
code/branches/cpp11_v2/src/libraries/core/object/Context.cc
r10624 r10765 46 46 static size_t count = 0; 47 47 // the first time this is called, ++count returns 1 and the context is created 48 // the second time this is called, ++count returns 2 and NULLis returned because we're in the constructor of the context itself48 // the second time this is called, ++count returns 2 and nullptr is returned because we're in the constructor of the context itself 49 49 // for each future call the context (now completely created) is returned 50 50 if (++count == 2) 51 return NULL;51 return nullptr; 52 52 else 53 53 { 54 static Context context( NULL);54 static Context context(nullptr); 55 55 return &context; 56 56 } … … 82 82 { 83 83 delete Context::rootContext_s; 84 Context::rootContext_s = NULL;84 Context::rootContext_s = nullptr; 85 85 } 86 86 87 87 /*static*/ Context* Context::getRootContext() 88 88 { 89 OrxVerify(Context::rootContext_s != NULL, "Root Context is undefined");89 OrxVerify(Context::rootContext_s != nullptr, "Root Context is undefined"); 90 90 return Context::rootContext_s; 91 91 } … … 105 105 ObjectListBase* objectList = this->getObjectList(identifier); 106 106 delete objectList; 107 this->objectLists_[identifier->getClassID()] = NULL;107 this->objectLists_[identifier->getClassID()] = nullptr; 108 108 } 109 109 } -
code/branches/cpp11_v2/src/libraries/core/object/Destroyable.cc
r10624 r10765 66 66 void Destroyable::destroy() 67 67 { 68 assert(this); // Just in case someone tries to delete a NULL pointer68 assert(this); // Just in case someone tries to delete a nullptr 69 69 this->requestedDestruction_ = true; 70 70 if (this->referenceCount_ == 0) -
code/branches/cpp11_v2/src/libraries/core/object/IteratorBase.h
r10736 r10765 58 58 @brief Constructor: Sets the element, whereon the iterator points, to the given element. 59 59 */ 60 inline IteratorBase(ObjectListElement<T>* element = NULL)60 inline IteratorBase(ObjectListElement<T>* element = nullptr) 61 61 { 62 62 this->element_ = element; … … 151 151 inline operator bool() const 152 152 { 153 return (this->element_ != NULL);153 return (this->element_ != nullptr); 154 154 } 155 155 … … 208 208 } 209 209 else 210 this->list_ = NULL;210 this->list_ = nullptr; 211 211 } 212 212 -
code/branches/cpp11_v2/src/libraries/core/object/StrongPtr.h
r10745 r10765 248 248 } 249 249 250 /// Returns true if the wrapped pointer is NULL.250 /// Returns true if the wrapped pointer is nullptr. 251 251 inline bool operator!() const 252 252 { … … 269 269 } 270 270 271 /// Resets the strong pointer (equivalent to assigning a NULL pointer).271 /// Resets the strong pointer (equivalent to assigning a nullptr). 272 272 inline void reset() 273 273 { -
code/branches/cpp11_v2/src/libraries/core/object/WeakPtr.h
r10745 r10765 37 37 38 38 A WeakPtr wraps a pointer to an object. If the object gets deleted, the WeakPtr becomes 39 NULL. This can be used to store pointers to objects without knowing when they will be39 nullptr. This can be used to store pointers to objects without knowing when they will be 40 40 destroyed. 41 41 … … 50 50 WeakPtr<MyClass> pointer = object; // create a WeakPtr and assign the object 51 51 52 if (pointer) // checks if pointer is not NULL(which is true)52 if (pointer) // checks if pointer is not nullptr (which is true) 53 53 pointer->someFunction(); // calls MyClass::someFunction() 54 54 55 55 object->destroy(); // calls destroy() which deletes the object 56 56 57 if (pointer) // checks if pointer is not NULL(which is now false)57 if (pointer) // checks if pointer is not nullptr (which is now false) 58 58 pointer->someFunction(); // this will not be executed 59 59 @endcode … … 91 91 { 92 92 /** 93 @brief WeakPtr wraps a pointer to an object, which becomes NULLif the object is deleted.93 @brief WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted. 94 94 95 95 @see See @ref WeakPtrExample "this description" for more information and an example. … … 183 183 } 184 184 185 /// Returns true if the wrapped pointer is NULL.185 /// Returns true if the wrapped pointer is nullptr. 186 186 inline bool operator!() const 187 187 { … … 210 210 } 211 211 212 /// Resets the weak pointer (equivalent to assigning a NULL pointer).212 /// Resets the weak pointer (equivalent to assigning a nullptr). 213 213 inline void reset() 214 214 { -
code/branches/cpp11_v2/src/libraries/core/singleton/ScopedSingletonIncludes.h
r10535 r10765 71 71 */ 72 72 #define ManageScopedSingleton(className, scope, allowedToFail) \ 73 className* className::singletonPtr_s = NULL; \73 className* className::singletonPtr_s = nullptr; \ 74 74 static ScopedSingletonWrapper& className##ScopedSingletonWrapper \ 75 75 = (new orxonox::SI_SSW(new ClassScopedSingletonWrapper<className, allowedToFail>(#className), scope))->getWrapper() -
code/branches/cpp11_v2/src/libraries/core/singleton/ScopedSingletonWrapper.h
r10528 r10765 91 91 ClassScopedSingletonWrapper(const std::string& className) 92 92 : ScopedSingletonWrapper(className) 93 , singletonPtr_( NULL)93 , singletonPtr_(nullptr) 94 94 { 95 95 } … … 104 104 void activated() 105 105 { 106 assert(singletonPtr_ == NULL);106 assert(singletonPtr_ == nullptr); 107 107 singletonPtr_ = new T(); 108 108 } … … 111 111 void deactivated() 112 112 { 113 assert(singletonPtr_ != NULL);113 assert(singletonPtr_ != nullptr); 114 114 this->destroy(singletonPtr_); 115 singletonPtr_ = NULL;115 singletonPtr_ = nullptr; 116 116 } 117 117 … … 146 146 ClassScopedSingletonWrapper(const std::string& className) 147 147 : ScopedSingletonWrapper(className) 148 , singletonPtr_( NULL)148 , singletonPtr_(nullptr) 149 149 { 150 150 } … … 159 159 void activated() 160 160 { 161 assert(singletonPtr_ == NULL);161 assert(singletonPtr_ == nullptr); 162 162 try 163 163 { singletonPtr_ = new T(); } … … 171 171 void deactivated() 172 172 { 173 if (singletonPtr_ != NULL)173 if (singletonPtr_ != nullptr) 174 174 { 175 175 this->destroy(singletonPtr_); 176 singletonPtr_ = NULL;176 singletonPtr_ = nullptr; 177 177 } 178 178 } -
code/branches/cpp11_v2/src/libraries/network/ClientConnection.cc
r8858 r10765 44 44 Connection(NETWORK_PEER_ID_SERVER), 45 45 established_(false), 46 server_( NULL)46 server_(nullptr) 47 47 { 48 48 this->serverAddress_ = new ENetAddress(); … … 72 72 73 73 // create host 74 this->host_ = enet_host_create( NULL, NETWORK_CLIENT_MAX_CONNECTIONS, NETWORK_CHANNEL_COUNT, 0, 0);74 this->host_ = enet_host_create(nullptr, NETWORK_CLIENT_MAX_CONNECTIONS, NETWORK_CHANNEL_COUNT, 0, 0); 75 75 76 if ( this->host_ == NULL)76 if ( this->host_ == nullptr ) 77 77 { 78 orxout(internal_error, context::network) << "ClientConnection: host_ == NULL" << endl;78 orxout(internal_error, context::network) << "ClientConnection: host_ == nullptr" << endl; 79 79 // error handling 80 80 return false; … … 93 93 94 94 this->server_ = enet_host_connect(this->host_, serverAddress_, NETWORK_CHANNEL_COUNT, 0); 95 if ( this->server_== NULL)95 if ( this->server_==nullptr ) 96 96 { 97 orxout(internal_error, context::network) << "ClientConnection: server_ == NULL" << endl;97 orxout(internal_error, context::network) << "ClientConnection: server_ == nullptr" << endl; 98 98 // error handling 99 99 return false; -
code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc
r10624 r10765 48 48 bool FunctionCall::execute(){ 49 49 NetworkFunctionBase* fct = NetworkFunctionManager::getInstance().getFunctionByNetworkId( this->functionID_ ); 50 assert( fct != NULL);50 assert( fct != nullptr ); 51 51 assert( this->nrOfArguments_==this->arguments_.size() ); 52 52 switch(this->nrOfArguments_) -
code/branches/cpp11_v2/src/libraries/network/LANDiscoverable.cc
r10622 r10765 85 85 assert( this->host_ == 0 ); 86 86 this->host_ = enet_host_create( &bindAddress, 10, 0, 0, 0 ); 87 if ( this->host_ == NULL)88 orxout(internal_error, context::network) << "LANDiscoverable: host_ == NULL" << endl;87 if ( this->host_ == nullptr ) 88 orxout(internal_error, context::network) << "LANDiscoverable: host_ == nullptr" << endl; 89 89 } 90 90 else -
code/branches/cpp11_v2/src/libraries/network/LANDiscovery.cc
r10624 r10765 42 42 LANDiscovery::LANDiscovery() 43 43 { 44 this->host_ = enet_host_create( NULL, 10, 0, 0, 0 );45 if ( this->host_ == NULL)46 orxout(internal_error, context::network) << "LANDiscovery: host_ == NULL" << endl;44 this->host_ = enet_host_create(nullptr, 10, 0, 0, 0 ); 45 if ( this->host_ == nullptr ) 46 orxout(internal_error, context::network) << "LANDiscovery: host_ == nullptr" << endl; 47 47 } 48 48 49 49 LANDiscovery::~LANDiscovery() 50 50 { 51 if (this->host_ != NULL)51 if (this->host_ != nullptr) 52 52 enet_host_destroy(this->host_); 53 53 } … … 65 65 address.host = ENET_HOST_BROADCAST; 66 66 peer = enet_host_connect(this->host_, &address, 0, 0); 67 if (peer == NULL)67 if (peer == nullptr) 68 68 orxout(internal_error, context::network) << "Could not send LAN discovery to IPv4 Broadcast." << endl; 69 69 … … 71 71 enet_address_set_host(&address, "ff02::1"); // TODO: use a multicast group 72 72 peer = enet_host_connect(this->host_, &address, 0, 0); 73 if (peer == NULL)73 if (peer == nullptr) 74 74 orxout(internal_error, context::network) << "Could not send LAN discovery to IPv6 Multicast." << endl; 75 75 -
code/branches/cpp11_v2/src/libraries/network/MasterServer.cc
r10624 r10765 43 43 44 44 /* forward declaration so the linker doesn't complain */ 45 MasterServer *MasterServer::instance = NULL;45 MasterServer *MasterServer::instance = nullptr; 46 46 47 47 /* command: list servers */ … … 345 345 /***** ENTER MAIN LOOP *****/ 346 346 ENetEvent *event = (ENetEvent *)calloc(sizeof(ENetEvent), sizeof(char)); 347 if( event == NULL)347 if( event == nullptr ) 348 348 { 349 349 orxout(user_error, context::master_server) << "Could not create ENetEvent structure, exiting." << endl; -
code/branches/cpp11_v2/src/libraries/network/MasterServerComm.cc
r8858 r10765 54 54 55 55 /* initiate the client */ 56 this->client = enet_host_create( NULL/* create a client host */,56 this->client = enet_host_create( nullptr /* create a client host */, 57 57 1, 58 58 2, /* allow up 2 channels to be used, 0 and 1 */ … … 61 61 62 62 /* see if it worked */ 63 if (this->client == NULL)63 if (this->client == nullptr) 64 64 { orxout(internal_error, context::master_server) << "An error occurred while trying to create an " 65 65 << "ENet client host." << endl; … … 85 85 this->peer = enet_host_connect(this->client, &this->address, 2, 0); 86 86 87 if( this->peer == NULL)87 if( this->peer == nullptr ) 88 88 { orxout(internal_error, context::master_server) << "No available peers for initiating an ENet" 89 89 << " connection." << endl; … … 157 157 158 158 /* address buffer */ 159 char *addrconv = NULL;159 char *addrconv = nullptr; 160 160 int retval = 0; 161 161 … … 193 193 194 194 /* call the supplied callback, if any. */ 195 if( listener != NULL)195 if( listener != nullptr ) 196 196 retval = listener->rhandler( addrconv, &(this->event) ); 197 197 -
code/branches/cpp11_v2/src/libraries/network/NetworkFunctionManager.cc
r10624 r10765 71 71 return it->second; 72 72 else 73 return NULL;73 return nullptr; 74 74 } 75 75 -
code/branches/cpp11_v2/src/libraries/network/PeerList.cc
r10622 r10765 41 41 PeerList::addPeer( ENetPeer *toadd ) 42 42 { /* error correction */ 43 if( toadd == NULL)43 if( toadd == nullptr ) 44 44 { orxout(internal_error, context::master_server) << "PeerList::addPeer: empty peer given." << endl; 45 45 return -1; … … 92 92 93 93 /* not found */ 94 return NULL;94 return nullptr; 95 95 } 96 96 -
code/branches/cpp11_v2/src/libraries/network/Server.cc
r10622 r10765 244 244 { 245 245 // ClientInformation *temp = ClientInformation::getBegin(); 246 // if( temp == NULL)246 // if( temp == nullptr ) 247 247 //no client connected 248 248 if( this->clientIDs_.size()==0 ) … … 255 255 } 256 256 // orxout(verbose, context::network) << "sending DeleteObjects" << endl; 257 // while(temp != NULL){257 // while(temp != nullptr){ 258 258 // if( !(temp->getSynched()) ) 259 259 // { -
code/branches/cpp11_v2/src/libraries/network/ServerConnection.cc
r8858 r10765 73 73 this->host_ = enet_host_create(this->bindAddress_, NETWORK_MAX_CONNECTIONS, NETWORK_CHANNEL_COUNT, 0, 0); 74 74 75 if ( this->host_ == NULL)75 if ( this->host_ == nullptr ) 76 76 { 77 orxout(internal_error, context::network) << "ServerConnection: host_ == NULL" << endl;77 orxout(internal_error, context::network) << "ServerConnection: host_ == nullptr" << endl; 78 78 return false; 79 79 } -
code/branches/cpp11_v2/src/libraries/network/packet/ClassID.cc
r9667 r10765 58 58 for(;it != IdentifierManager::getInstance().getIdentifierByStringMap().end();++it){ 59 59 id = it->second; 60 if(id == NULL|| !id->hasFactory())60 if(id == nullptr || !id->hasFactory()) 61 61 continue; 62 62 const std::string& classname = id->getName(); … … 144 144 id=ClassByString( std::string((const char*)classname) ); 145 145 orxout(internal_info, context::packets) << "processing classid: " << networkID << " name: " << classname << " id: " << id << endl; 146 if(id== NULL){146 if(id==nullptr){ 147 147 orxout(user_error, context::packets) << "Received a bad classname" << endl; 148 148 abort(); -
code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc
r9667 r10765 608 608 609 609 if(dest_length==0) 610 return NULL;610 return nullptr; 611 611 612 612 uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()]; … … 645 645 646 646 if(dest_length==0) 647 return NULL;647 return nullptr; 648 648 649 649 uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()]; -
code/branches/cpp11_v2/src/libraries/network/packet/Packet.cc
r8858 r10765 122 122 // Destroy the ENetPacket if necessary. 123 123 // Note: For the case ENet used the callback to destroy the packet, we have already set 124 // enetPacket_ to NULLto avoid destroying it again.124 // enetPacket_ to nullptr to avoid destroying it again. 125 125 if (this->enetPacket_) 126 126 { -
code/branches/cpp11_v2/src/libraries/network/synchronisable/Synchronisable.cc
r10624 r10765 105 105 uint32_t Synchronisable::findContextID(Context* context) 106 106 { 107 if (context == NULL)107 if (context == nullptr) 108 108 return OBJECTID_UNKNOWN; 109 109 110 110 Synchronisable* synchronisableContext = orxonox_cast<Synchronisable*>(context); 111 if (synchronisableContext != NULL)111 if (synchronisableContext != nullptr) 112 112 return synchronisableContext->getObjectID(); 113 113 else … … 226 226 return it1->second; 227 227 // if the objects not in the map it should'nt exist at all anymore 228 return NULL;228 return nullptr; 229 229 } 230 230 -
code/branches/cpp11_v2/src/libraries/tools/ResourceCollection.cc
r9667 r10765 93 93 { 94 94 if (index >= resourceLocations_.size()) 95 return NULL;95 return nullptr; 96 96 else 97 97 return resourceLocations_[index]; -
code/branches/cpp11_v2/src/libraries/tools/Shader.cc
r10727 r10765 109 109 { 110 110 // For the moment, we get the viewport always from the graphics manager 111 // TODO: Try to support multiple viewports - note however that scenemanager_->getCurrentViewport() returns NULL111 // TODO: Try to support multiple viewports - note however that scenemanager_->getCurrentViewport() returns nullptr 112 112 // after switching to a camera in a different scene (only for the first time this scene is displayed though) 113 113 this->changedCompositorName(GraphicsManager::getInstance().getViewport()); -
code/branches/cpp11_v2/src/libraries/util/Clipboard.cc
r8858 r10765 93 93 { 94 94 HANDLE hData = GetClipboardData(CF_TEXT); 95 if (hData == NULL)95 if (hData == nullptr) 96 96 return ""; 97 97 std::string output(static_cast<char*>(GlobalLock(hData))); -
code/branches/cpp11_v2/src/libraries/util/DestructionHelper.h
r8423 r10765 36 36 /** Deletes an object and resets the pointer 37 37 @param object 38 Pointer to an object. Handing over NULLis safe.38 Pointer to an object. Handing over nullptr is safe. 39 39 */ 40 40 template <class T> … … 42 42 { 43 43 delete *object; 44 *object = NULL;44 *object = nullptr; 45 45 } 46 46 -
code/branches/cpp11_v2/src/libraries/util/SharedPtr.h
r10745 r10765 215 215 216 216 public: 217 /// Default constructor, the pointer is set to NULL.217 /// Default constructor, the pointer is set to nullptr. 218 218 inline SharedPtr() : pointer_(0), counter_(0) 219 219 { … … 310 310 } 311 311 312 /// Returns true if the pointer is not NULL.312 /// Returns true if the pointer is not nullptr. 313 313 inline operator bool() const 314 314 { -
code/branches/cpp11_v2/src/libraries/util/SignalHandler.cc
r9682 r10765 44 44 namespace orxonox 45 45 { 46 SignalHandler* SignalHandler::singletonPtr_s = NULL;46 SignalHandler* SignalHandler::singletonPtr_s = nullptr; 47 47 } 48 48 … … 175 175 dup2( gdbErr[1], STDERR_FILENO ); 176 176 177 execlp( "sh", "sh", "-c", "gdb", static_cast<void*>( NULL));177 execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(nullptr)); 178 178 } 179 179 … … 186 186 perror("pipe failed!\n"); 187 187 kill( gdbPid, SIGTERM ); 188 waitpid( gdbPid, NULL, 0 );188 waitpid( gdbPid, nullptr, 0 ); 189 189 exit(EXIT_FAILURE); 190 190 } … … 196 196 perror("fork failed!\n"); 197 197 kill( gdbPid, SIGTERM ); 198 waitpid( gdbPid, NULL, 0 );198 waitpid( gdbPid, nullptr, 0 ); 199 199 exit(EXIT_FAILURE); 200 200 } … … 297 297 298 298 299 waitpid( sigPid, NULL, 0 );300 waitpid( gdbPid, NULL, 0 );299 waitpid( sigPid, nullptr, 0 ); 300 waitpid( gdbPid, nullptr, 0 ); 301 301 302 302 int wsRemoved = 0; … … 312 312 bt.erase(0, 1); 313 313 314 time_t now = time( NULL);314 time_t now = time(nullptr); 315 315 316 316 std::string timeString = … … 388 388 SignalHandler::SignalHandler() 389 389 { 390 this->prevExceptionFilter_ = NULL;390 this->prevExceptionFilter_ = nullptr; 391 391 } 392 392 … … 394 394 SignalHandler::~SignalHandler() 395 395 { 396 if (this->prevExceptionFilter_ != NULL)396 if (this->prevExceptionFilter_ != nullptr) 397 397 { 398 398 // Remove the unhandled exception filter function 399 399 SetUnhandledExceptionFilter(this->prevExceptionFilter_); 400 this->prevExceptionFilter_ = NULL;400 this->prevExceptionFilter_ = nullptr; 401 401 } 402 402 } … … 408 408 409 409 // don't register twice 410 assert(this->prevExceptionFilter_ == NULL);411 412 if (this->prevExceptionFilter_ == NULL)410 assert(this->prevExceptionFilter_ == nullptr); 411 412 if (this->prevExceptionFilter_ == nullptr) 413 413 { 414 414 // Install the unhandled exception filter function … … 441 441 std::ofstream crashlog(SignalHandler::getInstance().filename_.c_str()); 442 442 443 time_t now = time( NULL);443 time_t now = time(nullptr); 444 444 445 445 crashlog << "=======================================================" << endl; … … 480 480 } 481 481 482 /// Returns the stack trace for either the current function, or, if @a pExceptionInfo is not NULL, for the given exception context.482 /// Returns the stack trace for either the current function, or, if @a pExceptionInfo is not nullptr, for the given exception context. 483 483 /* static */ std::string SignalHandler::getStackTrace(PEXCEPTION_POINTERS pExceptionInfo) 484 484 { … … 625 625 #ifdef ORXONOX_COMPILER_GCC 626 626 int status; 627 char* demangled = __cxxabiv1::__cxa_demangle(symbol->Name, NULL, NULL, &status);627 char* demangled = __cxxabiv1::__cxa_demangle(symbol->Name, nullptr, nullptr, &status); 628 628 if (demangled) 629 629 { … … 684 684 HMODULE hModule; 685 685 686 std::string output = (GetModuleFileName( NULL, szModule, MAX_PATH) ? SignalHandler::getModuleName(szModule) : "Application");686 std::string output = (GetModuleFileName(nullptr, szModule, MAX_PATH) ? SignalHandler::getModuleName(szModule) : "Application"); 687 687 output += " caused "; 688 688 -
code/branches/cpp11_v2/src/libraries/util/SignalHandler.h
r9550 r10765 113 113 void doCatch(const std::string& appName, const std::string& filename); 114 114 115 static std::string getStackTrace(PEXCEPTION_POINTERS pExceptionInfo = NULL);115 static std::string getStackTrace(PEXCEPTION_POINTERS pExceptionInfo = nullptr); 116 116 static std::string getExceptionType(PEXCEPTION_POINTERS pExceptionInfo); 117 117 -
code/branches/cpp11_v2/src/libraries/util/Singleton.h
r10624 r10765 66 66 And don't forget to initialize the static singleton pointer in the source (*.cc) %file: 67 67 @code 68 TestSingleton* TestSingleton::singletonPtr_s = NULL;68 TestSingleton* TestSingleton::singletonPtr_s = nullptr; 69 69 @endcode 70 70 … … 118 118 static T& getInstance() 119 119 { 120 OrxVerify(T::singletonPtr_s != NULL, "T=" << typeid(T).name());120 OrxVerify(T::singletonPtr_s != nullptr, "T=" << typeid(T).name()); 121 121 return *T::singletonPtr_s; 122 122 } … … 125 125 static bool exists() 126 126 { 127 return (T::singletonPtr_s != NULL);127 return (T::singletonPtr_s != nullptr); 128 128 } 129 129 … … 132 132 Singleton() 133 133 { 134 OrxVerify(T::singletonPtr_s == NULL, "T=" << typeid(T).name());134 OrxVerify(T::singletonPtr_s == nullptr, "T=" << typeid(T).name()); 135 135 T::singletonPtr_s = static_cast<T*>(this); 136 136 } … … 139 139 virtual ~Singleton() 140 140 { 141 OrxVerify(T::singletonPtr_s != NULL, "T=" << typeid(T).name());142 T::singletonPtr_s = NULL;141 OrxVerify(T::singletonPtr_s != nullptr, "T=" << typeid(T).name()); 142 T::singletonPtr_s = nullptr; 143 143 } 144 144 -
code/branches/cpp11_v2/src/libraries/util/SmallObjectAllocator.cc
r7401 r10765 97 97 setNext(block + i * this->chunkSize_, block + (i + 1) * this->chunkSize_); 98 98 99 // the next_ pointer of the last chunk must point to NULL99 // the next_ pointer of the last chunk must point to nullptr 100 100 setNext(block + (this->numChunksPerBlock_ - 1) * this->chunkSize_, 0); 101 101
Note: See TracChangeset
for help on using the changeset viewer.