Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3123


Ignore:
Timestamp:
Jun 9, 2009, 1:31:32 PM (15 years ago)
Author:
rgrieder
Message:

Replaced all the std::istream::getline(const char*) calls with std::getline(std::ostream, std::string).
This gets rid of these nasty MAX_BUFFER = 1024 (or however long you want to make it) limitations.

Location:
code/branches/netp4/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp4/src/core/ConfigFileManager.cc

    r2896 r3123  
    4040namespace orxonox
    4141{
    42     const int CONFIG_FILE_MAX_LINELENGHT  = 1024;
    4342    const char* const DEFAULT_CONFIG_FILE = "default.ini";
    4443
     
    244243        if (file.is_open())
    245244        {
    246 
    247             char linearray[CONFIG_FILE_MAX_LINELENGHT];
    248 
    249245            ConfigFileSection* newsection = 0;
    250246
    251247            while (file.good() && !file.eof())
    252248            {
    253                 file.getline(linearray, CONFIG_FILE_MAX_LINELENGHT);
    254 
    255                 std::string line = std::string(linearray);
     249                std::string line;
     250                std::getline(file, line);
    256251
    257252                std::string temp = getStripped(line);
  • code/branches/netp4/src/core/ConsoleCommandCompilation.cc

    r1747 r3123  
    6868
    6969        // Iterate through the file and put the lines into the CommandExecutor
    70         char line[1024];
    7170        while (file.good() && !file.eof())
    7271        {
    73             file.getline(line, 1024);
     72            std::string line;
     73            std::getline(file, line);
    7474            CommandExecutor::execute(line);
    7575        }
     
    139139
    140140        std::string output = "";
    141         char line[1024];
    142141        while (file.good() && !file.eof())
    143142        {
    144             file.getline(line, 1024);
     143            std::string line;
     144            std::getline(file, line);
    145145            output += line;
    146146            output += "\n";
  • code/branches/netp4/src/core/Language.cc

    r2759 r3123  
    224224        }
    225225
    226         char line[1024];
    227 
    228226        // Iterate through the file and create the LanguageEntries
    229227        while (file.good() && !file.eof())
    230228        {
    231             file.getline(line, 1024);
    232             std::string lineString = std::string(line);
     229            std::string lineString;
     230            std::getline(file, lineString);
    233231
    234232            // Check if the line is empty
     
    272270        }
    273271
    274         char line[1024];
    275 
    276272        // Iterate through the file and create the LanguageEntries
    277273        while (file.good() && !file.eof())
    278274        {
    279             file.getline(line, 1024);
    280             std::string lineString = std::string(line);
     275            std::string lineString;
     276            std::getline(file, lineString);
    281277
    282278            // Check if the line is empty
  • code/branches/netp4/src/core/LuaBind.cc

    r3068 r3123  
    9797    }
    9898
    99     char line[1024*32];
    10099    std::string levelString = "";
    101100
    102101    while (file.good() && !file.eof())
    103102    {
    104       file.getline(line, 1024*32);
     103      std::string line;
     104      std::getline(file, line);
    105105      levelString += line;
    106106      levelString += "\n";
  • code/branches/netp4/src/util/OutputBuffer.cc

    r2710 r3123  
    3636namespace orxonox
    3737{
    38     const int OUTPUTBUFFER_MAX_LINE_LENGTH = 16384; //! The maximal number of lines that can be stored within the OutputBuffer.
    39 
    4038    /**
    4139        @brief Adds a new listener to the list.
     
    105103    bool OutputBuffer::getLine(std::string* output)
    106104    {
    107         char line[OUTPUTBUFFER_MAX_LINE_LENGTH];
    108 
    109         this->stream_.getline(line, OUTPUTBUFFER_MAX_LINE_LENGTH);
    110         (*output) = std::string(line);
     105        std::getline(this->stream_, *output);
    111106
    112107        bool eof = this->stream_.eof();
Note: See TracChangeset for help on using the changeset viewer.