Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 28, 2008, 10:13:58 PM (17 years ago)
Author:
landauf
Message:
  • added CommandExecutor
  • added ConsoleCommand macros
  • added getTypename to all MultiTypes
  • added 2 static maps to Identifier that contain all existing Identifiers with their names and lowercase names respectively.
  • added 2 maps to each Identifier that contain all console commands of the Identifier with their names and lowercase names respectively
  • using tolower(.) and toupper(.) instead of selfmade hacks in String.h
  • added AccessLevel enum
  • added some test-console-commands to OutputHandler, Ambient and SpaceShip
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/util/String.cc

    r931 r947  
    2525 *
    2626 */
     27
     28#include <cctype>
    2729
    2830#include "String.h"
     
    116118void lowercase(std::string* str)
    117119{
    118     static unsigned const char difference_between_A_and_a = 'A' - 'a';
    119 
    120     for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it)
    121         if ((*it) >= 'A' && (*it) <= 'Z')
    122             (*it) -= difference_between_A_and_a;
     120    for (unsigned int i = 0; i < str->size(); ++i)
     121    {
     122        (*str)[i] = tolower((*str)[i]);
     123    }
    123124}
    124125
     
    141142void uppercase(std::string* str)
    142143{
    143     static unsigned const char difference_between_A_and_a = 'A' - 'a';
    144 
    145     for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it)
    146         if ((*it) >= 'a' && (*it) <= 'z')
    147             (*it) += difference_between_A_and_a;
     144    for (unsigned int i = 0; i < str->size(); ++i)
     145    {
     146        (*str)[i] = toupper((*str)[i]);
     147    }
    148148}
    149149
Note: See TracChangeset for help on using the changeset viewer.