本文整理汇总了C++中ArgumentList类的典型用法代码示例。如果您正苦于以下问题:C++ ArgumentList类的具体用法?C++ ArgumentList怎么用?C++ ArgumentList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArgumentList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unmarshalUInt
ArgumentList *unmarshalArgumentList(StorageIntf *s)
{
uint i;
uint count = unmarshalUInt(s);
if (count==NULL_LIST) return 0; // null list
ArgumentList *result = new ArgumentList;
assert(count<1000000);
//printf("unmarshalArgumentList: %d\n",count);
for (i=0;i<count;i++)
{
Argument *a = new Argument;
a->attrib = unmarshalQCString(s);
a->type = unmarshalQCString(s);
a->canType = unmarshalQCString(s);
a->name = unmarshalQCString(s);
a->array = unmarshalQCString(s);
a->defval = unmarshalQCString(s);
a->docs = unmarshalQCString(s);
result->append(a);
}
result->constSpecifier = unmarshalBool(s);
result->volatileSpecifier = unmarshalBool(s);
result->pureSpecifier = unmarshalBool(s);
return result;
}
示例2: makeFunction
QString makeFunction(FunctionModelItem function, const QString preFix = QString()) {
QString fullName;
fullName += function->type().toString();
fullName += " ";
fullName += preFix;
fullName += function->name();
ArgumentList arguments = function->arguments();
QStringList args;
for (int i = 0; i < arguments.count(); ++i) {
QString arg = arguments[i]->name();
if (arg.isEmpty())
arg = QString("arg%1").arg(i);
QString theargs = arguments[i]->type().toString() + " " + arg;
if (arguments[i]->defaultValue())
theargs += " = " + arguments[i]->defaultValueExpression();
args += theargs;
}
fullName += "(" + args.join(", ") + ")";
if (function->isConstant())
fullName += " const";
if (function->isStatic())
fullName = "static " + fullName;
return fullName;
}
示例3: it
ClassDef *GenericsSDict::find(const QCString &key)
{
int i=key.find('<');
if (i==-1)
{
GenericsCollection *collection = m_dict.find(key);
if (collection && collection->count()==1)
{
QIntDictIterator<ClassDef> it(*collection);
return it.current();
}
}
else
{
GenericsCollection *collection = m_dict.find(key.left(i));
if (collection)
{
ArgumentList argList;
stringToArgumentList(key.mid(i),&argList);
int c = argList.count();
return collection->find(c);
}
}
return 0;
}
示例4: guard
void UDPEchoClient::onReadyRead () {
{
LockGuard guard (mMutex);
if (mState != WAIT) return; // ignoring; timeout.
// Check protocol
String from;
int fromPort;
ByteArrayPtr data = mSocket.recvFrom(&from,&fromPort);
if (!data) {
Log (LogWarning) << LOGID << "Could not read any data tough readyRead() signal" << std::endl;
return; // ?
}
String toParse (data->const_c_array(), data->size());
ArgumentList list;
sf::argSplit (toParse, &list);
// Format: TOKEN IP-Address Port
if (list.size() != 4 || list[0] != "condataReply") {
Log (LogInfo) << LOGID << "Invalid protocol in answer " << *data << ", token=" << list.size() << std::endl;
return; // invalid protocol
}
if (list[1] != mToken){
Log (LogInfo) << LOGID << "Token mismatch in answer " << *data << std::endl;
return; // invalid token
}
mState = READY;
mAddress = list[2];
mPort = atoi (list[3].c_str());
Log (LogInfo) << LOGID << "Successfully decoded echo answer: " << mAddress << ":" << mPort << " coming from " << from << ":" << fromPort << std::endl;
sf::cancelTimer(mTimeoutHandle);
}
mResultDelegate (NoError);
}
示例5: main
int main(int argc, const char **argv)
{
unitTests();
Settings settings;
ArgumentList args = gatherArguments(argc, argv, settings);
// TODO: Probably don't want to share them between files
Bindings bindings = bindStandardLibrary();
Interpreter interpreter(bindings, settings);
if (args.empty())
{
repl(interpreter, settings);
}
else
{
for (ArgumentList::const_iterator it = args.begin() ; it != args.end() ; ++it)
{
execute(interpreter, *it, settings);
}
}
// If you use CTRL-D, nice to output a newline...
std::cout << '\n';
}
示例6: stringToArgumentList
QSharedPointer<ClassDef> GenericsSDict::find(const QString &key)
{
int i = key.indexOf('<');
if (i == -1) {
QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key);
if (collection && collection->count() == 1) {
return collection->begin().value();
}
} else {
QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i));
if (collection) {
ArgumentList argList;
stringToArgumentList(key.mid(i), &argList);
int c = argList.count();
return collection->value(c);
}
}
return QSharedPointer<ClassDef>();
}
示例7: arguments
Parser::ArgumentList Parser::arguments(istream* input)
{
ArgumentList list;
get_token(input);
for(;;)
{
if(curr_sym.curr_tok == Lexer::RP)
{
return list;
}
else if (curr_sym.curr_tok == Lexer::SEP)
{
get_token(input);
continue;
}
else if (curr_sym.curr_tok == Lexer::PRINT || curr_sym.curr_tok == Lexer::END)
{
throw Error::SyntaxError(") expected");
}
else
{
list.push_back(expr(input, false));
}
}
}
示例8: findArguments
ArgumentList ArgumentParser::findArguments(const Option& option) const
{
ArgumentList args;
foreach (auto& arg, m_arguments)
if (&option == arg.option)
args.push_back(arg);
return args;
}
示例9: findUnknownArguments
ArgumentList ArgumentParser::findUnknownArguments() const
{
ArgumentList args;
foreach (auto& arg, m_arguments)
if (!arg.isKnown())
args.push_back(arg);
return args;
}
示例10: getOutputArgumentList
void Action::clearOutputAgumentValues() {
ArgumentList *outArgList = getOutputArgumentList();
int nArgs = outArgList->size();
for (int n = 0; n < nArgs; n++) {
Argument *arg = outArgList->getArgument(n);
arg->setValue("");
}
}
示例11: main
int main(int argc, char** argv)
{
QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
// The QApplication will strip its args from argc/argv, so we want to do
// this before putting the command-line args into our ArgumentList, or we
// will try to open the Qt args as data files.
QApplication app(argc, argv);
SystemServicesImp::instance()->WriteLogInfo(QString("%1 Startup").arg(APP_NAME).toStdString());
// Register the command line options
ArgumentList* pArgumentList = ArgumentList::instance();
if (pArgumentList == NULL)
{
SystemServicesImp::instance()->WriteLogInfo(QString("%1 Shutdown").arg(APP_NAME).toStdString());
return -1;
}
pArgumentList->registerOption("input");
pArgumentList->registerOption("deployment");
pArgumentList->registerOption("debugDeployment");
pArgumentList->registerOption("exitAfterWizards");
pArgumentList->registerOption("generate");
pArgumentList->registerOption("processors");
pArgumentList->registerOption("");
pArgumentList->set(argc, argv);
// Run the application
InteractiveApplication interactiveApp(app);
int success = interactiveApp.run(argc, argv);
SystemServicesImp::instance()->WriteLogInfo(QString("%1 Shutdown").arg(APP_NAME).toStdString());
return success;
}
示例12: ExtractArguments
int FITSHeaderProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv, ArgumentItemMode::AsViews,
ArgumentOption::AllowWildcards|ArgumentOption::NoPreviews );
FITSHeaderInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
throw Error( "Unknown numeric argument: " + arg.Token() );
else if ( arg.IsString() )
throw Error( "Unknown string argument: " + arg.Token() );
else if ( arg.IsSwitch() )
throw Error( "Unknown switch argument: " + arg.Token() );
else if ( arg.IsLiteral() )
throw Error( "Unknown argument: " + arg.Token() );
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
continue;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
}
if ( launchInterface )
instance.LaunchInterface();
else if ( count == 0 )
{
if ( ImageWindow::ActiveWindow().IsNull() )
throw Error( "There is no active image window." );
instance.LaunchOnCurrentWindow();
}
return 0;
}
示例13: get_variable
std::string PageTemplate::get_variable(const ArgumentList& arguments, const ArrayArgument::Item* arrayItem, const std::string& var) const
{
if (arrayItem != 0)
{
ArrayArgument::Item::const_iterator i = arrayItem->find(var);
if (i != arrayItem->end())
return i->second;
}
ArgumentList::const_iterator i = arguments.find(var);
return i == arguments.end() ? std::string() : i->second->to_string();
}
示例14: InsertMacro
void InsertMacro(CMacro* Macro, std::wstring& Args)
{
tTextData Text;
ArgumentList Arguments;
splitArguments(Arguments,Args);
if ((int)Arguments.size() != Macro->getArgumentCount())
{
Logger::printError(Logger::Error,L"%s macro arguments (%d vs %d)",
(int)Arguments.size() > Macro->getArgumentCount() ? L"Too many" : L"Not enough",
Arguments.size(),Macro->getArgumentCount());
return;
}
Global.MacroNestingLevel++;
if (Global.MacroNestingLevel == ASSEMBLER_MACRO_NESTING_LEVEL)
{
Logger::printError(Logger::Error,L"Maximum macro nesting level reached");
return;
}
int MacroCounter = Macro->getIncreaseCounter();
for (int i = 0; i < Macro->getLineCount(); i++)
{
Text.buffer = Macro->getLine(i,Arguments,MacroCounter);
Text.buffer = Global.symbolTable.insertEquations(Text.buffer,Global.FileInfo.FileNum,Global.Section);
if (CheckEquLabel(Text.buffer) == false)
{
Text.buffer = checkLabel(Text.buffer,false);
splitLine(Text.buffer,Text.name,Text.params);
if (Text.name.size() == 0) continue;
bool macro = false;
for (size_t i = 0; i < Global.Macros.size(); i++)
{
if (Text.name.compare(Global.Macros[i]->getName()) == 0)
{
InsertMacro(Global.Macros[i],Text.params);
macro = true;
}
}
if (macro == true) continue;
if (Arch->AssembleDirective(Text.name,Text.params) == false)
{
Arch->AssembleOpcode(Text.name,Text.params);
}
}
}
Global.MacroNestingLevel--;
}
示例15: Invoke
Variant Invoke(Variant &obj, const ArgumentList &arguments) override
{
UAssert( arguments.size( ) == THIS_ARG_COUNT,
"Invalid method arguments.\nExpected %i args but got %i.",
THIS_ARG_COUNT,
arguments.size( )
);
invoke<void, ArgTypes...>( obj, arguments );
return { };
}