本文整理汇总了C++中CommandList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandList::begin方法的具体用法?C++ CommandList::begin怎么用?C++ CommandList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandList
的用法示例。
在下文中一共展示了CommandList::begin方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decodeBattlefieldParticipants
void SwgSnapshot::decodeBattlefieldParticipants(const NetworkId &objectId, Archive::ReadIterator &data, bool isBaseline)
{
typedef Archive::AutoDeltaMap<NetworkId, uint32> MapType;
typedef std::vector<MapType::Command> CommandList;
CommandList commands;
if (isBaseline)
MapType::unpack(data, commands);
else
MapType::unpackDelta(data, commands);
for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
{
switch ((*i).cmd)
{
case MapType::Command::ERASE:
m_battlefieldParticipantBuffer.removeParticipantForRegion(objectId, (*i).key);
break;
case MapType::Command::ADD:
case MapType::Command::SET:
m_battlefieldParticipantBuffer.setParticipantForRegion(objectId, (*i).key, (*i).value);
break;
default:
FATAL(true,("Unknown AutoDeltaMap command.\n"));
}
}
}
示例2: decodeManufactureSchematicAttributes
void SwgSnapshot::decodeManufactureSchematicAttributes(const NetworkId &objectId, Archive::ReadIterator &data, bool isBaseline)
{
typedef Archive::AutoDeltaMap<StringId, float> MapType;
typedef std::vector<MapType::Command> CommandList;
CommandList commands;
if (isBaseline)
MapType::unpack(data, commands);
else
MapType::unpackDelta(data, commands);
for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
{
switch ((*i).cmd)
{
case MapType::Command::ERASE:
m_manufactureSchematicAttributeBuffer.removeManufactureSchematicAttribute(objectId,(*i).key.getCanonicalRepresentation());
break;
case MapType::Command::ADD:
case MapType::Command::SET:
m_manufactureSchematicAttributeBuffer.setManufactureSchematicAttribute(objectId,(*i).key.getCanonicalRepresentation(),(*i).value);
break;
default:
FATAL(true,("Unknown AutoDeltaMap command.\n"));
}
}
}
示例3: decodeExperience
void SwgSnapshot::decodeExperience(const NetworkId &objectId, Archive::ReadIterator &data, bool isBaseline)
{
typedef Archive::AutoDeltaMap<std::string, int> MapType;
typedef std::vector<MapType::Command> CommandList;
CommandList commands;
if (isBaseline)
MapType::unpack(data, commands);
else
MapType::unpackDelta(data, commands);
for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
{
switch ((*i).cmd)
{
case MapType::Command::ERASE:
m_experienceBuffer.removeExperience(objectId, (*i).key);
break;
case MapType::Command::ADD:
case MapType::Command::SET:
m_experienceBuffer.setExperience(objectId, (*i).key, (*i).value);
break;
default:
FATAL(true,("Unknown AutoDeltaMap command.\n"));
}
}
}
示例4: decodePropertyList
void SwgSnapshot::decodePropertyList(const NetworkId &objectId, int listId, Archive::ReadIterator &data, bool isBaseline)
{
typedef Archive::AutoDeltaSet<std::string> SetType;
typedef std::vector<SetType::Command> CommandList;
CommandList commands;
if (isBaseline)
SetType::unpack(data, commands);
else
SetType::unpackDelta(data, commands);
for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
{
switch (i->cmd)
{
case SetType::Command::ERASE:
m_propertyListBuffer.deleteProperty(objectId, listId, i->value);
break;
case SetType::Command::INSERT:
m_propertyListBuffer.insertProperty(objectId, listId, i->value);
break;
case SetType::Command::CLEAR:
m_propertyListBuffer.clearProperties(objectId, listId);
break;
default:
FATAL(true,("Unknown AutoDeltaSet command.\n"));
}
}
}
示例5: usage
string usage()
{
stringstream str;
CommandList::const_iterator ci;
size_t maxWidth = 0;
for (ci = commandList.begin(); ci != commandList.end(); ci++) {
if ((*ci)->getName().length() > maxWidth) {
maxWidth = (*ci)->getName().length();
}
}
str << "Usage: " << binaryBaseName << " <COMMAND> [OPTIONS] [ARGUMENTS]"
<< endl << endl
<< "Commands (can be abbreviated):" << endl;
str << left;
for (ci = commandList.begin(); ci != commandList.end(); ci++) {
str << " " << setw(maxWidth) << (*ci)->getName()
<< " " << (*ci)->getBriefDescription() << endl;
}
str << endl
<< "Global options:" << endl
<< " --master -m <master> Comma separated list of masters" << endl
<< " to select, ranges are allowed." << endl
<< " Examples: '1,3', '5-7,9', '-3'." << endl
<< " Default: '-' (all)."
<< endl
<< " --force -f Force a command." << endl
<< " --quiet -q Output less information." << endl
<< " --verbose -v Output more information." << endl
<< " --help -h Show this help." << endl
<< endl
<< Command::numericInfo()
<< endl
<< "Call '" << binaryBaseName
<< " <COMMAND> --help' for command-specific help." << endl
<< endl
<< "Send bug reports to " << PACKAGE_BUGREPORT << "." << endl;
return str.str();
}
示例6: run
void CommandExec::run(CommandList& list, ZonePtr z) {
if (list.size() == 0) {
debugC(3, kDebugExec, "runCommands: nothing to do");
return;
}
_execZone = z;
debugC(3, kDebugExec, "runCommands starting");
runList(list.begin(), list.end());
debugC(3, kDebugExec, "runCommands completed");
}
示例7: sendHelp
void Chat::sendHelp(User* user, std::deque<std::string> args)
{
// TODO: Add paging support, since not all commands will fit into
// the screen at once.
CommandList* commandList = &m_guestCommands; // defaults
std::string commandColor = MC_COLOR_BLUE;
if(IS_ADMIN(user->permissions))
{
commandList = &m_adminCommands;
commandColor = MC_COLOR_RED; // different color for admin commands
}
else if(IS_OP(user->permissions))
{
commandList = &m_opCommands;
commandColor = MC_COLOR_GREEN;
}
else if(IS_MEMBER(user->permissions))
{
commandList = &m_memberCommands;
}
if(args.size() == 0)
{
for(CommandList::iterator it = commandList->begin();
it != commandList->end();
it++)
{
std::string args = it->second->arguments;
std::string description = it->second->description;
sendMsg(user, commandColor + CHATCMDPREFIX + it->first + " " + args + " : " + MC_COLOR_YELLOW + description, Chat::USER);
}
}
else
{
CommandList::iterator iter;
if((iter = commandList->find(args.front())) != commandList->end())
{
std::string args = iter->second->arguments;
std::string description = iter->second->description;
sendMsg(user, commandColor + CHATCMDPREFIX + iter->first + " " + args, Chat::USER);
sendMsg(user, MC_COLOR_YELLOW + CHATCMDPREFIX + description, Chat::USER);
}
else
{
sendMsg(user, MC_COLOR_RED + "Unknown Command: " + args.front(), Chat::USER);
}
}
}
示例8: getMatchingCommands
list<Command *> getMatchingCommands(const string &cmdStr)
{
CommandList::iterator ci;
list<Command *> res;
// find matching commands from beginning of the string
for (ci = commandList.begin(); ci != commandList.end(); ci++) {
if ((*ci)->matchesSubstr(cmdStr)) {
res.push_back(*ci);
}
}
if (!res.size()) { // nothing found
// find /any/ matching commands
for (ci = commandList.begin(); ci != commandList.end(); ci++) {
if ((*ci)->matchesAbbrev(cmdStr)) {
res.push_back(*ci);
}
}
}
return res;
}
示例9: evaluateCommands
void RTCommandEngine::evaluateCommands( TimeStamp timeStamp )
{
mergeIncomingCommands();
CommandList* commandList = getDueCommands( timeStamp );
if( commandList )
{
// XXX: evaluate commands that came in first first, basically what a queue should do,
// but the queue used here is actually a LIFO ringbuffer, so we have to reverse
// the list of commands -> ugly
commandList->reverse();
std::for_each( commandList->begin(), commandList->end(), processCommand );
scheduleCommandListForDeletion( commandList );
}
}
示例10: QObject
KopeteCommandGUIClient( Kopete::ChatSession *manager ) : QObject(manager), KXMLGUIClient(manager)
{
setXMLFile( QString::fromLatin1("kopetecommandui.rc") );
QDomDocument doc = domDocument();
QDomNode menu = doc.documentElement().firstChild().firstChild().firstChild();
CommandList mCommands = Kopete::CommandHandler::commandHandler()->commands(
manager->protocol()
);
CommandList::Iterator it, itEnd = mCommands.end();
for( it = mCommands.begin(); it != itEnd; ++it )
{
KAction *a = static_cast<KAction*>( it.value() );
actionCollection()->addAction( a->objectName(), a );
QDomElement newNode = doc.createElement( QString::fromLatin1("Action") );
newNode.setAttribute( QString::fromLatin1("name"), a->objectName() );
bool added = false;
for( QDomElement n = menu.firstChild().toElement();
!n.isNull(); n = n.nextSibling().toElement() )
{
if( a->objectName() < n.attribute(QString::fromLatin1("name")))
{
menu.insertBefore( newNode, n );
added = true;
break;
}
}
if( !added )
{
menu.appendChild( newNode );
}
}
setDOMDocument( doc );
}
示例11: decodeComponents
void SwgSnapshot::decodeComponents(NetworkId const & objectId, Archive::ReadIterator &data, bool isBaseline)
{
typedef Archive::AutoDeltaSet<int> SetType;
typedef std::vector<SetType::Command> CommandList;
CommandList commands;
if (isBaseline)
SetType::unpack(data, commands);
else
SetType::unpackDelta(data, commands);
for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
{
switch (i->cmd)
{
case SetType::Command::ERASE:
{
char buffer[50];
_itoa(i->value,buffer,10);
m_propertyListBuffer.deleteProperty(objectId, 11, buffer);
break;
}
case SetType::Command::INSERT:
{
char buffer[50];
_itoa(i->value,buffer,10);
m_propertyListBuffer.insertProperty(objectId, 11, buffer);
break;
}
case SetType::Command::CLEAR:
m_propertyListBuffer.clearProperties(objectId, 11);
break;
default:
FATAL(true,("Unknown AutoDeltaSet command.\n"));
}
}
}