本文整理汇总了C++中StringSeq::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ StringSeq::empty方法的具体用法?C++ StringSeq::empty怎么用?C++ StringSeq::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringSeq
的用法示例。
在下文中一共展示了StringSeq::empty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newCallback
IceBox::ServiceManagerI::ServiceManagerI(CommunicatorPtr communicator, int& argc, char* argv[]) :
_communicator(communicator),
_adminEnabled(false),
_pendingStatusChanges(false),
_traceServiceObserver(0)
{
#ifndef ICE_CPP11_MAPPING
const_cast<CallbackPtr&>(_observerCompletedCB) = newCallback(this, &ServiceManagerI::observerCompleted);
#endif
_logger = _communicator->getLogger();
PropertiesPtr props = _communicator->getProperties();
_traceServiceObserver = props->getPropertyAsInt("IceBox.Trace.ServiceObserver");
if(props->getProperty("Ice.Admin.Enabled") == "")
{
_adminEnabled = props->getProperty("Ice.Admin.Endpoints") != "";
}
else
{
_adminEnabled = props->getPropertyAsInt("Ice.Admin.Enabled") > 0;
}
if(_adminEnabled)
{
StringSeq facetSeq = props->getPropertyAsList("Ice.Admin.Facets");
if(!facetSeq.empty())
{
_adminFacetFilter.insert(facetSeq.begin(), facetSeq.end());
}
}
for(int i = 1; i < argc; i++)
{
_argv.push_back(argv[i]);
}
}
示例2: string
int
Activator::activate(const string& name,
const string& exePath,
const string& pwdPath,
#ifndef _WIN32
uid_t uid,
gid_t gid,
#endif
const Ice::StringSeq& options,
const Ice::StringSeq& envs,
const ServerIPtr& server)
{
IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
if(_deactivating)
{
throw string("The node is being shutdown.");
}
string path = exePath;
if(path.empty())
{
throw string("The server executable path is empty.");
}
string pwd = IcePatch2Internal::simplify(pwdPath);
#ifdef _WIN32
if(!IceUtilInternal::isAbsolutePath(path))
{
if(path.find('/') == string::npos)
{
//
// Get the absolute pathname of the executable.
//
wchar_t absbuf[_MAX_PATH];
wchar_t* fPart;
wstring ext = path.size() <= 4 || path[path.size() - 4] != '.' ? L".exe" : L"";
//
// IceGrid doesn't support to use string converters, so don't need to use
// any string converter in wstringToString conversions.
//
if(SearchPathW(NULL, IceUtil::stringToWstring(path).c_str(), ext.c_str(), _MAX_PATH, absbuf, &fPart) == 0)
{
if(_traceLevels->activator > 0)
{
Trace out(_traceLevels->logger, _traceLevels->activatorCat);
out << "couldn't find `" << path << "' executable.";
}
throw string("Couldn't find `" + path + "' executable.");
}
path = IceUtil::wstringToString(absbuf);
}
else if(!pwd.empty())
{
path = pwd + "/" + path;
}
}
//
// Get the absolute pathname of the working directory.
//
// IceGrid doesn't support to use string converters, so
// don't need to use any string converter in stringToWstring
// conversions.
//
if(!pwd.empty())
{
wchar_t absbuf[_MAX_PATH];
if(_wfullpath(absbuf, IceUtil::stringToWstring(pwd).c_str(), _MAX_PATH) == NULL)
{
if(_traceLevels->activator > 0)
{
Trace out(_traceLevels->logger, _traceLevels->activatorCat);
out << "cannot convert `" << pwd << "' into an absolute path";
}
throw string("The server working directory path `" + pwd + "' can't be converted into an absolute path.");
}
pwd = IceUtil::wstringToString(absbuf);
}
#endif
//
// Setup arguments.
//
StringSeq args;
args.push_back(path);
args.insert(args.end(), options.begin(), options.end());
if(_traceLevels->activator > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
out << "activating server `" << name << "'";
if(_traceLevels->activator > 1)
{
out << "\n";
out << "path = " << path << "\n";
if(pwd.empty())
{
string cwd;
//.........这里部分代码省略.........
示例3: fs
int
Client::run(int argc, char* argv[])
{
IceUtilInternal::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
opts.addOpt("d", "debug");
opts.addOpt("", "import", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "export", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "dbhome", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "dbpath", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "mapsize", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "server-version", IceUtilInternal::Options::NeedArg);
vector<string> args;
try
{
args = opts.parse(argc, const_cast<const char**>(argv));
}
catch(const IceUtilInternal::BadOptException& e)
{
cerr << e.reason << endl;
usage();
return EXIT_FAILURE;
}
if(!args.empty())
{
cerr << argv[0] << ": too many arguments" << endl;
usage();
return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
usage();
return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
if(!(opts.isSet("import") ^ opts.isSet("export")))
{
cerr << "Either --import or --export must be set" << endl;
usage();
return EXIT_FAILURE;
}
if(!(opts.isSet("dbhome") ^ opts.isSet("dbpath")))
{
cerr << "Set the database environment directory with either --dbhome or --dbpath" << endl;
usage();
return EXIT_FAILURE;
}
bool debug = opts.isSet("debug");
bool import = opts.isSet("import");
string dbFile = opts.optArg(import ? "import" : "export");
string dbPath;
if(opts.isSet("dbhome"))
{
dbPath = opts.optArg("dbhome");
}
else
{
dbPath = opts.optArg("dbpath");
}
string mapSizeStr = opts.optArg("mapsize");
size_t mapSize = IceDB::getMapSize(atoi(mapSizeStr.c_str()));
string serverVersion = opts.optArg("server-version");
try
{
IceGrid::AllData data;
IceDB::IceContext dbContext;
dbContext.communicator = communicator();
dbContext.encoding.major = 1;
dbContext.encoding.minor = 1;
if(import)
{
cout << "Importing database to directory `" << dbPath << "' from file `" << dbFile << "'" << endl;
if(!IceUtilInternal::directoryExists(dbPath))
{
cerr << "Output directory does not exist: " << dbPath << endl;
return EXIT_FAILURE;
}
StringSeq files = IcePatch2Internal::readDirectory(dbPath);
if(!files.empty())
{
cerr << "Output directory is not empty: " << dbPath << endl;
return EXIT_FAILURE;
}
//.........这里部分代码省略.........
示例4: e
void
Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, StringSeq& cmdArgs)
{
assert(_communicator);
string entryPoint;
StringSeq args;
if(!pluginSpec.empty())
{
//
// Split the entire property value into arguments. An entry point containing spaces
// must be enclosed in quotes.
//
try
{
args = IceUtilInternal::Options::split(pluginSpec);
}
catch(const IceUtilInternal::BadOptException& ex)
{
PluginInitializationException e(__FILE__, __LINE__);
e.reason = "invalid arguments for plug-in `" + name + "':\n" + ex.reason;
throw e;
}
assert(!args.empty());
//
// Shift the arguments.
//
entryPoint = args[0];
args.erase(args.begin());
//
// Convert command-line options into properties. First we
// convert the options from the plug-in configuration, then
// we convert the options from the application command-line.
//
PropertiesPtr properties = _communicator->getProperties();
args = properties->parseCommandLineOptions(name, args);
cmdArgs = properties->parseCommandLineOptions(name, cmdArgs);
}
PluginFactory factory = 0;
DynamicLibraryPtr library;
//
// Always check the static plugin factory table first, it takes
// precedence over the the entryPoint specified in the plugin
// property value.
//
if(factories)
{
map<string, PluginFactory>::const_iterator p = factories->find(name);
if(p != factories->end())
{
factory = p->second;
}
}
//
// If we didn't find the factory, get the factory using the entry
// point symbol.
//
if(!factory)
{
assert(!entryPoint.empty());
library = new DynamicLibrary();
DynamicLibrary::symbol_type sym = library->loadEntryPoint(entryPoint);
if(sym == 0)
{
ostringstream out;
string msg = library->getErrorMessage();
out << "unable to load entry point `" << entryPoint << "'";
if(!msg.empty())
{
out << ": " + msg;
}
PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = out.str();
throw ex;
}
#ifdef __IBMCPP__
// xlC warns when casting a void* to function pointer
# pragma report(disable, "1540-0216")
#endif
factory = reinterpret_cast<PluginFactory>(sym);
}
//
// Invoke the factory function. No exceptions can be raised
// by the factory function because it's declared extern "C".
//
PluginPtr plugin(factory(_communicator, name, args));
if(!plugin)
{
PluginInitializationException e(__FILE__, __LINE__);
ostringstream out;
out << "failure in entry point `" << entryPoint << "'";
//.........这里部分代码省略.........
示例5: if
int
main(int argc, char* argv[])
#endif
{
Ice::StringSeq originalArgs = Ice::argsToStringSeq(argc, argv);
assert(originalArgs.size() > 0);
const string appName = originalArgs[0];
string dataDir;
StringSeq fileSeq;
int compress = 1;
bool verbose;
bool caseInsensitive;
IceUtilInternal::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
opts.addOpt("z", "compress");
opts.addOpt("Z", "no-compress");
opts.addOpt("V", "verbose");
opts.addOpt("i", "case-insensitive");
vector<string> args;
try
{
args = opts.parse(originalArgs);
}
catch(const IceUtilInternal::BadOptException& e)
{
cerr << e.reason << endl;
usage(appName);
return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
usage(appName);
return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
bool doCompress = opts.isSet("compress");
bool dontCompress = opts.isSet("no-compress");
if(doCompress && dontCompress)
{
cerr << appName << ": only one of -z and -Z are mutually exclusive" << endl;
usage(appName);
return EXIT_FAILURE;
}
if(doCompress)
{
compress = 2;
}
else if(dontCompress)
{
compress = 0;
}
verbose = opts.isSet("verbose");
caseInsensitive = opts.isSet("case-insensitive");
if(args.empty())
{
cerr << appName << ": no data directory specified" << endl;
usage(appName);
return EXIT_FAILURE;
}
dataDir = simplify(args[0]);
for(vector<string>::size_type i = 1; i < args.size(); ++i)
{
fileSeq.push_back(simplify(args[i]));
}
try
{
string absDataDir = dataDir;
string cwd;
if(IceUtilInternal::getcwd(cwd) != 0)
{
throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString();
}
if(!IceUtilInternal::isAbsolutePath(absDataDir))
{
absDataDir = simplify(cwd + '/' + absDataDir);
}
for(StringSeq::iterator p = fileSeq.begin(); p != fileSeq.end(); ++p)
{
if(!IceUtilInternal::isAbsolutePath(*p))
{
*p = cwd + '/' + *p;
}
}
//
//.........这里部分代码省略.........