本文整理汇总了C++中PropertyDict类的典型用法代码示例。如果您正苦于以下问题:C++ PropertyDict类的具体用法?C++ PropertyDict怎么用?C++ PropertyDict使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertyDict类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateLinks
/**
* Updates link in given Panel according the src/dst names.
*/
void updateLinks( Panel& p )
{
bool change;
TemplateDict templates = p.templates();
for( unsigned int i = 0; i < templates.count(); ++i ) {
change=false;
LTMap<PropertyDict> pg = templates[i]->propertyGroups();
for( unsigned int j = 0; j < pg.count(); ++j ) {
PropertyDict pd = pg[j];
for( unsigned int k = 0; k < pd.count(); ++k ) {
if( pd[k]->type() == Property::LinkType ) {
if( pd[k]->encodeValue() == srcPanelName ) {
change=true;
pd[k]->decodeValue( dstPanelName );
}
}
}
}
if( change ) {
templates[i]->propertiesChanged();
}
}
}
示例2: Command
AddDelServerLoggingCommand::AddDelServerLoggingCommand(
const QString& name, const QString& type,
QMap<QString,QString> props,
ProjectWindow* pw, MainWindow* mw ) :
Command(pw, mw,
qApp->translate("AddDelServerLoggingCommand", "Add ServerLogging")),
d(new AddDelServerLoggingCommandPrivate)
{
Q_CHECK_PTR(d);
d->mode = AddDelServerLoggingCommandPrivate::Add;
d->cn = name;
d->ct = type;
d->props = props;
PropertyDict pd;
for(QMap<QString,QString>::const_iterator it = d->props.begin();
it != d->props.end(); ++it) {
Property* p = new Property(it.key(), "string", it.data());
Q_CHECK_PTR(p);
pd.insert(it.key(), p);
}
d->sl = new ServerLogging(d->ct, pd);
Q_CHECK_PTR(d->sl);
d->canDelete = true;
}
示例3: 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;
}
示例4: 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];
}
}
}
示例5: setPropertyGroupEnabled
void Template::setPropertyGroupEnabled( const QString & group, bool enabled )
{
if( d->propertyGroups.contains( group ) ) {
PropertyDict props = d->propertyGroups[ group ];
for( unsigned i = 0; i < props.count(); i ++ ) {
props[ i ]->setEnabled( enabled );
}
}
}
示例6: proxyToProperty
ObjectAdapterPtr
Ice::CommunicatorI::createObjectAdapterWithRouter(const string& name, const RouterPrxPtr& router)
{
string oaName = name;
if(oaName.empty())
{
oaName = IceUtil::generateUUID();
}
PropertyDict properties = proxyToProperty(router, oaName + ".Router");
for(PropertyDict::const_iterator p = properties.begin(); p != properties.end(); ++p)
{
getProperties()->setProperty(p->first, p->second);
}
return _instance->objectAdapterFactory()->createObjectAdapter(oaName, router);
}
示例7: updateViews
void
MetricsAdminI::updated(const PropertyDict& props)
{
for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p)
{
if(p->first.find("IceMX.") == 0)
{
// Udpate the metrics views using the new configuration.
try
{
updateViews();
}
catch(const std::exception& ex)
{
::Ice::Warning warn(_logger);
warn << "unexpected exception while updating metrics view configuration:\n" << ex.what();
}
return;
}
}
}
示例8: MCE_INFO
void Analyzer::reload(const PropertiesPtr& properties) {
MCE_INFO("Analyzer::reload type: " << type_);
int defaultmin = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.Min", INT_MIN);
int defaultmax = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.Max", INT_MAX);
int defaultmoremin = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.MoreMin", INT_MIN);
int defaultmoremax = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.MoreMax", INT_MAX);
LimiterPtr defaulter = new Limiter(defaultmoremin, defaultmin, defaultmax, defaultmoremax);
map<string, LimiterPtr> limits;
PropertyDict patterns = properties->getPropertiesForPrefix("Analyzer."+type_+".Patterns");
for (PropertyDict::iterator pattern = patterns.begin(); pattern != patterns.end(); ++pattern) {
vector<string> strings;
boost::algorithm::split(strings, pattern->second, boost::algorithm::is_any_of(" "));
limits[strings.at(0)]=new Limiter(lexical_cast<int>(strings.at(1)),lexical_cast<int>(strings.at(2)),lexical_cast<int>(strings.at(3)),lexical_cast<int>(strings.at(4)));
}
{
RWRecMutex::WLock lock(mutex_);
limits_ = limits;
default_ = defaulter;
}
MCE_DEBUG("Analyzer::reload done");
}
示例9: assert
void
Ice::PluginManagerI::loadPlugins(int& argc, const char* argv[])
{
assert(_communicator);
StringSeq cmdArgs = argsToStringSeq(argc, argv);
const string prefix = "Ice.Plugin.";
PropertiesPtr properties = _communicator->getProperties();
PropertyDict plugins = properties->getPropertiesForPrefix(prefix);
//
// First, load static plugin factories which were setup to load on
// communicator initialization. If a matching plugin property is
// set, we load the plugin with the plugin specification. The
// entryPoint will be ignored but the rest of the plugin
// specification might be used.
//
if(loadOnInitialization)
{
for(vector<string>::const_iterator p = loadOnInitialization->begin(); p != loadOnInitialization->end(); ++p)
{
string property = prefix + *p;
PropertyDict::iterator r = plugins.find(property + ".cpp");
if(r == plugins.end())
{
r = plugins.find(property);
}
else
{
plugins.erase(property);
}
if(r != plugins.end())
{
loadPlugin(*p, r->second, cmdArgs);
plugins.erase(r);
}
else
{
loadPlugin(*p, "", cmdArgs);
}
}
}
//
// Next, load and initialize the plug-ins defined in the property
// set with the prefix "Ice.Plugin.". These properties should have
// the following format:
//
// Ice.Plugin.name[.<language>]=entry_point [args]
//
// If the Ice.PluginLoadOrder property is defined, load the
// specified plug-ins in the specified order, then load any
// remaining plug-ins.
//
StringSeq loadOrder = properties->getPropertyAsList("Ice.PluginLoadOrder");
for(StringSeq::const_iterator p = loadOrder.begin(); p != loadOrder.end(); ++p)
{
string name = *p;
if(findPlugin(name))
{
PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = "plug-in `" + name + "' already loaded";
throw ex;
}
string property = prefix + name;
PropertyDict::iterator r = plugins.find(property + ".cpp");
if(r == plugins.end())
{
r = plugins.find(property);
}
else
{
plugins.erase(property);
}
if(r != plugins.end())
{
loadPlugin(name, r->second, cmdArgs);
plugins.erase(r);
}
else
{
PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = "plug-in `" + name + "' not defined";
throw ex;
}
}
//
// Load any remaining plug-ins that weren't specified in PluginLoadOrder.
//
while(!plugins.empty())
{
PropertyDict::iterator p = plugins.begin();
//.........这里部分代码省略.........
示例10: sync
void
MetricsAdminI::updateViews()
{
set<MetricsMapFactoryPtr> updatedMaps;
{
Lock sync(*this);
const string viewsPrefix = "IceMX.Metrics.";
PropertyDict viewsProps = _properties->getPropertiesForPrefix(viewsPrefix);
map<string, MetricsViewIPtr> views;
_disabledViews.clear();
for(PropertyDict::const_iterator p = viewsProps.begin(); p != viewsProps.end(); ++p)
{
string viewName = p->first.substr(viewsPrefix.size());
string::size_type dotPos = viewName.find('.');
if(dotPos != string::npos)
{
viewName = viewName.substr(0, dotPos);
}
if(views.find(viewName) != views.end() || _disabledViews.find(viewName) != _disabledViews.end())
{
continue; // View already configured.
}
validateProperties(viewsPrefix + viewName + ".", _properties);
if(_properties->getPropertyAsIntWithDefault(viewsPrefix + viewName + ".Disabled", 0) > 0)
{
_disabledViews.insert(viewName);
continue; // The view is disabled
}
//
// Create the view or update it.
//
map<string, MetricsViewIPtr>::const_iterator q = _views.find(viewName);
if(q == _views.end())
{
q = views.insert(map<string, MetricsViewIPtr>::value_type(viewName, new MetricsViewI(viewName))).first;
}
else
{
q = views.insert(make_pair(viewName, q->second)).first;
}
for(map<string, MetricsMapFactoryPtr>::const_iterator p = _factories.begin(); p != _factories.end(); ++p)
{
if(q->second->addOrUpdateMap(_properties, p->first, p->second, _logger))
{
updatedMaps.insert(p->second);
}
}
}
_views.swap(views);
//
// Go through removed views to collect maps to update.
//
for(map<string, MetricsViewIPtr>::const_iterator p = views.begin(); p != views.end(); ++p)
{
if(_views.find(p->first) == _views.end())
{
vector<string> maps = p->second->getMaps();
for(vector<string>::const_iterator q = maps.begin(); q != maps.end(); ++q)
{
updatedMaps.insert(_factories[*q]);
}
p->second->destroy();
}
}
}
//
// Call the updaters to update the maps.
//
for(set<MetricsMapFactoryPtr>::const_iterator p = updatedMaps.begin(); p != updatedMaps.end(); ++p)
{
(*p)->update();
}
}
示例11: communicator
bool
IceBox::IceBoxService::start(int argc, char* argv[], int& status)
{
// Run through the command line arguments removing all the service
// properties.
vector<string> args = Ice::argsToStringSeq(argc, argv);
PropertiesPtr properties = communicator()->getProperties();
const string prefix = "IceBox.Service.";
PropertyDict services = properties->getPropertiesForPrefix(prefix);
for(PropertyDict::const_iterator p = services.begin(); p != services.end(); ++p)
{
string name = p->first.substr(prefix.size());
StringSeq::iterator q = args.begin();
while(q != args.end())
{
if(q->find("--" + name + ".") == 0)
{
q = args.erase(q);
continue;
}
++q;
}
}
IceUtilInternal::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
try
{
args = opts.parse(args);
}
catch(const IceUtilInternal::BadOptException& e)
{
error(e.reason);
usage(argv[0]);
return false;
}
if(opts.isSet("help"))
{
usage(argv[0]);
status = EXIT_SUCCESS;
return false;
}
if(opts.isSet("version"))
{
print(ICE_STRING_VERSION);
status = EXIT_SUCCESS;
return false;
}
if(!args.empty())
{
usage(argv[0]);
return false;
}
_serviceManager = new ServiceManagerI(communicator(), argc, argv);
return _serviceManager->start();
}
示例12: out
void
ServiceI::validateProperties(const string& name, const PropertiesPtr& properties, const LoggerPtr& logger)
{
static const string suffixes[] =
{
"ReplicatedTopicManagerEndpoints",
"ReplicatedPublishEndpoints",
"Nodes.*",
"Transient",
"NodeId",
"Flush.Timeout",
"InstanceName",
"Election.MasterTimeout",
"Election.ElectionTimeout",
"Election.ResponseTimeout",
"Publish.AdapterId",
"Publish.Endpoints",
"Publish.Locator",
"Publish.PublishedEndpoints",
"Publish.RegisterProcess",
"Publish.ReplicaGroupId",
"Publish.Router",
"Publish.ThreadPool.Size",
"Publish.ThreadPool.SizeMax",
"Publish.ThreadPool.SizeWarn",
"Publish.ThreadPool.StackSize",
"Node.AdapterId",
"Node.Endpoints",
"Node.Locator",
"Node.PublishedEndpoints",
"Node.RegisterProcess",
"Node.ReplicaGroupId",
"Node.Router",
"Node.ThreadPool.Size",
"Node.ThreadPool.SizeMax",
"Node.ThreadPool.SizeWarn",
"Node.ThreadPool.StackSize",
"TopicManager.AdapterId",
"TopicManager.Endpoints",
"TopicManager.Locator",
"TopicManager.Proxy",
"TopicManager.Proxy.EndpointSelection",
"TopicManager.Proxy.ConnectionCached",
"TopicManager.Proxy.PreferSecure",
"TopicManager.Proxy.LocatorCacheTimeout",
"TopicManager.Proxy.Locator",
"TopicManager.Proxy.Router",
"TopicManager.Proxy.CollocationOptimization",
"TopicManager.PublishedEndpoints",
"TopicManager.RegisterProcess",
"TopicManager.ReplicaGroupId",
"TopicManager.Router",
"TopicManager.ThreadPool.Size",
"TopicManager.ThreadPool.SizeMax",
"TopicManager.ThreadPool.SizeWarn",
"TopicManager.ThreadPool.StackSize",
"Trace.Election",
"Trace.Replication",
"Trace.Subscriber",
"Trace.Topic",
"Trace.TopicManager",
"Send.Timeout",
"Discard.Interval",
"SQL.DatabaseType",
"SQL.EncodingVersion",
"SQL.HostName",
"SQL.Port",
"SQL.DatabaseName",
"SQL.UserName",
"SQL.Password"
};
vector<string> unknownProps;
string prefix = name + ".";
PropertyDict props = 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.empty())
{
Warning out(logger);
out << "found unknown properties for IceStorm service '" << name << "':";
for(vector<string>::const_iterator p = unknownProps.begin(); p != unknownProps.end(); ++p)
{
out << "\n " << *p;
//.........这里部分代码省略.........
示例13: checkForUnknownProperties
//.........这里部分代码省略.........
Warning out(_instance->initializationData().logger);
out << "`" << property << "=" << properties->getProperty(property)
<< "': cannot set a router on a router; setting ignored";
}
else
{
routerInfo = _instance->routerManager()->get(router);
}
}
property = propertyPrefix + ".CollocationOptimized";
collocationOptimized = properties->getPropertyAsIntWithDefault(property, collocationOptimized) > 0;
property = propertyPrefix + ".ConnectionCached";
cacheConnection = properties->getPropertyAsIntWithDefault(property, cacheConnection) > 0;
property = propertyPrefix + ".PreferSecure";
preferSecure = properties->getPropertyAsIntWithDefault(property, preferSecure) > 0;
property = propertyPrefix + ".EndpointSelection";
if(!properties->getProperty(property).empty())
{
string type = properties->getProperty(property);
if(type == "Random")
{
endpointSelection = Random;
}
else if(type == "Ordered")
{
endpointSelection = Ordered;
}
else
{
EndpointSelectionTypeParseException ex(__FILE__, __LINE__);
ex.str = "illegal value `" + type + "'; expected `Random' or `Ordered'";
throw ex;
}
}
property = propertyPrefix + ".LocatorCacheTimeout";
string value = properties->getProperty(property);
if(!value.empty())
{
locatorCacheTimeout = properties->getPropertyAsIntWithDefault(property, locatorCacheTimeout);
if(locatorCacheTimeout < -1)
{
locatorCacheTimeout = -1;
Warning out(_instance->initializationData().logger);
out << "invalid value for " << property << "`" << properties->getProperty(property) << "'"
<< ": defaulting to -1";
}
}
property = propertyPrefix + ".InvocationTimeout";
value = properties->getProperty(property);
if(!value.empty())
{
invocationTimeout = properties->getPropertyAsIntWithDefault(property, invocationTimeout);
if(invocationTimeout < 1 && invocationTimeout != -1)
{
invocationTimeout = -1;
Warning out(_instance->initializationData().logger);
out << "invalid value for " << property << "`" << properties->getProperty(property) << "'"
<< ": defaulting to -1";
}
}
property = propertyPrefix + ".Context.";
PropertyDict contexts = properties->getPropertiesForPrefix(property);
for(PropertyDict::const_iterator p = contexts.begin(); p != contexts.end(); ++p)
{
ctx.insert(make_pair(p->first.substr(property.length()), p->second));
}
}
//
// Create new reference
//
return new RoutableReference(_instance,
_communicator,
ident,
facet,
mode,
secure,
protocol,
encoding,
endpoints,
adapterId,
locatorInfo,
routerInfo,
collocationOptimized,
cacheConnection,
preferSecure,
endpointSelection,
locatorCacheTimeout,
invocationTimeout,
ctx);
}
示例14: catch
bool
MetricsViewI::addOrUpdateMap(const PropertiesPtr& properties, const string& mapName,
const MetricsMapFactoryPtr& factory, const ::Ice::LoggerPtr& logger)
{
const string viewPrefix = "IceMX.Metrics." + _name + ".";
const string mapsPrefix = viewPrefix + "Map.";
PropertyDict mapsProps = properties->getPropertiesForPrefix(mapsPrefix);
string mapPrefix;
PropertyDict mapProps;
if(!mapsProps.empty())
{
mapPrefix = mapsPrefix + mapName + ".";
mapProps = properties->getPropertiesForPrefix(mapPrefix);
if(mapProps.empty())
{
// This map isn't configured for this view.
map<string, MetricsMapIPtr>::iterator q = _maps.find(mapName);
if(q != _maps.end())
{
q->second->destroy();
_maps.erase(q);
return true;
}
return false;
}
}
else
{
mapPrefix = viewPrefix;
mapProps = properties->getPropertiesForPrefix(mapPrefix);
}
if(properties->getPropertyAsInt(mapPrefix + "Disabled") > 0)
{
// This map is disabled for this view.
map<string, MetricsMapIPtr>::iterator q = _maps.find(mapName);
if(q != _maps.end())
{
q->second->destroy();
_maps.erase(q);
return true;
}
return false;
}
map<string, MetricsMapIPtr>::iterator q = _maps.find(mapName);
if(q != _maps.end() && q->second->getProperties() == mapProps)
{
return false; // The map configuration didn't change, no need to re-create.
}
if(q != _maps.end())
{
// Destroy the previous map
q->second->destroy();
_maps.erase(q);
}
try
{
_maps.insert(make_pair(mapName, factory->create(mapPrefix, properties)));
}
catch(const std::exception& ex)
{
::Ice::Warning warn(logger);
warn << "unexpected exception while creating metrics map:\n" << ex;
}
catch(const string& msg)
{
::Ice::Warning warn(logger);
warn << msg;
}
return true;
}
示例15: string
bool
Ice::ObjectAdapterI::filterProperties(StringSeq& unknownProps)
{
static const string suffixes[] =
{
"ACM",
"ACM.Close",
"ACM.Heartbeat",
"ACM.Timeout",
"AdapterId",
"Endpoints",
"Locator",
"Locator.EncodingVersion",
"Locator.EndpointSelection",
"Locator.ConnectionCached",
"Locator.PreferSecure",
"Locator.CollocationOptimized",
"Locator.Router",
"MessageSizeMax",
"PublishedEndpoints",
"ReplicaGroupId",
"Router",
"Router.EncodingVersion",
"Router.EndpointSelection",
"Router.ConnectionCached",
"Router.PreferSecure",
"Router.CollocationOptimized",
"Router.Locator",
"Router.Locator.EndpointSelection",
"Router.Locator.ConnectionCached",
"Router.Locator.PreferSecure",
"Router.Locator.CollocationOptimized",
"Router.Locator.LocatorCacheTimeout",
"Router.Locator.InvocationTimeout",
"Router.LocatorCacheTimeout",
"Router.InvocationTimeout",
"ProxyOptions",
"ThreadPool.Size",
"ThreadPool.SizeMax",
"ThreadPool.SizeWarn",
"ThreadPool.StackSize",
"ThreadPool.Serialize",
"ThreadPool.ThreadPriority"
};
//
// 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);
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(p->first == prop)
{
noProps = false;
valid = true;
break;
}
}
if(!valid && addUnknown)
{
unknownProps.push_back(p->first);
}
}
return noProps;
}