本文整理汇总了C++中Option::isDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ Option::isDefault方法的具体用法?C++ Option::isDefault怎么用?C++ Option::isDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::isDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
void
OptionsCont::writeConfiguration(std::ostream &os, bool filled,
bool complete, bool addComments) throw() {
std::vector<std::string>::const_iterator i, j;
os << "<configuration>" << std::endl << std::endl;
for (i=mySubTopics.begin(); i!=mySubTopics.end(); ++i) {
std::string subtopic = *i;
if (subtopic=="Configuration") {
continue;
}
for (size_t k=0; k<subtopic.length(); ++k) {
if (subtopic[k]==' ') {
subtopic[k] = '_';
}
if (subtopic[k]>='A'&&subtopic[k]<='Z') {
subtopic[k] = subtopic[k] - 'A' + 'a';
}
}
const std::vector<std::string> &entries = mySubTopicEntries[*i];
bool hadOne = false;
for (j=entries.begin(); j!=entries.end(); ++j) {
Option *o = getSecure(*j);
bool write = complete || (filled&&!o->isDefault());
if (!write) {
continue;
}
if (!hadOne) {
os << " <" << subtopic << ">" << std::endl;
}
// add the comment if wished
if (addComments) {
os << " <!-- " << o->getDescription() << " -->" << std::endl;
}
// write the option and the value (if given)
os << " <" << *j << " value=\"";
if (o->isSet()) {
os << o->getValueString();
}
os << "\"/>" << std::endl;
// append an endline if a comment was printed
if (addComments) {
os << std::endl;
}
hadOne = true;
}
if (hadOne) {
os << " </" << subtopic << ">" << std::endl << std::endl;
}
}
os << "</configuration>" << std::endl;
}
示例2: getSecure
void
OptionsCont::writeConfiguration(std::ostream& os, bool filled,
bool complete, bool addComments) const {
os << "<?xml version=\"1.0\"" << SUMOSAXAttributes::ENCODING << "?>\n\n";
os << "<configuration xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/" << myAppName << "Configuration.xsd\">" << std::endl << std::endl;
for (std::vector<std::string>::const_iterator i = mySubTopics.begin(); i != mySubTopics.end(); ++i) {
std::string subtopic = *i;
if (subtopic == "Configuration" && !complete) {
continue;
}
std::replace(subtopic.begin(), subtopic.end(), ' ', '_');
std::transform(subtopic.begin(), subtopic.end(), subtopic.begin(), tolower);
const std::vector<std::string>& entries = mySubTopicEntries.find(*i)->second;
bool hadOne = false;
for (std::vector<std::string>::const_iterator j = entries.begin(); j != entries.end(); ++j) {
Option* o = getSecure(*j);
bool write = complete || (filled && !o->isDefault());
if (!write) {
continue;
}
if (!hadOne) {
os << " <" << subtopic << ">" << std::endl;
}
// add the comment if wished
if (addComments) {
os << " <!-- " << StringUtils::escapeXML(o->getDescription()) << " -->" << std::endl;
}
// write the option and the value (if given)
os << " <" << *j << " value=\"";
if (o->isSet() && (filled || o->isDefault())) {
os << o->getValueString();
}
if (complete) {
std::vector<std::string> synonymes = getSynonymes(*j);
if (!synonymes.empty()) {
os << "\" synonymes=\"";
for (std::vector<std::string>::const_iterator s = synonymes.begin(); s != synonymes.end(); ++s) {
if (s != synonymes.begin()) {
os << " ";
}
os << (*s);
}
}
os << "\" type=\"" << o->getTypeName();
if (!addComments) {
os << "\" help=\"" << StringUtils::escapeXML(o->getDescription());
}
}
os << "\"/>" << std::endl;
// append an endline if a comment was printed
if (addComments) {
os << std::endl;
}
hadOne = true;
}
if (hadOne) {
os << " </" << subtopic << ">" << std::endl << std::endl;
}
}
os << "</configuration>" << std::endl;
}