Changeset 11007
- Timestamp:
- Dec 31, 2015, 12:43:34 AM (9 years ago)
- Location:
- code/branches/cpp11_v2/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/XMLPort.h
r10990 r11007 324 324 { 325 325 public: 326 enum ParseResult326 enum class ParseResult 327 327 { 328 PR_not_started,329 PR_finished,330 PR_waiting_for_default_values328 not_started, 329 finished, 330 waiting_for_default_values 331 331 }; 332 332 333 333 public: 334 334 XMLPortParamContainer() 335 { this->parseResult_ = P R_not_started; }335 { this->parseResult_ = ParseResult::not_started; } 336 336 virtual ~XMLPortParamContainer() = default; 337 337 … … 415 415 this->loadexecutor_->parse(object, attributeValue, &error, ","); 416 416 if (!error || (mode == XMLPort::ExpandObject)) 417 this->parseResult_ = P R_finished;417 this->parseResult_ = ParseResult::finished; 418 418 else 419 this->parseResult_ = P R_waiting_for_default_values;419 this->parseResult_ = ParseResult::waiting_for_default_values; 420 420 } 421 421 else if (mode == XMLPort::ExpandObject) 422 this->parseResult_ = P R_finished;422 this->parseResult_ = ParseResult::finished; 423 423 else 424 this->parseResult_ = P R_waiting_for_default_values;424 this->parseResult_ = ParseResult::waiting_for_default_values; 425 425 } 426 426 catch (ticpp::Exception& ex) … … 449 449 XMLPortParamContainer& portIfWaitingForDefaultValues(const ParseResult& result, const ParseParams& params) 450 450 { 451 if (result == P R_waiting_for_default_values)451 if (result == ParseResult::waiting_for_default_values) 452 452 return this->port(this->owner_, params); 453 453 else -
code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.h
r10765 r11007 60 60 } 61 61 62 namespace AccessLevel 62 /** 63 @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level. 64 */ 65 enum class AccessLevel 63 66 { 64 /** 65 @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level. 66 */ 67 enum Enum 68 { 69 All, 70 Standalone, 71 Master, 72 Server, 73 Client, 74 Online, 75 Offline, 76 None 77 }; 78 } 67 All, 68 Standalone, 69 Master, 70 Server, 71 Client, 72 Online, 73 Offline, 74 None 75 }; 79 76 80 77 /** … … 249 246 250 247 /// Changes the access level of the command. 251 inline ConsoleCommandManipulator& accessLevel(AccessLevel ::Enumlevel)248 inline ConsoleCommandManipulator& accessLevel(AccessLevel level) 252 249 { if (this->command_) { this->command_->accessLevel(level); } return *this; } 253 250 … … 332 329 333 330 /// Changes the access level of the command. 334 inline ConsoleCommand& accessLevel(AccessLevel ::Enumlevel)331 inline ConsoleCommand& accessLevel(AccessLevel level) 335 332 { this->accessLevel_ = level; return *this; } 336 333 /// Returns the access level of the command. 337 inline AccessLevel ::EnumgetAccessLevel() const334 inline AccessLevel getAccessLevel() const 338 335 { return this->accessLevel_; } 339 336 … … 394 391 bool bActive_; ///< True if the command should be active (it can still be inactive, for example if the function is missing) 395 392 bool bHidden_; ///< True if the command is hidden (it is still executable, but not visible in the list of available commands) 396 AccessLevel ::Enum accessLevel_;///< The access level (the state of the game in which you can access the command)393 AccessLevel accessLevel_; ///< The access level (the state of the game in which you can access the command) 397 394 std::string baseName_; ///< The name that was first assigned to the command 398 395 std::vector<CommandName> names_; ///< All names and aliases of this command -
code/branches/cpp11_v2/src/libraries/core/command/Executor.h
r10990 r11007 147 147 { return this->functor_->hasReturnvalue(); } 148 148 /// Returns the type of the wrapped function (static or member). 149 inline Functor::Type ::EnumgetType() const149 inline Functor::Type getType() const 150 150 { return this->functor_->getType(); } 151 151 /// Returns the name of the type of a parameter with given index (the first parameter has index 0). -
code/branches/cpp11_v2/src/libraries/core/command/Functor.h
r10990 r11007 176 176 { 177 177 public: 178 struct Type 179 { 180 /// Defines the type of a function (static or member) 181 enum Enum 182 { 183 Static, 184 Member 185 }; 178 /// Defines the type of a function (static or member) 179 enum class Type 180 { 181 Static, 182 Member 186 183 }; 187 184 … … 196 193 197 194 /// Returns the type of the function: static or member. 198 virtual Type ::EnumgetType() const = 0;195 virtual Type getType() const = 0; 199 196 /// Returns the number of parameters of the function. 200 197 virtual unsigned int getParamCount() const = 0; … … 262 259 263 260 // see Functor::getType() 264 virtual inline Functor::Type ::EnumgetType() const override261 virtual inline Functor::Type getType() const override 265 262 { return Functor::Type::Member; } 266 263 … … 339 336 340 337 // see Functor::getType() 341 virtual inline Functor::Type ::EnumgetType() const override338 virtual inline Functor::Type getType() const override 342 339 { return Functor::Type::Static; } 343 340 -
code/branches/cpp11_v2/src/libraries/core/command/IOConsolePOSIX.cc
r10768 r11007 46 46 IOConsole* IOConsole::singletonPtr_s = nullptr; 47 47 48 namespace EscapeMode 49 { 50 enum Value 51 { 52 None, 53 First, 54 Second 55 }; 56 } 48 enum class EscapeMode 49 { 50 None, 51 First, 52 Second 53 }; 57 54 58 55 IOConsole::IOConsole() … … 90 87 std::cout.flush(); 91 88 if (!this->origCout_.str().empty()) 92 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);89 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 93 90 // Erase input and status lines 94 91 this->cout_ << "\033[1G\033[J"; … … 111 108 unsigned char c; 112 109 std::string escapeSequence; 113 EscapeMode ::ValueescapeMode = EscapeMode::None;110 EscapeMode escapeMode = EscapeMode::None; 114 111 while (std::cin.good()) 115 112 { … … 231 228 if (!this->origCout_.str().empty()) 232 229 { 233 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);230 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 234 231 this->origCout_.str(""); 235 232 } … … 241 238 switch (type) 242 239 { 243 case Shell:: Message:244 case Shell:: DebugOutput: this->cout_ << "\033[0m"; break;245 246 case Shell:: UserError: this->cout_ << "\033[91m"; break;247 case Shell:: UserWarning: this->cout_ << "\033[93m"; break;248 case Shell:: UserStatus: this->cout_ << "\033[92m"; break;249 case Shell:: UserInfo: this->cout_ << "\033[96m"; break;250 251 case Shell:: InternalError: this->cout_ << "\033[31m"; break;252 case Shell:: InternalWarning: this->cout_ << "\033[33m"; break;253 case Shell:: InternalStatus: this->cout_ << "\033[32m"; break;254 case Shell:: InternalInfo: this->cout_ << "\033[36m"; break;255 256 case Shell:: Verbose: this->cout_ << "\033[94m"; break;257 case Shell:: VerboseMore: this->cout_ << "\033[34m"; break;258 case Shell:: VerboseUltra: this->cout_ << "\033[34m"; break;259 260 case Shell:: Command: this->cout_ << "\033[95m"; break;261 case Shell:: Hint: this->cout_ << "\033[35m"; break;262 263 default: this->cout_ << "\033[37m"; break;240 case Shell::LineType::Message: 241 case Shell::LineType::DebugOutput: this->cout_ << "\033[0m"; break; 242 243 case Shell::LineType::UserError: this->cout_ << "\033[91m"; break; 244 case Shell::LineType::UserWarning: this->cout_ << "\033[93m"; break; 245 case Shell::LineType::UserStatus: this->cout_ << "\033[92m"; break; 246 case Shell::LineType::UserInfo: this->cout_ << "\033[96m"; break; 247 248 case Shell::LineType::InternalError: this->cout_ << "\033[31m"; break; 249 case Shell::LineType::InternalWarning: this->cout_ << "\033[33m"; break; 250 case Shell::LineType::InternalStatus: this->cout_ << "\033[32m"; break; 251 case Shell::LineType::InternalInfo: this->cout_ << "\033[36m"; break; 252 253 case Shell::LineType::Verbose: this->cout_ << "\033[94m"; break; 254 case Shell::LineType::VerboseMore: this->cout_ << "\033[34m"; break; 255 case Shell::LineType::VerboseUltra: this->cout_ << "\033[34m"; break; 256 257 case Shell::LineType::Command: this->cout_ << "\033[95m"; break; 258 case Shell::LineType::Hint: this->cout_ << "\033[35m"; break; 259 260 default: this->cout_ << "\033[37m"; break; 264 261 } 265 262 … … 384 381 void IOConsole::executed() 385 382 { 386 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell:: Command);383 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command); 387 384 } 388 385 -
code/branches/cpp11_v2/src/libraries/core/command/IOConsoleWindows.cc
r10765 r11007 97 97 std::cout.flush(); 98 98 if (!this->origCout_.str().empty()) 99 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);99 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 100 100 101 101 this->shell_->unregisterListener(this); … … 190 190 if (!this->origCout_.str().empty()) 191 191 { 192 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);192 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 193 193 this->origCout_.str(""); 194 194 } … … 202 202 switch (type) 203 203 { 204 case Shell:: Message:205 case Shell:: DebugOutput: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;206 207 case Shell:: UserError: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | 0 ; break;208 case Shell:: UserWarning: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break;209 case Shell:: UserStatus: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | 0 ; break;210 case Shell:: UserInfo: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break;211 212 case Shell:: InternalError: colour = 0 | FOREGROUND_RED | 0 | 0 ; break;213 case Shell:: InternalWarning: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break;214 case Shell:: InternalStatus: colour = 0 | 0 | FOREGROUND_GREEN | 0 ; break;215 case Shell:: InternalInfo: colour = 0 | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break;216 217 case Shell:: Verbose: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break;218 case Shell:: VerboseMore: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break;219 case Shell:: VerboseUltra: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break;220 221 case Shell:: Command: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break;222 case Shell:: Hint: colour = 0 | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break;223 224 default: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;204 case Shell::LineType::Message: 205 case Shell::LineType::DebugOutput: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 206 207 case Shell::LineType::UserError: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | 0 ; break; 208 case Shell::LineType::UserWarning: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break; 209 case Shell::LineType::UserStatus: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | 0 ; break; 210 case Shell::LineType::UserInfo: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 211 212 case Shell::LineType::InternalError: colour = 0 | FOREGROUND_RED | 0 | 0 ; break; 213 case Shell::LineType::InternalWarning: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break; 214 case Shell::LineType::InternalStatus: colour = 0 | 0 | FOREGROUND_GREEN | 0 ; break; 215 case Shell::LineType::InternalInfo: colour = 0 | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 216 217 case Shell::LineType::Verbose: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 218 case Shell::LineType::VerboseMore: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 219 case Shell::LineType::VerboseUltra: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 220 221 case Shell::LineType::Command: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break; 222 case Shell::LineType::Hint: colour = 0 | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break; 223 224 default: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 225 225 } 226 226 … … 331 331 void IOConsole::executed() 332 332 { 333 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell:: Command);333 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command); 334 334 } 335 335 -
code/branches/cpp11_v2/src/libraries/core/command/Shell.cc
r10916 r11007 268 268 { 269 269 // yes it was - push the new line to the list 270 this->outputLines_.push_front(std::make_pair(line, static_cast<LineType>(type)));270 this->outputLines_.push_front(std::make_pair(line, type)); 271 271 272 272 // adjust the scroll position if needed … … 381 381 const std::string& result = CommandExecutor::query(this->inputBuffer_->get(), &error); 382 382 if (error) 383 this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", UserError);383 this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", LineType::UserError); 384 384 else if (result != "") 385 this->addOutput(result, Result);385 this->addOutput(result, LineType::Result); 386 386 387 387 this->clearInput(); … … 392 392 { 393 393 this->inputBuffer_->set(CommandExecutor::evaluate(this->inputBuffer_->get()).complete()); 394 this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), Hint);394 this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), LineType::Hint); 395 395 396 396 this->inputChanged(); -
code/branches/cpp11_v2/src/libraries/core/command/Shell.h
r10992 r11007 88 88 public: 89 89 /// Defines the type of a line of text in the Shell - some types depend on the output level, others are of internal use. 90 enum LineType90 enum class LineType 91 91 { 92 92 DebugOutput = debug_output, … … 133 133 LineList::const_iterator getEndIterator() const; 134 134 135 void addOutput(const std::string& text, LineType type = DebugOutput);136 void addLine(const std::string& line, LineType type = DebugOutput);135 void addOutput(const std::string& text, LineType type = LineType::DebugOutput); 136 void addLine(const std::string& line, LineType type = LineType::DebugOutput); 137 137 void clearOutput(); 138 138 -
code/branches/cpp11_v2/src/orxonox/overlays/InGameConsole.cc
r10768 r11007 292 292 293 293 for (int i = LINES - 1; i > max; --i) 294 this->print("", Shell:: DebugOutput, i, true);294 this->print("", Shell::LineType::DebugOutput, i, true); 295 295 296 296 for (int i = max; i >= 1; --i) … … 318 318 { 319 319 if (LINES > 0) 320 this->print(this->shell_->getInput(), Shell:: Input, 0);320 this->print(this->shell_->getInput(), Shell::LineType::Input, 0); 321 321 322 322 if (this->shell_->getInput().empty()) … … 342 342 void InGameConsole::executed() 343 343 { 344 this->shell_->addOutput(this->shell_->getInput(), Shell:: Command);344 this->shell_->addOutput(this->shell_->getInput(), Shell::LineType::Command); 345 345 } 346 346 … … 562 562 switch (type) 563 563 { 564 case Shell:: Message:565 case Shell:: DebugOutput: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;566 567 case Shell:: UserError: colourTop = ColourValue(0.9f, 0.0f, 0.0f); break;568 case Shell:: UserWarning: colourTop = ColourValue(0.9f, 0.5f, 0.0f); break;569 case Shell:: UserStatus: colourTop = ColourValue(0.0f, 0.9f, 0.0f); break;570 case Shell:: UserInfo: colourTop = ColourValue(0.0f, 0.8f, 0.8f); break;571 572 case Shell:: InternalError: colourTop = ColourValue(0.5f, 0.0f, 0.0f); break;573 case Shell:: InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break;574 case Shell:: InternalStatus: colourTop = ColourValue(0.0f, 0.5f, 0.0f); break;575 case Shell:: InternalInfo: colourTop = ColourValue(0.0f, 0.4f, 0.4f); break;576 577 case Shell:: Verbose: colourTop = ColourValue(0.3f, 0.3f, 0.9f); break;578 case Shell:: VerboseMore: colourTop = ColourValue(0.2f, 0.2f, 0.7f); break;579 case Shell:: VerboseUltra: colourTop = ColourValue(0.1f, 0.1f, 0.5f); break;580 581 case Shell:: Command: colourTop = ColourValue(0.8f, 0.2f, 0.8f); break;582 case Shell:: Hint: colourTop = ColourValue(0.4f, 0.0f, 0.4f); break;583 case Shell:: Input: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;584 585 default: colourTop = ColourValue(0.5f, 0.5f, 0.5f); break;564 case Shell::LineType::Message: 565 case Shell::LineType::DebugOutput: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break; 566 567 case Shell::LineType::UserError: colourTop = ColourValue(0.9f, 0.0f, 0.0f); break; 568 case Shell::LineType::UserWarning: colourTop = ColourValue(0.9f, 0.5f, 0.0f); break; 569 case Shell::LineType::UserStatus: colourTop = ColourValue(0.0f, 0.9f, 0.0f); break; 570 case Shell::LineType::UserInfo: colourTop = ColourValue(0.0f, 0.8f, 0.8f); break; 571 572 case Shell::LineType::InternalError: colourTop = ColourValue(0.5f, 0.0f, 0.0f); break; 573 case Shell::LineType::InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break; 574 case Shell::LineType::InternalStatus: colourTop = ColourValue(0.0f, 0.5f, 0.0f); break; 575 case Shell::LineType::InternalInfo: colourTop = ColourValue(0.0f, 0.4f, 0.4f); break; 576 577 case Shell::LineType::Verbose: colourTop = ColourValue(0.3f, 0.3f, 0.9f); break; 578 case Shell::LineType::VerboseMore: colourTop = ColourValue(0.2f, 0.2f, 0.7f); break; 579 case Shell::LineType::VerboseUltra: colourTop = ColourValue(0.1f, 0.1f, 0.5f); break; 580 581 case Shell::LineType::Command: colourTop = ColourValue(0.8f, 0.2f, 0.8f); break; 582 case Shell::LineType::Hint: colourTop = ColourValue(0.4f, 0.0f, 0.4f); break; 583 case Shell::LineType::Input: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break; 584 585 default: colourTop = ColourValue(0.5f, 0.5f, 0.5f); break; 586 586 } 587 587
Note: See TracChangeset
for help on using the changeset viewer.