Changeset 8801 for code/branches
- Timestamp:
- Jul 30, 2011, 9:31:05 PM (13 years ago)
- Location:
- code/branches/output/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/output/src/libraries/core/LuaState.cc
r8796 r8801 239 239 void LuaState::luaLog(unsigned int level, const std::string& message) 240 240 { 241 #pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level (and remove boost include)")241 #pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level, inspect lua support (and remove boost include)") 242 242 orxout(debug_output, context::lua) << "luaLog (level: " << level << "): " << message << endl; 243 243 } -
code/branches/output/src/libraries/core/command/IOConsoleWindows.cc
r8799 r8801 214 214 215 215 case Shell::Verbose: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 216 case Shell::VerboseMore: colour = 0| 0 | 0 | FOREGROUND_BLUE; break;217 case Shell::VerboseUltra: colour = 0| 0 | 0 | FOREGROUND_BLUE; break;216 case Shell::VerboseMore: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 217 case Shell::VerboseUltra: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 218 218 219 219 case Shell::Command: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break; -
code/branches/output/src/libraries/core/command/Shell.cc
r8799 r8801 33 33 34 34 #include "Shell.h" 35 36 #include <boost/preprocessor/stringize.hpp> 35 37 36 38 #include "util/Math.h" … … 48 50 namespace orxonox 49 51 { 52 #pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: add commands again, inspect tcl support (and remove boost include)") 50 53 // SetConsoleCommand("log", OutputHandler::log ); 51 54 // SetConsoleCommand("error", OutputHandler::error ).hide(); … … 251 254 252 255 /** 253 @brief Sends outputto the internal output buffer.256 @brief Adds multiple lines to the internal output buffer. 254 257 */ 255 258 void Shell::addOutput(const std::string& text, LineType type) 256 259 { 260 std::vector<std::string> lines; 261 vectorize(text, '\n', &lines); 262 263 for (size_t i = 0; i < lines.size(); ++i) 264 this->addLine(lines[i], type); 265 } 266 267 /** 268 @brief Adds a line to the internal output buffer. 269 */ 270 void Shell::addLine(const std::string& line, LineType type) 271 { 257 272 // yes it was - push the new line to the list 258 this->outputLines_.push_front(std::make_pair( text, static_cast<LineType>(type)));273 this->outputLines_.push_front(std::make_pair(line, static_cast<LineType>(type))); 259 274 260 275 // adjust the scroll position if needed … … 286 301 void Shell::printLine(const std::string& line, OutputLevel level) 287 302 { 288 this->add Output(line, static_cast<LineType>(level));303 this->addLine(line, static_cast<LineType>(level)); 289 304 } 290 305 -
code/branches/output/src/libraries/core/command/Shell.h
r8799 r8801 132 132 133 133 void addOutput(const std::string& text, LineType type = DebugOutput); 134 void addLine(const std::string& line, LineType type = DebugOutput); 134 135 void clearOutput(); 135 136 -
code/branches/output/src/libraries/util/StringUtils.cc
r8232 r8801 79 79 for (; pos2 > 0 && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--); 80 80 return str.substr(pos1, pos2 - pos1 + 1); 81 } 82 83 /// Splits a given string by a delimiter and stores it in an output vector 84 void vectorize(const std::string& str, char delimiter, std::vector<std::string>* output) 85 { 86 for (size_t start = 0, end = 0; end != std::string::npos; start = end + 1) 87 { 88 end = str.find_first_of(delimiter, start); 89 output->push_back(str.substr(start, end - start)); 90 } 81 91 } 82 92 … … 517 527 return matrix[(rows-1)*cols + cols-1]; 518 528 } 519 529 520 530 /** 521 531 @brief -
code/branches/output/src/libraries/util/StringUtils.h
r8232 r8801 43 43 #include "UtilPrereqs.h" 44 44 #include <string> 45 #include <vector> 45 46 46 47 namespace orxonox … … 54 55 55 56 _UtilExport std::string removeTrailingWhitespaces(const std::string& str); 57 58 _UtilExport void vectorize(const std::string& str, char delimiter, std::vector<std::string>* output); 56 59 57 60 _UtilExport size_t getNextQuote(const std::string& str, size_t start); … … 88 91 89 92 _UtilExport unsigned int getLevenshteinDistance(const std::string& str1, const std::string& str2); 90 93 91 94 _UtilExport std::string getTimestamp(void); 92 95 } -
code/branches/output/src/libraries/util/output/OutputManager.cc
r8799 r8801 32 32 #include "ConsoleWriter.h" 33 33 #include "LogWriter.h" 34 #include "util/StringUtils.h" 34 35 35 36 namespace orxonox … … 65 66 { 66 67 std::vector<std::string> lines; 67 for (size_t start = 0, end = 0; end != std::string::npos; start = end + 1) 68 { 69 end = message.find_first_of('\n', start); 70 lines.push_back(message.substr(start, end)); 71 } 68 vectorize(message, '\n', &lines); 72 69 73 70 for (size_t i = 0; i < this->listeners_.size(); ++i) -
code/branches/output/src/orxonox/overlays/InGameConsole.cc
r8797 r8801 561 561 case Shell::DebugOutput: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break; 562 562 563 case Shell::UserError: colourTop = ColourValue(0.9f, 0. 2f, 0.2f); break;564 case Shell::UserWarning: colourTop = ColourValue(0.9f, 0.5f, 0. 2f); break;565 case Shell::UserStatus: colourTop = ColourValue(0. 2f, 0.9f, 0.2f); break;566 case Shell::UserInfo: colourTop = ColourValue(0. 2f, 0.8f, 0.8f); break;563 case Shell::UserError: colourTop = ColourValue(0.9f, 0.0f, 0.0f); break; 564 case Shell::UserWarning: colourTop = ColourValue(0.9f, 0.5f, 0.0f); break; 565 case Shell::UserStatus: colourTop = ColourValue(0.0f, 0.9f, 0.0f); break; 566 case Shell::UserInfo: colourTop = ColourValue(0.0f, 0.8f, 0.8f); break; 567 567 568 568 case Shell::InternalError: colourTop = ColourValue(0.5f, 0.0f, 0.0f); break; … … 571 571 case Shell::InternalInfo: colourTop = ColourValue(0.0f, 0.4f, 0.4f); break; 572 572 573 case Shell::Verbose: colourTop = ColourValue(0. 2f, 0.2f, 0.9f); break;574 case Shell::VerboseMore: colourTop = ColourValue(0. 1f, 0.1f, 0.6f); break;575 case Shell::VerboseUltra: colourTop = ColourValue(0. 0f, 0.0f, 0.4f); break;573 case Shell::Verbose: colourTop = ColourValue(0.3f, 0.3f, 0.9f); break; 574 case Shell::VerboseMore: colourTop = ColourValue(0.2f, 0.2f, 0.7f); break; 575 case Shell::VerboseUltra: colourTop = ColourValue(0.1f, 0.1f, 0.5f); break; 576 576 577 577 case Shell::Command: colourTop = ColourValue(0.8f, 0.2f, 0.8f); break;
Note: See TracChangeset
for help on using the changeset viewer.