本文整理汇总了C++中ActionList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionList::push_back方法的具体用法?C++ ActionList::push_back怎么用?C++ ActionList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionList
的用法示例。
在下文中一共展示了ActionList::push_back方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextMenuActions
ActionList QDesignerMenuBar::contextMenuActions()
{
ActionList rc;
if (QAction *action = safeActionAt(m_currentIndex)) {
if (!qobject_cast<SpecialMenuAction*>(action)) {
QVariant itemData;
itemData.setValue(action);
QAction *remove_action = new QAction(tr("Remove Menu '%1'").arg(action->menu()->objectName()), 0);
remove_action->setData(itemData);
connect(remove_action, SIGNAL(triggered()), this, SLOT(deleteMenu()));
rc.push_back(remove_action);
QAction *sep = new QAction(0);
sep->setSeparator(true);
rc.push_back(sep);
}
}
m_promotionTaskMenu->addActions(formWindow(), PromotionTaskMenu::TrailingSeparator, rc);
QAction *remove_menubar = new QAction(tr("Remove Menu Bar"), 0);
connect(remove_menubar, SIGNAL(triggered()), this, SLOT(slotRemoveMenuBar()));
rc.push_back(remove_menubar);
return rc;
}
示例2: make_actions
ActionList make_actions(boost::program_options::variables_map & po) {
using std::string;
ActionList ret;
if (po.count("exec")) {
string t = po["exec"].as<string>();
boost::regex e("^(.*)(\\;|\\+)$");
boost::smatch s;
if (regex_match(t, s, e)) {
string text = string(s[1].first, s[1].second);
string action = string(s[2].first, s[2].second);
if (action == ";") ret.push_back(new ExecAction(text));
else ret.push_back(new ExecAllAction(text));
}
else throw std::invalid_argument("Invalid exec argument: " + t);
}
if (po.count("print") || (ret.size() == 0)) {
ret.push_back(new PrintAction);
}
return ret;
}
示例3: if
const CKeyBindings::ActionList&
CKeyBindings::GetActionList(const CKeySet& ks) const
{
static const ActionList empty;
const ActionList* alPtr = NULL;
if (ks.AnyMod()) {
KeyMap::const_iterator it = bindings.find(ks);
if (it == bindings.end()) {
alPtr = ∅
} else {
alPtr = &(it->second);
}
}
else {
// have to check for an AnyMod keyset as well as the normal one
CKeySet anyMod = ks;
anyMod.SetAnyBit();
KeyMap::const_iterator nit = bindings.find(ks);
KeyMap::const_iterator ait = bindings.find(anyMod);
const bool haveNormal = (nit != bindings.end());
const bool haveAnyMod = (ait != bindings.end());
if (!haveNormal && !haveAnyMod) {
alPtr = ∅
}
else if (haveNormal && !haveAnyMod) {
alPtr = &(nit->second);
}
else if (!haveNormal && haveAnyMod) {
alPtr = &(ait->second);
}
else {
// combine the two lists (normal first)
static ActionList merged;
merged = nit->second;
const ActionList& aal = ait->second;
for (int i = 0; i < (int)aal.size(); ++i) {
merged.push_back(aal[i]);
}
alPtr = &merged;
}
}
if (LOG_IS_ENABLED(L_DEBUG)) {
const bool isEmpty = (alPtr == &empty);
LOG_L(L_DEBUG, "GetAction: %s (0x%03X)%s",
ks.GetString(false).c_str(), ks.Key(),
(isEmpty ? " EMPTY" : ""));
if (!isEmpty) {
const ActionList& al = *alPtr;
for (size_t i = 0; i < al.size(); ++i) {
LOG_L(L_DEBUG, " %s \"%s\"",
al[i].command.c_str(), al[i].rawline.c_str());
}
}
}
return *alPtr;
}
示例4: readActionsFile
RobotInterface::ActionList RobotInterface::XMLReader::Private::readActionsTag(TiXmlElement *actionsElem)
{
const std::string &valueStr = actionsElem->ValueStr();
if (valueStr.compare("actions") != 0) {
SYNTAX_ERROR(actionsElem->Row()) << "Expected \"actions\". Found" << valueStr;
}
std::string filename;
if (actionsElem->QueryStringAttribute("file", &filename) == TIXML_SUCCESS) {
// yDebug() << "Found actions file [" << filename << "]";
#ifdef WIN32
std::replace(filename.begin(), filename.end(), '/', '\\');
filename = path + "\\" + filename;
#else // WIN32
filename = path + "/" + filename;
#endif //WIN32
return readActionsFile(filename);
}
std::string robotName;
if (actionsElem->QueryStringAttribute("robot", &robotName) != TIXML_SUCCESS) {
SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"robot\" attribute";
}
if (robotName != robot.name()) {
SYNTAX_WARNING(actionsElem->Row()) << "Trying to import a file for the wrong robot. Found" << robotName << "instead of" << robot.name();
}
unsigned int build;
#if TINYXML_UNSIGNED_INT_BUG
if (actionsElem->QueryUnsignedAttribute("build", &build()) != TIXML_SUCCESS) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
}
#else
int tmp;
if (actionsElem->QueryIntAttribute("build", &tmp) != TIXML_SUCCESS || tmp < 0) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
tmp = 0;
}
build = (unsigned)tmp;
#endif
if (build != robot.build()) {
SYNTAX_WARNING(actionsElem->Row()) << "Import a file for a different robot build. Found" << build << "instead of" << robot.build();
}
ActionList actions;
for (TiXmlElement* childElem = actionsElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
ActionList childActions = readActions(childElem);
for (ActionList::const_iterator it = childActions.begin(); it != childActions.end(); ++it) {
actions.push_back(*it);
}
}
return actions;
}
示例5: contextMenuActions
ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
{
ActionList rc;
const int index = actionIndexAt(m_toolBar, m_toolBar->mapFromGlobal(globalPos), m_toolBar->orientation());
const ActionList actions = m_toolBar->actions();
QAction *action = index != -1 ?actions.at(index) : 0;
QVariant itemData;
// Insert before
if (action && index != 0 && !action->isSeparator()) {
QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), 0);
itemData.setValue(action);
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
rc.push_back(newSeperatorAct);
}
// Append separator
if (actions.empty() || !actions.back()->isSeparator()) {
QAction *newSeperatorAct = new QAction(tr("Append Separator"), 0);
itemData.setValue(static_cast<QAction*>(0));
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
rc.push_back(newSeperatorAct);
}
// Promotion
if (!m_promotionTaskMenu)
m_promotionTaskMenu = new PromotionTaskMenu(m_toolBar, PromotionTaskMenu::ModeSingleWidget, this);
m_promotionTaskMenu->addActions(formWindow(), PromotionTaskMenu::LeadingSeparator|PromotionTaskMenu::TrailingSeparator, rc);
// Remove
if (action) {
QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), 0);
itemData.setValue(action);
a->setData(itemData);
connect(a, SIGNAL(triggered()), this, SLOT(slotRemoveSelectedAction()));
rc.push_back(a);
}
QAction *remove_toolbar = new QAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()), 0);
connect(remove_toolbar, SIGNAL(triggered()), this, SLOT(slotRemoveToolBar()));
rc.push_back(remove_toolbar);
return rc;
}
示例6: GetActionList
const CKeyBindings::ActionList& CKeyBindings::GetActionList(const CKeyChain& kc) const
{
static ActionList out; //FIXME switch to thread_local when all buildbots are using >=gcc4.7
out.clear();
if (kc.empty())
return out;
const CKeyBindings::ActionList& al = GetActionList(kc.back());
for (const Action& action: al) {
if (kc.fit(action.keyChain))
out.push_back(action);
}
return out;
}
示例7: readActionsTag
RobotInterface::ActionList RobotInterface::XMLReader::Private::readActions(TiXmlElement *actionsElem)
{
const std::string &valueStr = actionsElem->ValueStr();
if (valueStr.compare("action") != 0 &&
valueStr.compare("actions") != 0)
{
SYNTAX_ERROR(actionsElem->Row()) << "Expected \"action\" or \"actions\". Found" << valueStr;
}
if (valueStr.compare("action") == 0) {
ActionList actionList;
actionList.push_back(readActionTag(actionsElem));
return actionList;
}
// "actions"
return readActionsTag(actionsElem);
}
示例8: CreateOrFindPaths
PathAction* DebugMenu::CreateOrFindPaths(std::vector<String>& paths, PathAction* action)
{
if (paths.empty())
return action;
String name = paths.front();
paths.erase(paths.begin());
ActionList* actionList = action ? &action->actionList : &m_ActionList;
for (IAction* a : *actionList)
{
if (a->type == IAction::Type::PATH && a->name == name)
return CreateOrFindPaths(paths, (PathAction*)a);
}
PathAction* pathAction = spnew PathAction(name, action);
actionList->push_back(pathAction);
return CreateOrFindPaths(paths, pathAction);
}
示例9: readAction
void Resource::readAction(Common::File *file, ActionList &list) {
list.clear();
while (file->readByte() == 1) {
list.push_back(Action());
Action &action = list.back();
action._actionType = (ActionType)file->readSint16LE();
action._param1 = file->readSint16LE();
action._param2 = file->readSint16LE();
action._param3 = file->readSint16LE();
if (action._actionType == kActionShowMessages) {
action._messages.reserve(action._param1);
for (int i = 0; i < action._param1; i++)
action._messages.push_back(readString(file));
} else {
action._messages.push_back(readString(file));
}
}
}
示例10: i
void
TransDispatcher::Subscribe( ushort type, ActionPtr action )
{
K_ASSERT( type > 0 );
K_ASSERT( action.Get() != 0 );
ActionMap::iterator i( m_actions.find( type ) );
if ( i == m_actions.end() )
{
ActionList lst;
lst.push_back( action );
m_actions.insert( ActionMap::value_type( type, lst ) );
}
else
{
ActionList& lst = i->second;
lst.push_back( action );
}
}
示例11: BuildActions
void Driver::BuildActions(const ArgList &Args, ActionList &Actions) const {
llvm::PrettyStackTraceString CrashInfo("Building compilation actions");
// Start by constructing the list of inputs and their types.
// Track the current user specified (-x) input. We also explicitly
// track the argument used to set the type; we only want to claim
// the type when we actually use it, so we warn about unused -x
// arguments.
types::ID InputType = types::TY_Nothing;
Arg *InputTypeArg = 0;
llvm::SmallVector<std::pair<types::ID, const Arg*>, 16> Inputs;
for (ArgList::const_iterator it = Args.begin(), ie = Args.end();
it != ie; ++it) {
Arg *A = *it;
if (isa<InputOption>(A->getOption())) {
const char *Value = A->getValue(Args);
types::ID Ty = types::TY_INVALID;
// Infer the input type if necessary.
if (InputType == types::TY_Nothing) {
// If there was an explicit arg for this, claim it.
if (InputTypeArg)
InputTypeArg->claim();
// stdin must be handled specially.
if (memcmp(Value, "-", 2) == 0) {
// If running with -E, treat as a C input (this changes the
// builtin macros, for example). This may be overridden by
// -ObjC below.
//
// Otherwise emit an error but still use a valid type to
// avoid spurious errors (e.g., no inputs).
if (!Args.hasArg(options::OPT_E, false))
Diag(clang::diag::err_drv_unknown_stdin_type);
Ty = types::TY_C;
} else {
// Otherwise lookup by extension, and fallback to ObjectType
// if not found. We use a host hook here because Darwin at
// least has its own idea of what .s is.
if (const char *Ext = strrchr(Value, '.'))
Ty = Host->lookupTypeForExtension(Ext + 1);
if (Ty == types::TY_INVALID)
Ty = types::TY_Object;
}
// -ObjC and -ObjC++ override the default language, but only for "source
// files". We just treat everything that isn't a linker input as a
// source file.
//
// FIXME: Clean this up if we move the phase sequence into the type.
if (Ty != types::TY_Object) {
if (Args.hasArg(options::OPT_ObjC))
Ty = types::TY_ObjC;
else if (Args.hasArg(options::OPT_ObjCXX))
Ty = types::TY_ObjCXX;
}
} else {
assert(InputTypeArg && "InputType set w/o InputTypeArg");
InputTypeArg->claim();
Ty = InputType;
}
// Check that the file exists. It isn't clear this is worth
// doing, since the tool presumably does this anyway, and this
// just adds an extra stat to the equation, but this is gcc
// compatible.
if (memcmp(Value, "-", 2) != 0 && !llvm::sys::Path(Value).exists())
Diag(clang::diag::err_drv_no_such_file) << A->getValue(Args);
else
Inputs.push_back(std::make_pair(Ty, A));
} else if (A->getOption().isLinkerInput()) {
// Just treat as object type, we could make a special type for
// this if necessary.
Inputs.push_back(std::make_pair(types::TY_Object, A));
} else if (A->getOption().getId() == options::OPT_x) {
InputTypeArg = A;
InputType = types::lookupTypeForTypeSpecifier(A->getValue(Args));
// Follow gcc behavior and treat as linker input for invalid -x
// options. Its not clear why we shouldn't just revert to
// unknown; but this isn't very important, we might as well be
// bug comatible.
if (!InputType) {
Diag(clang::diag::err_drv_unknown_language) << A->getValue(Args);
InputType = types::TY_Object;
}
}
}
if (!SuppressMissingInputWarning && Inputs.empty()) {
Diag(clang::diag::err_drv_no_input_files);
return;
}
// Determine which compilation mode we are in. We look for options
//.........这里部分代码省略.........
示例12: BuildUniversalActions
void Driver::BuildUniversalActions(const ArgList &Args,
ActionList &Actions) const {
llvm::PrettyStackTraceString CrashInfo("Building actions for universal build");
// Collect the list of architectures. Duplicates are allowed, but
// should only be handled once (in the order seen).
llvm::StringSet<> ArchNames;
llvm::SmallVector<const char *, 4> Archs;
for (ArgList::const_iterator it = Args.begin(), ie = Args.end();
it != ie; ++it) {
Arg *A = *it;
if (A->getOption().getId() == options::OPT_arch) {
const char *Name = A->getValue(Args);
// FIXME: We need to handle canonicalization of the specified
// arch?
A->claim();
if (ArchNames.insert(Name))
Archs.push_back(Name);
}
}
// When there is no explicit arch for this platform, make sure we
// still bind the architecture (to the default) so that -Xarch_ is
// handled correctly.
if (!Archs.size())
Archs.push_back(0);
// FIXME: We killed off some others but these aren't yet detected in
// a functional manner. If we added information to jobs about which
// "auxiliary" files they wrote then we could detect the conflict
// these cause downstream.
if (Archs.size() > 1) {
// No recovery needed, the point of this is just to prevent
// overwriting the same files.
if (const Arg *A = Args.getLastArg(options::OPT_save_temps))
Diag(clang::diag::err_drv_invalid_opt_with_multiple_archs)
<< A->getAsString(Args);
}
ActionList SingleActions;
BuildActions(Args, SingleActions);
// Add in arch binding and lipo (if necessary) for every top level
// action.
for (unsigned i = 0, e = SingleActions.size(); i != e; ++i) {
Action *Act = SingleActions[i];
// Make sure we can lipo this kind of output. If not (and it is an
// actual output) then we disallow, since we can't create an
// output file with the right name without overwriting it. We
// could remove this oddity by just changing the output names to
// include the arch, which would also fix
// -save-temps. Compatibility wins for now.
if (Archs.size() > 1 && !types::canLipoType(Act->getType()))
Diag(clang::diag::err_drv_invalid_output_with_multiple_archs)
<< types::getTypeName(Act->getType());
ActionList Inputs;
for (unsigned i = 0, e = Archs.size(); i != e; ++i)
Inputs.push_back(new BindArchAction(Act, Archs[i]));
// Lipo if necessary, We do it this way because we need to set the
// arch flag so that -Xarch_ gets overwritten.
if (Inputs.size() == 1 || Act->getType() == types::TY_Nothing)
Actions.append(Inputs.begin(), Inputs.end());
else
Actions.push_back(new LipoJobAction(Inputs, Act->getType()));
}
}
示例13: push_back
void push_back(ActionItem *v)
{
actions.push_back(v);
}
示例14: if
const CKeyBindings::ActionList&
CKeyBindings::GetActionList(const CKeySet& ks) const
{
static const ActionList empty;
const ActionList* alPtr = NULL;
if (ks.AnyMod()) {
KeyMap::const_iterator it = bindings.find(ks);
if (it == bindings.end()) {
alPtr = ∅
} else {
alPtr = &(it->second);
}
}
else {
// have to check for an AnyMod keyset as well as the normal one
CKeySet anyMod = ks;
anyMod.SetAnyBit();
KeyMap::const_iterator nit = bindings.find(ks);
KeyMap::const_iterator ait = bindings.find(anyMod);
const bool haveNormal = (nit != bindings.end());
const bool haveAnyMod = (ait != bindings.end());
if (!haveNormal && !haveAnyMod) {
alPtr = ∅
}
else if (haveNormal && !haveAnyMod) {
alPtr = &(nit->second);
}
else if (!haveNormal && haveAnyMod) {
alPtr = &(ait->second);
}
else {
// combine the two lists (normal first)
static ActionList merged;
merged = nit->second;
const ActionList& aal = ait->second;
for (int i = 0; i < (int)aal.size(); ++i) {
merged.push_back(aal[i]);
}
alPtr = &merged;
}
}
if (debug > 0) {
char buf[256];
SNPRINTF(buf, sizeof(buf), "GetAction: %s (0x%03X)",
ks.GetString(false).c_str(), ks.Key());
if (alPtr == &empty) {
strncat(buf, " EMPTY", sizeof(buf));
logOutput.Print("%s", buf);
}
else {
logOutput.Print("%s", buf);
const ActionList& al = *alPtr;
for (int i = 0; i < (int)al.size(); ++i) {
SNPRINTF(buf, sizeof(buf), " %s \"%s\"",
al[i].command.c_str(), al[i].rawline.c_str());
logOutput.Print("%s", buf);
}
}
}
return *alPtr;
}