- Timestamp:
- Mar 12, 2006, 5:14:44 PM (19 years ago)
- Location:
- branches/std/src/lib
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/coord/p_node.cc
r7216 r7219 680 680 * @param bias the speed to iterate to this new Positions 681 681 */ 682 void PNode::setParentSoft(const char*parentName, float bias)682 void PNode::setParentSoft(const std::string& parentName, float bias) 683 683 { 684 684 PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE)); … … 701 701 void PNode::setParentMode (const std::string& parentingMode) 702 702 { 703 this->setParentMode(PNode:: charToParentingMode(parentingMode));703 this->setParentMode(PNode::stringToParentingMode(parentingMode)); 704 704 } 705 705 … … 927 927 this->getAbsDirV().y, 928 928 this->getAbsDirV().z, 929 this->parentingModeTo Char(parentMode),929 this->parentingModeToString(parentMode), 930 930 childNodeCount); 931 931 if (depth >= 2 || depth == 0) … … 1049 1049 * @return the converted string 1050 1050 */ 1051 const char* PNode::parentingModeTo Char(int parentingMode)1051 const char* PNode::parentingModeToString(int parentingMode) 1052 1052 { 1053 1053 if (parentingMode == PNODE_LOCAL_ROTATE) … … 1068 1068 * @return the int corresponding to the named parentingMode 1069 1069 */ 1070 PARENT_MODE PNode:: charToParentingMode(const std::string& parentingMode)1070 PARENT_MODE PNode::stringToParentingMode(const std::string& parentingMode) 1071 1071 { 1072 1072 if (parentingMode == "local-rotate") -
branches/std/src/lib/coord/p_node.h
r7216 r7219 158 158 159 159 void setParentSoft(PNode* parentNode, float bias = 1.0); 160 void setParentSoft(const char*parentName, float bias = 1.0);160 void setParentSoft(const std::string& parentName, float bias = 1.0); 161 161 162 162 // PARENTING_MODE AND OTHER FLAGS // … … 183 183 184 184 // HELPER_FUNCTIONS // 185 static const char* parentingModeTo Char(int parentingMode);186 static PARENT_MODE charToParentingMode(const std::string& parentingMode);185 static const char* parentingModeToString(int parentingMode); 186 static PARENT_MODE stringToParentingMode(const std::string& parentingMode); 187 187 float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); }; 188 188 -
branches/std/src/lib/graphics/graphics_engine.cc
r7211 r7219 78 78 this->screen = NULL; 79 79 80 81 // Hardware82 this->hwRenderer = NULL;83 this->hwVendor = NULL;84 this->hwVersion = NULL;85 this->hwExtensions = NULL;86 87 80 // initialize the Modules 88 81 TextEngine::getInstance(); … … 103 96 // delete what has to be deleted here 104 97 this->displayFPS( false ); 105 106 delete[] this->hwRenderer;107 delete[] this->hwVendor;108 delete[] this->hwVersion;109 delete this->hwExtensions;110 98 111 99 //TextEngine … … 312 300 // printf("%s %s %s\n %s", renderer, vendor, version, extensions); 313 301 314 if (this->hwRenderer == NULL && renderer != NULL) 315 { 316 this->hwRenderer = new char[strlen(renderer)+1]; 317 strcpy(this->hwRenderer, renderer); 318 } 319 if (this->hwVendor == NULL && vendor != NULL) 320 { 321 this->hwVendor = new char[strlen(vendor)+1]; 322 strcpy(this->hwVendor, vendor); 323 } 324 if (this->hwVersion == NULL && version != NULL) 325 { 326 this->hwVersion = new char[strlen(version)+11]; 327 strcpy(this->hwVersion, version); 328 } 329 330 if (this->hwExtensions == NULL && extensions != NULL) 331 this->hwExtensions = new SubString((char*)glGetString(GL_EXTENSIONS), " \n\t,"); 302 if (renderer != NULL) 303 { 304 this->hwRenderer == renderer; 305 } 306 if (vendor != NULL) 307 { 308 this->hwVendor == vendor; 309 } 310 if (version != NULL) 311 { 312 this->hwVersion == version; 313 } 314 315 if (extensions != NULL) 316 this->hwExtensions.split(extensions, " \n\t,"); 332 317 333 318 PRINT(4)("Running on : vendor: %s, renderer: %s, version:%s\n", vendor, renderer, version); 334 319 PRINT(4)("Extensions:\n"); 335 if (this->hwExtensions != NULL) 336 for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++) 337 PRINT(4)("%d: %s\n", i, this->hwExtensions->getString(i)); 320 for (unsigned int i = 0; i < this->hwExtensions.getCount(); i++) 321 PRINT(4)("%d: %s\n", i, this->hwExtensions.getString(i).c_str()); 338 322 339 323 … … 529 513 * @return true if it is, false otherwise 530 514 */ 531 bool GraphicsEngine::hwSupportsEXT(const char* extension) 532 { 533 if (this->hwExtensions != NULL) 534 for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++) 535 if ( this->hwExtensions->getString(i) == extension) 536 return true; 515 bool GraphicsEngine::hwSupportsEXT(const std::string& extension) 516 { 517 for (unsigned int i = 0; i < this->hwExtensions.getCount(); i++) 518 if ( this->hwExtensions.getString(i) == extension) 519 return true; 537 520 return false; 538 521 } … … 587 570 void GraphicsEngine::draw() const 588 571 { 589 // LightManager::getInstance()->draw();572 // LightManager::getInstance()->draw(); 590 573 591 574 GraphicsEngine::storeMatrices(); … … 668 651 switch (event.type) 669 652 { 670 671 672 673 } 674 } 653 case EV_VIDEO_RESIZE: 654 this->resolutionChanged(event.resize); 655 break; 656 } 657 } -
branches/std/src/lib/graphics/graphics_engine.h
r7203 r7219 14 14 #include "sdlincl.h" 15 15 #include "glincl.h" 16 #include <list> 16 17 17 #include <list>18 #include "substring.h" 18 19 19 20 // Forward Declaration 20 21 class Text; 21 22 class IniParser; 22 class SubString;23 23 class WorldEntity; 24 24 class GraphicsEffect; … … 74 74 75 75 void listModes(); 76 bool hwSupportsEXT(const char*extension);76 bool hwSupportsEXT(const std::string& extension); 77 77 78 78 /** @brief swaps the GL_BUFFERS */ … … 116 116 117 117 // HARDWARE-Settings: 118 char*hwRenderer; //!< HW-renderer-string119 char*hwVendor; //!< HW-vendor-string120 char*hwVersion; //!< HW-version-string121 SubString *hwExtensions; //!< All suported Extensions.118 std::string hwRenderer; //!< HW-renderer-string 119 std::string hwVendor; //!< HW-vendor-string 120 std::string hwVersion; //!< HW-version-string 121 SubString hwExtensions; //!< All suported Extensions. 122 122 123 123 // FPS-related -
branches/std/src/lib/graphics/render2D/element_2d.cc
r7216 r7219 726 726 void Element2D::setParentMode2D (const std::string& parentingMode) 727 727 { 728 this->setParentMode2D(Element2D:: charToParentingMode2D(parentingMode));728 this->setParentMode2D(Element2D::stringToParentingMode2D(parentingMode)); 729 729 } 730 730 … … 952 952 this->relCoordinate.y, 953 953 this->getAbsDir2D(), 954 Element2D::parentingModeTo Char2D(parentMode),954 Element2D::parentingModeToString2D(parentMode), 955 955 Element2D::layer2DToChar(this->layer)); 956 956 … … 1074 1074 * @return the converted string 1075 1075 */ 1076 const char* Element2D::parentingModeTo Char2D(int parentingMode)1076 const char* Element2D::parentingModeToString2D(int parentingMode) 1077 1077 { 1078 1078 if (parentingMode == E2D_PARENT_LOCAL_ROTATE) … … 1093 1093 * @return the int corresponding to the named parentingMode 1094 1094 */ 1095 E2D_PARENT_MODE Element2D:: charToParentingMode2D(const std::string& parentingMode)1095 E2D_PARENT_MODE Element2D::stringToParentingMode2D(const std::string& parentingMode) 1096 1096 { 1097 1097 if (parentingMode == "local-rotate") -
branches/std/src/lib/graphics/render2D/element_2d.h
r7216 r7219 212 212 213 213 // helper functions // 214 static const char* parentingModeTo Char2D(int parentingMode);215 static E2D_PARENT_MODE charToParentingMode2D(const std::string& parentingMode);214 static const char* parentingModeToString2D(int parentingMode); 215 static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode); 216 216 217 217 static const char* layer2DToChar(E2D_LAYER layer); -
branches/std/src/lib/shell/shell_command.cc
r7218 r7219 41 41 PRINTF(5)("create shellcommand %s %s\n", commandName, className); 42 42 this->setName(commandName); 43 this->description = NULL;44 this->alias = NULL;45 43 this->executor = executor.clone(); 46 44 this->executor->setName(commandName); … … 177 175 for (alias = ShellCommandClass::aliasList->begin(); alias != ShellCommandClass::aliasList->end(); alias++ ) 178 176 { 179 if ( (*alias)->getName() != NULL &&inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&177 if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL && 180 178 (*alias)->getCommand()->shellClass != NULL ) 181 179 { … … 258 256 * @param description the description of the Given command 259 257 */ 260 ShellCommand* ShellCommand::describe(const char*description)258 ShellCommand* ShellCommand::describe(const std::string& description) 261 259 { 262 260 if (this == NULL) … … 338 336 /* for (unsigned int i = 0; i< elem->paramCount; i++) 339 337 printf("%s ", ShellCommand::paramToString(elem->parameters[i]));*/ 340 if ( (*cmdIT)->description != NULL)341 printf("- %s", (*cmdIT)->description);338 if (!(*cmdIT)->description.empty()) 339 printf("- %s", (*cmdIT)->description.c_str()); 342 340 printf("\n"); 343 341 -
branches/std/src/lib/shell/shell_command.h
r7216 r7219 63 63 static bool execute (const std::string& executionString); 64 64 65 ShellCommand* describe(const char*description);65 ShellCommand* describe(const std::string& description); 66 66 ShellCommand* setAlias(const char* alias); 67 67 ShellCommand* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL, … … 89 89 ShellCommandAlias* alias; //!< An Alias for the Class. 90 90 91 const char*description; //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");91 std::string description; //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla"); 92 92 Executor* executor; //!< The Executor, that really executes the Function. 93 93 … … 100 100 public: 101 101 /** @returns the Name of the Alias. */ 102 const char*getName() const { return this->aliasName; };102 const std::string& getName() const { return this->aliasName; }; 103 103 /** @returns the Command, this Alias is asociated with */ 104 104 ShellCommand* getCommand() const { return this->command; }; … … 106 106 private: 107 107 /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */ 108 ShellCommandAlias(const char*aliasName, ShellCommand* command) { this->aliasName = aliasName; this->command = command; };108 ShellCommandAlias(const std::string& aliasName, ShellCommand* command) { this->aliasName = aliasName; this->command = command; }; 109 109 110 110 private: 111 const char*aliasName; //!< the name of the Alias111 std::string aliasName; //!< the name of the Alias 112 112 ShellCommand* command; //!< a pointer to the command, this alias executes. 113 113 }; -
branches/std/src/lib/shell/shell_command_class.cc
r7216 r7219 130 130 * @returns the CommandClass if found, NULL otherwise 131 131 */ 132 const ShellCommandClass* ShellCommandClass::isRegistered(const char*className)132 const ShellCommandClass* ShellCommandClass::isRegistered(const std::string& className) 133 133 { 134 134 if (ShellCommandClass::commandClassList == NULL) … … 203 203 /* for (unsigned int i = 0; i< elem->paramCount; i++) 204 204 PRINT(0)("%s ", ShellCommand::paramToString(elem->parameters[i]));*/ 205 if ( (*cmdIT)->description != NULL)206 PRINT(0)("- %s", (*cmdIT)->description );205 if (!(*cmdIT)->description.empty()) 206 PRINT(0)("- %s", (*cmdIT)->description.c_str()); 207 207 PRINT(0)("\n"); 208 208 } -
branches/std/src/lib/shell/shell_command_class.h
r7216 r7219 39 39 virtual ~ShellCommandClass(); 40 40 41 static const ShellCommandClass* isRegistered(const char*className);41 static const ShellCommandClass* isRegistered(const std::string& className); 42 42 static void initCommandClassList(); 43 43 -
branches/std/src/lib/util/executor/functor_list.h
r7218 r7219 21 21 l_SHORT: short 22 22 l_FLOAT: float 23 l_ CSTRING: const char*23 l_STRING: const std::string& 24 24 l_XML_ELEM: TiXmlElement* 25 25 */ -
branches/std/src/lib/util/loading/load_param_description.cc
r7203 r7219 134 134 * @param className the name of the class to be loadable 135 135 */ 136 LoadClassDescription::LoadClassDescription(const char* className) 137 { 138 this->className = new char[strlen(className)+1]; 139 strcpy(this->className, className); 136 LoadClassDescription::LoadClassDescription(const std::string& className) 137 { 138 this->className = className; 140 139 141 140 if (LoadClassDescription::classList == NULL) … … 156 155 this->paramList.pop_front(); 157 156 } 158 159 delete[] this->className;160 157 } 161 158 … … 182 179 Otherwise it returns a new classDescription 183 180 */ 184 LoadClassDescription* LoadClassDescription::addClass(const char*className)181 LoadClassDescription* LoadClassDescription::addClass(const std::string& className) 185 182 { 186 183 if (LoadClassDescription::classList != NULL) … … 189 186 while (it != LoadClassDescription::classList->end()) 190 187 { 191 if ( !strcmp((*it)->className, className))188 if ((*it)->className == className) 192 189 { 193 190 return (*it); … … 200 197 201 198 /** 202 * does the same as addClass(const char*className), but with params199 * does the same as addClass(const std::string& className), but with params 203 200 * @param paramName the name of the parameter to add. 204 201 */ 205 LoadParamDescription* LoadClassDescription::addParam(const char*paramName)202 LoadParamDescription* LoadClassDescription::addParam(const std::string& paramName) 206 203 { 207 204 std::list<LoadParamDescription*>::iterator it = this->paramList.begin(); … … 226 223 * @todo implement it 227 224 */ 228 void LoadClassDescription::printAll(const char*fileName)225 void LoadClassDescription::printAll(const std::string& fileName) 229 226 { 230 227 PRINT(3)("===============================================================\n"); … … 235 232 while (classDesc != LoadClassDescription::classList->end()) 236 233 { 237 PRINT(3)("<%s>\n", (*classDesc)->className );234 PRINT(3)("<%s>\n", (*classDesc)->className.c_str()); 238 235 std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin(); 239 236 while (param != (*classDesc)->paramList.end()) … … 242 239 param++; 243 240 } 244 PRINT(3)("</%s>\n\n", (*classDesc)->className );241 PRINT(3)("</%s>\n\n", (*classDesc)->className.c_str()); 245 242 classDesc++; 246 243 } … … 257 254 * !! The strings MUST NOT be deleted !! 258 255 */ 259 std::list< const char*> LoadClassDescription::searchClassWithShort(const char*classNameBegin)256 std::list<std::string> LoadClassDescription::searchClassWithShort(const std::string& classNameBegin) 260 257 { 261 258 /// FIXME 262 259 // NOT USED 263 260 /* unsigned int searchLength = strlen(classNameBegin); 264 std::list<const char*> retVal;261 std::list<const std::string&> retVal; 265 262 266 263 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); -
branches/std/src/lib/util/loading/load_param_description.h
r7203 r7219 59 59 friend class CLoadParam; 60 60 public: 61 LoadClassDescription(const char*className);61 LoadClassDescription(const std::string& className); 62 62 ~LoadClassDescription(); 63 63 64 static LoadClassDescription* addClass(const char*className);65 LoadParamDescription* addParam(const char*paramName);64 static LoadClassDescription* addClass(const std::string& className); 65 LoadParamDescription* addParam(const std::string& paramName); 66 66 67 67 static void deleteAllDescriptions(); 68 68 69 static void printAll(const char* fileName = NULL);70 static std::list< const char*> searchClassWithShort(const char*classNameBegin);71 // static const LoadParamDescription* getClass(const char*className);69 static void printAll(const std::string& fileName = ""); 70 static std::list<std::string> searchClassWithShort(const std::string& classNameBegin); 71 // static const LoadParamDescription* getClass(const std::string& className); 72 72 73 73 private: 74 74 static bool parametersDescription; //!< if parameter-description should be enabled. 75 75 static std::list<LoadClassDescription*>* classList; //!< a list, that stores all the loadable classes. (after one instance has been loaded) 76 char*className; //!< name of the class76 std::string className; //!< name of the class 77 77 78 78 std::list<LoadParamDescription*> paramList; //!< List of parameters this class knows. -
branches/std/src/lib/util/multi_type.cc
r7218 r7219 93 93 { 94 94 this->setChar(value); 95 }96 97 /**98 * @brief creates a multiType out of a C-String99 * @param value the Value of this MulitType100 */101 MultiType::MultiType(const char* value)102 {103 this->setString(value);104 95 } 105 96 … … 485 476 * @returns: the Type as MT_Type 486 477 */ 487 MT_Type MultiType::StringToMultiType(const char*type)488 { 489 if ( !strncmp(type, "bool", 4))478 MT_Type MultiType::StringToMultiType(const std::string& type) 479 { 480 if (type == "bool") 490 481 return MT_BOOL; 491 if ( !strncmp(type, "int", 3))482 if (type == "int") 492 483 return MT_INT; 493 if ( !strncmp(type, "float", 5))484 if (type, "float") 494 485 return MT_FLOAT; 495 if ( !strncmp(type, "char", 4))486 if (type == "char") 496 487 return MT_CHAR; 497 if ( !strncmp(type, "string", 6))488 if (type == "string") 498 489 return MT_STRING; 499 490 -
branches/std/src/lib/util/multi_type.h
r7218 r7219 39 39 MultiType(double value); 40 40 MultiType(char value); 41 MultiType(const char* value);42 41 MultiType(const std::string& value); 43 42 MultiType(const MultiType& multiType); … … 95 94 96 95 static const char* MultiTypeToString(MT_Type type); 97 static MT_Type StringToMultiType(const char*type);96 static MT_Type StringToMultiType(const std::string& type); 98 97 99 98 private:
Note: See TracChangeset
for help on using the changeset viewer.