本文整理汇总了C++中StringSeq类的典型用法代码示例。如果您正苦于以下问题:C++ StringSeq类的具体用法?C++ StringSeq怎么用?C++ StringSeq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringSeq类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getClassList
void ScriptSystem::getClassList(const char* prefix, bool sort, StringSeq& result) const {
ClassInfoDict::const_iterator it = m_classInfoReg.begin();
size_t prefixlen = 0;
if (prefix) {
prefixlen = strlen(prefix);
}
for (; it != m_classInfoReg.end(); ++it) {
ClassInfo* ci = it->second;
if (prefixlen) {
if (strncmp(prefix, ci->m_className.c_str(), prefixlen) != 0) {
continue;
}
result.push_back(ci->m_className.c_str() + prefixlen);
} else {
result.push_back(ci->m_className);
}
}
if (sort) {
std::sort(result.begin(), result.end(), std::less<String>());
}
}
示例2: while
void
Ice::stringSeqToArgs(const StringSeq& args, int& argc, char* argv[])
{
//
// Shift all elements in argv which are present in args to the
// beginning of argv.
//
int i = 0;
while(i < argc)
{
if(find(args.begin(), args.end(), argv[i]) == args.end())
{
for(int j = i; j < argc - 1; j++)
{
argv[j] = argv[j + 1];
}
--argc;
}
else
{
++i;
}
}
//
// Make sure that argv[argc] == 0, the ISO C++ standard requires this.
//
if(argv)
{
argv[argc] = 0;
}
}
示例3: _instance
IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) :
_instance(instance)
{
StringSeq retryValues = _instance->initializationData().properties->getPropertyAsList("Ice.RetryIntervals");
if(retryValues.size() == 0)
{
_retryIntervals.push_back(0);
}
else
{
for(StringSeq::const_iterator p = retryValues.begin(); p != retryValues.end(); ++p)
{
istringstream value(*p);
int v;
if(!(value >> v) || !value.eof())
{
v = 0;
}
//
// If -1 is the first value, no retry and wait intervals.
//
if(v == -1 && _retryIntervals.empty())
{
break;
}
_retryIntervals.push_back(v > 0 ? v : 0);
}
}
}
示例4: main
int main(int argc, char* argv[])
{
CoInitializeEx(NULL, 0);
Ice::InitializationData id = InitializationData();
id.properties = Ice::createProperties();
id.properties->load("config.server");
id.logger = new MyLoggerI();
Ice::initialize(argc, argv, id);
SyncService svc;
int status = EXIT_FAILURE;
#ifdef _WIN32
status = svc.main(argc, argv, id);
#else
//
// For UNIX, force --nochdir option, so the service isn't started
// with / as the working directory. That way, if the data
// directory is specified as a relative path, we don't
// misinterpret that path.
//
StringSeq args;
args.push_back(argv[0]);
args.push_back("--nochdir");
for(int i = 1; i < argc; ++i)
{
args.push_back(argv[i]);
}
status = svc.main(args);
#endif
return status;
}
示例5: findSensor
void golem::findSensor(const Sensor::Map& sensors, const StringSeq& idSeq, Sensor::Seq& sensorSeq) {
for (StringSeq::const_iterator i = idSeq.begin(); i != idSeq.end(); ++i) {
golem::Sensor::Map::const_iterator pSensor = std::find_if(sensors.begin(), sensors.end(), [=](const golem::Sensor::Map::value_type& val) -> bool { return val.first == *i; });
if (pSensor == sensors.end())
throw Message(Message::LEVEL_CRIT, "findSensor(): unknown sensor id: %s", i->c_str());
sensorSeq.push_back(pSensor->second.get());
}
}
示例6:
StringSeq golem::data::HandlerTrajectory::getProfiles() const {
StringSeq profiles;
for (auto& k : profileDescMap)
profiles.push_back(k.first);
return profiles;
}
示例7: out
void
IceInternal::ReferenceFactory::checkForUnknownProperties(const string& prefix)
{
static const string suffixes[] =
{
"EndpointSelection",
"ConnectionCached",
"PreferSecure",
"LocatorCacheTimeout",
"InvocationTimeout",
"Locator",
"Router",
"CollocationOptimized",
"Context.*"
};
//
// Do not warn about unknown properties list if Ice prefix, ie Ice, Glacier2, etc
//
for(const char** i = IceInternal::PropertyNames::clPropNames; *i != 0; ++i)
{
if(prefix.find(*i) == 0)
{
return;
}
}
StringSeq unknownProps;
PropertyDict props = _instance->initializationData().properties->getPropertiesForPrefix(prefix + ".");
for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p)
{
bool valid = false;
for(unsigned int i = 0; i < sizeof(suffixes)/sizeof(*suffixes); ++i)
{
string prop = prefix + "." + suffixes[i];
if(IceUtilInternal::match(p->first, prop))
{
valid = true;
break;
}
}
if(!valid)
{
unknownProps.push_back(p->first);
}
}
if(unknownProps.size())
{
Warning out(_instance->initializationData().logger);
out << "found unknown properties for proxy '" << prefix << "':";
for(unsigned int i = 0; i < unknownProps.size(); ++i)
{
out << "\n " << unknownProps[i];
}
}
}
示例8:
StringSeq
Ice::argsToStringSeq(int argc, char* argv[])
{
StringSeq result;
for(int i = 0; i < argc; i++)
{
result.push_back(argv[i]);
}
return result;
}
示例9: listFileByExts
StringSeq PathUtil::listFileByExts(const String& base, const String& path, const String& exts, uint_t flags) {
StringSeq strvec;
FileInfoSeq fileinfos;
fileinfos = getFileInfos(base, path, exts, flags);
for (size_t i=0; i<fileinfos.size(); i++) {
strvec.push_back(fileinfos[i].fullpath);
}
return strvec;
}
示例10: sync
StringSeq
Ice::PluginManagerI::getPlugins()
{
IceUtil::Mutex::Lock sync(*this);
StringSeq names;
for(PluginInfoList::iterator p = _plugins.begin(); p != _plugins.end(); ++p)
{
names.push_back(p->name);
}
return names;
}
示例11: defined
CommunicatorPtr
Ice::initialize(StringSeq& args, const InitializationData& initializationData, Int version)
{
int origArgc = 0;
char** argv = 0;
CommunicatorPtr communicator;
try
{
//
// Make a dummy argc/argv.
// (We can't use argsToStringSeq() because that requires an already initialized argv.)
//
int argc = static_cast<int>(args.size());
origArgc = argc;
argv = new char*[args.size() + 1];
int i;
for(i = 0; i != argc; ++i)
{
argv[i] = new char[args[i].size() + 1];
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
strcpy_s(argv[i], args[i].size() + 1, args[i].c_str());
#else
strcpy(argv[i], args[i].c_str());
#endif
}
argv[argc] = 0;
communicator = initialize(argc, argv, initializationData, version);
args = argsToStringSeq(argc, argv);
for(i = 0; i < origArgc; ++i)
{
delete[] argv[i];
}
delete[] argv;
}
catch(...)
{
for(int i = 0; i < origArgc; ++i)
{
delete[] argv[i];
}
delete[] argv;
throw;
}
return communicator;
}
示例12: string
bool
Ice::ObjectAdapterI::filterProperties(StringSeq& unknownProps)
{
static const string suffixes[] =
{
"AdapterId",
"Endpoints",
"Locator",
"PublishedEndpoints",
"RegisterProcess",
"ReplicaGroupId",
"Router",
"ThreadPerConnection",
"ThreadPerConnection.StackSize",
"ThreadPool.Size",
"ThreadPool.SizeMax",
"ThreadPool.SizeWarn",
"ThreadPool.StackSize"
};
//
// Do not create unknown properties list if Ice prefix, ie Ice, Glacier2, etc
//
bool addUnknown = true;
string prefix = _name + ".";
for(const char** i = IceInternal::PropertyNames::clPropNames; *i != 0; ++i)
{
string icePrefix = string(*i) + ".";
if(prefix.find(icePrefix) == 0)
{
addUnknown = false;
break;
}
}
bool noProps = true;
PropertyDict props = _instance->initializationData().properties->getPropertiesForPrefix(prefix);
PropertyDict::const_iterator p;
for(p = props.begin(); p != props.end(); ++p)
{
bool valid = false;
for(unsigned int i = 0; i < sizeof(suffixes)/sizeof(*suffixes); ++i)
{
string prop = prefix + suffixes[i];
if(p->first == prop)
{
noProps = false;
valid = true;
break;
}
}
if(!valid && addUnknown)
{
unknownProps.push_back(p->first);
}
}
return noProps;
}
示例13: tokenizeSeq
StringSeq StringUtil::tokenizeSeq(const char* text, char split /*= ' ' */) {
StringSeq result;
if (!text || !text[0])
return result;
String str;
const char* token = text;
for (; ;) {
/* skip whitespace */
while (*token && uint_t(*token) <= ' ' || *token == split) {
token++;
}
if (!*token) break;
str.clear();
// handle quoted strings
if (*token == '\"') {
token++;
while (*token && *token != '\"') {
str += *token++;
}
result.push_back(str);
str.clear();
if (!*token) {
break;
} else {
token++;
continue;
}
}
do {
str+=*token; token++;
} while (*token != 0 && *token != split);
result.push_back(str);
}
return result;
}
示例14: getProcessStringConverter
void
Ice::stringSeqToArgs(const StringSeq& args, int& argc, const wchar_t* argv[])
{
//
// Don't need to use a wide string converter argv is expected to
// come from Windows API.
//
const StringConverterPtr converter = getProcessStringConverter();
//
// Shift all elements in argv which are present in args to the
// beginning of argv. We record the original value of argc so
// that we can know later if we've shifted the array.
//
const int argcOrig = argc;
int i = 0;
while(i < argc)
{
if(find(args.begin(), args.end(), wstringToString(argv[i], converter)) == args.end())
{
for(int j = i; j < argc - 1; j++)
{
argv[j] = argv[j + 1];
}
--argc;
}
else
{
++i;
}
}
//
// Make sure that argv[argc] == 0, the ISO C++ standard requires this.
// We can only do this if we've shifted the array, otherwise argv[argc]
// may point to an invalid address.
//
if(argv && argcOrig != argc)
{
argv[argc] = 0;
}
}
示例15: _communicator
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]);
}
}