本文整理汇总了C++中Configurator::getMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Configurator::getMode方法的具体用法?C++ Configurator::getMode怎么用?C++ Configurator::getMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configurator
的用法示例。
在下文中一共展示了Configurator::getMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configure
void PatternLoggingLayout::configure(Configurator& conf)
{
if (conf.getMode() == Configurator::FROM_CONF)
{
std::string sPattern;
conf.configure("pattern", sPattern, "");
if (!sPattern.empty())
{
setPattern(sPattern);
}
}
}
示例2: configure
void FieldDefinition::configure(Configurator& conf)
{
if (conf.getMode() == Configurator::TO_CONF)
{
Configurator ftRootConf;
for (TypeVector::iterator it = m_types.begin(); it != m_types.end(); ++it)
{
Configurator ftConf;
(*it)->configure(ftConf);
ftRootConf.configure(_T("field_type"), ftConf.getMap());
}
conf.configure(_T("type_define"), ftRootConf.getMap());
}
else
{
Configurator::Iterator it = conf.findConf(_T("type_define"));
if (it.hasNext())
{
Configurator::ConfMap rootConfMap =
AnyCast<Configurator::ConfMap>(it.next().second);
Configurator rootConf(rootConfMap);
Configurator::Iterator it2 = rootConf.iterator();
while (it2.hasNext())
{
Configurator::KeyValuePair kv = it2.next();
if (kv.first == _T("field_type"))
{
FieldType* pType = new FieldType;
Configurator::ConfMap ftMap = AnyCast<Configurator::ConfMap>(
kv.second);
Configurator ftConf(ftMap);
pType->configure(ftConf);
addFieldType(*pType);
}
}
}
}
}
示例3: configure
void DocumentTemplate::configure(Configurator& conf)
{
if (conf.getMode() == Configurator::TO_CONF)
{
Configurator rootConf;
rootConf.configure("doc_tag", m_sDocTag, "");
rootConf.configure("embedded_field", m_sEmbeddedField, "");
Configurator metadataConf;
for (Metadata::iterator it = m_metadata.begin();
it != m_metadata.end(); ++it)
{
Configurator tagConf;
(*it).configure(tagConf);
metadataConf.configure("meta", tagConf.getMap());
}
rootConf.configure("metadata", metadataConf.getMap());
Configurator tagsConf;
for (TagVector::iterator it = m_tags.begin();
it != m_tags.end(); ++it)
{
Configurator tagConf;
(*it).configure(tagConf);
tagsConf.configure("tag", tagConf.getMap());
}
rootConf.configure("tags", tagsConf.getMap());
conf.configure("template", rootConf.getMap());
}
else
{
m_sDocTag.clear();
m_tags.clear();
Configurator::Iterator it = conf.findConf("template");
if (it.hasNext())
{
Configurator rootConf(AnyCast<Configurator::ConfMap>(it.next().second));
rootConf.configure("doc_tag", m_sDocTag, "");
rootConf.configure("embedded_field", m_sEmbeddedField, "");
Configurator::Iterator it1 = rootConf.findConf("metadata");
if (it1.hasNext())
{
Configurator metadataConf(AnyCast<Configurator::ConfMap>(it1.next().second));
Configurator::Iterator it3 = metadataConf.iterator();
while (it3.hasNext())
{
Configurator::KeyValuePair kv = it3.next();
if (kv.first == "meta")
{
Configurator tagConf(AnyCast<Configurator::ConfMap>(kv.second));
DocumentTemplate::Meta meta;
meta.configure(tagConf);
m_metadata.push_back(meta);
}
}
}
Configurator::Iterator it2 = rootConf.findConf("tags");
if (it2.hasNext())
{
Configurator tagsConf(AnyCast<Configurator::ConfMap>(it2.next().second));
Configurator::Iterator it3 = tagsConf.iterator();
while (it3.hasNext())
{
Configurator::KeyValuePair kv = it3.next();
if (kv.first == "tag")
{
Configurator tagConf(AnyCast<Configurator::ConfMap>(kv.second));
DocumentTemplate::Tag tag;
tag.configure(tagConf);
m_tags.push_back(tag);
}
}
}
}
}
}