本文整理汇总了C++中Tokeniser::remainingTokens方法的典型用法代码示例。如果您正苦于以下问题:C++ Tokeniser::remainingTokens方法的具体用法?C++ Tokeniser::remainingTokens怎么用?C++ Tokeniser::remainingTokens使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tokeniser
的用法示例。
在下文中一共展示了Tokeniser::remainingTokens方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
AccountAvailableState::runCommand(const std::string &command,
const std::string &args)
{
if (CreateAcc == command)
{
Tokeniser tokeniser = Tokeniser();
tokeniser.initTokens(args);
std::string uname = tokeniser.nextToken();
std::string password = tokeniser.nextToken();
std::string realname = tokeniser.remainingTokens();
std::string msg;
msg = "Creating account: Name: [" + uname + "], Password: [" + password
+ "], Real Name: [" + realname + "]";
try
{
mAccount.createAccount(uname, realname, password);
}
catch (const std::exception& except)
{
S_LOG_WARNING("Got error on account creation." << except);
return;
}
catch (...)
{
S_LOG_WARNING("Got unknown error on account creation.");
return;
}
}
else if (Login == command)
{
// Split string into userid / password pair
Tokeniser tokeniser = Tokeniser();
tokeniser.initTokens(args);
std::string userid = tokeniser.nextToken();
std::string password = tokeniser.remainingTokens();
mAccount.login(userid, password);
std::string msg;
msg = "Login: [" + userid + "," + password + "]";
ConsoleBackend::getSingleton().pushMessage(msg, "info");
}
}
示例2: runCommand
void LoggedInState::runCommand(const std::string &command, const std::string &args)
{
if (Logout == command) {
ConsoleBackend::getSingleton().pushMessage("Logging out...", "important");
mAccount.logout();
// Create Character command
} else if (CreateChar == command) {
// Split string into name/type/sex/description
Tokeniser tokeniser = Tokeniser();
tokeniser.initTokens(args);
std::string name = tokeniser.nextToken();
std::string sex = tokeniser.nextToken();
std::string type = tokeniser.nextToken();
std::string spawnPoint = tokeniser.nextToken();
std::string description = tokeniser.remainingTokens();
createCharacter(name, sex, type, description, spawnPoint, Atlas::Message::MapType());
// Take Character Command
} else if (TakeChar == command) {
takeCharacter(args);
// List Characters Command
} else if (ListChars == command) {
mAccount.refreshCharacterInfo();
// Say (In-Game chat) Command
}
}
示例3: runCommand
void ConfigService::runCommand ( const std::string &command, const std::string &args )
{
if ( command == SETVALUE )
{
Tokeniser tokeniser;
tokeniser.initTokens ( args );
std::string section ( tokeniser.nextToken() );
std::string key ( tokeniser.nextToken() );
std::string value ( tokeniser.remainingTokens() );
if ( section == "" || key == "" || value == "" )
{
ConsoleBackend::getSingleton().pushMessage ( "Usage: set_value <section> <key> <value>", "help" );
}
else
{
setValue ( section, key, value );
ConsoleBackend::getSingleton().pushMessage ( "New value set, section: " + section + " key: " + key + " value: " + value, "info" );
}
}
else if ( command == GETVALUE )
{
Tokeniser tokeniser;
tokeniser.initTokens ( args );
std::string section ( tokeniser.nextToken() );
std::string key ( tokeniser.nextToken() );
if ( section == "" || key == "" )
{
ConsoleBackend::getSingleton().pushMessage ( "Usage: get_value <section> <key>", "help" );
}
else
{
if ( !hasItem ( section, key ) )
{
ConsoleBackend::getSingleton().pushMessage ( "No such value.", "error" );
}
else
{
varconf::Variable value = getValue ( section, key );
ConsoleBackend::getSingleton().pushMessage ( std::string ( "Value: " ) + static_cast<std::string> ( value ), "info" );
}
}
}
}
示例4: runCommand
void NonConnectedState::runCommand(const std::string &command, const std::string &args)
{
// Connect command
if (Connect == command) {
// Split string into server / port pair
Tokeniser tokeniser = Tokeniser();
tokeniser.initTokens(args);
std::string server = tokeniser.nextToken();
std::string port = tokeniser.remainingTokens();
std::string msg;
msg = "Connecting to: [" + server + "]";
ConsoleBackend::getSingleton().pushMessage(msg, "info");
if (port == "")
connect(server);
else
connect(server, (short)atoi(port.c_str()));
// Disonnect command
}
}