本文整理汇总了C++中Option::getOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ Option::getOptions方法的具体用法?C++ Option::getOptions怎么用?C++ Option::getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::getOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkImpedance
void Selector::checkImpedance()
{
Options& options = getOptions();
m_ignoreDefault = options.getValueOrDefault<bool>("ignore_default", true);
std::vector<Option>::const_iterator i;
try
{
Option ignored = options.getOption("ignore");
boost::optional<Options const&> ignored_options = ignored.getOptions();
if (ignored_options)
{
std::vector<Option> ignored_dimensions = ignored_options->getOptions("dimension");
for (i = ignored_dimensions.begin(); i != ignored_dimensions.end(); ++i)
{
m_ignoredMap.insert(std::pair<std::string, bool>(i->getValue<std::string>(), true));
}
}
}
catch (option_not_found&)
{
}
try
{
Option keep = options.getOption("keep");
boost::optional<Options const&> keep_options = keep.getOptions();
if (keep_options)
{
std::vector<Option> keep_dimensions = keep_options->getOptions("dimension");
for (i = keep_dimensions.begin(); i != keep_dimensions.end(); ++i)
{
m_ignoredMap.insert(std::pair<std::string, bool>(i->getValue<std::string>(), false));
}
}
}
catch (option_not_found&)
{
}
return;
}
示例2: initializeControl
//! The (overloaded) initializeControl routine is responsible for the following
//! tasks:
//! - Ensuring the control displays the appropriate options based on the
//! contents of the OptionDatabase.
//! - Adding the ToolTip documentation found in the database.
//! - Adding connections (signals & slots) between the Nodes in the
//! OptionRegister and the control. This allows for synchronization of the
//! logic in InitializeQChemLogic and initializeQuiLogic.
//! - Binding an Action to enable the control to be reset to the default value.
//! - Binding an Update to enable the control to be reset to a string value.
void InputDialog::initializeControl(Option const& opt, QComboBox* combo) {
QString name = opt.getName();
QStringList opts = opt.getOptions();
QStringList split;
// This allows for ad hoc text replacements. This is useful so that more
// informative text can be presented to the user which is then obfiscated
// before being passed to QChem. The replacements should be set in the
// option database and have the form text//replacement.
for (int i = 0; i < opts.size(); ++i) {
split = opts[i].split("//");
if (split.size() == 1) {
opts[i] = split[0];
}else if (split.size() == 2) {
opts[i] = split[0];
QString key(name.toUpper() + "::" + split[0]);
//Job::addAdHoc(key,split[1]);
RemSection::addAdHoc(name, split[0], split[1]);
}else {
qDebug() << "InputDialog::initialiseComboBox:\n"
<< " replacement for option" << name << "is invalid:" << opts[i];
}
}
combo->clear();
combo->addItems(opts);
#if QT_VERSION >= 0x040400
// This just allows us to add some spacers to the lists
bool keepLooking(true);
while (keepLooking) {
int i = combo->findText("---", Qt::MatchStartsWith);
if (i > 0) {
combo->removeItem(i);
combo->insertSeparator(i);
}else {
keepLooking = false;
}
}
#endif
connectControl(opt, combo);
combo->setToolTip(opt.getDescription());
Action* action = new Action(
boost::bind(&QComboBox::setCurrentIndex, combo, opt.getDefaultIndex()) );
m_resetActions.push_back(action);
Update* update = new Update(
boost::bind(
static_cast<void(*)(QComboBox*, QString const&)>(SetControl), combo, _1));
m_setUpdates[name] = update;
}
示例3: toPTree
inline ptree toPTree(const Option& option)
{
ptree t;
t.put("Name", option.getName());
t.put("Value", option.getValue<std::string>());
if (option.getDescription() != "")
{
t.put("Description", option.getDescription());
}
boost::optional<Options const&> options = option.getOptions();
if (options != boost::none)
{
t.add_child("Options", toPTree(*options));
}
return t;
}