本文整理汇总了C++中Domain::getDomainComment方法的典型用法代码示例。如果您正苦于以下问题:C++ Domain::getDomainComment方法的具体用法?C++ Domain::getDomainComment怎么用?C++ Domain::getDomainComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::getDomainComment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeDomain
void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &domain) {
if (domain.empty())
return; // Don't bother writing empty domains.
String comment;
// Write domain comment (if any)
comment = domain.getDomainComment();
if (!comment.empty())
fprintf(file, "%s", comment.c_str());
// Write domain start
fprintf(file, "[%s]\n", name.c_str());
// Write all key/value pairs in this domain, including comments
Domain::const_iterator x;
for (x = domain.begin(); x != domain.end(); ++x) {
const String &value = x->_value;
if (!value.empty()) {
// Write comment (if any)
if (domain.hasKVComment(x->_key)) {
comment = domain.getKVComment(x->_key);
fprintf(file, "%s", comment.c_str());
}
// Write the key/value pair
fprintf(file, "%s=%s\n", x->_key.c_str(), value.c_str());
}
}
fprintf(file, "\n");
}
示例2: writeDomain
void ConfigManager::writeDomain(WriteStream &stream, const String &name, const Domain &domain) {
if (domain.empty())
return; // Don't bother writing empty domains.
// WORKAROUND: Fix for bug #1972625 "ALL: On-the-fly targets are
// written to the config file": Do not save domains that came from
// the command line
if (domain.contains("id_came_from_command_line"))
return;
String comment;
// Write domain comment (if any)
comment = domain.getDomainComment();
if (!comment.empty())
stream.writeString(comment);
// Write domain start
stream.writeByte('[');
stream.writeString(name);
stream.writeByte(']');
#ifdef _WIN32
stream.writeByte('\r');
stream.writeByte('\n');
#else
stream.writeByte('\n');
#endif
// Write all key/value pairs in this domain, including comments
Domain::const_iterator x;
for (x = domain.begin(); x != domain.end(); ++x) {
if (!x->_value.empty()) {
// Write comment (if any)
if (domain.hasKVComment(x->_key)) {
comment = domain.getKVComment(x->_key);
stream.writeString(comment);
}
// Write the key/value pair
stream.writeString(x->_key);
stream.writeByte('=');
stream.writeString(x->_value);
#ifdef _WIN32
stream.writeByte('\r');
stream.writeByte('\n');
#else
stream.writeByte('\n');
#endif
}
}
#ifdef _WIN32
stream.writeByte('\r');
stream.writeByte('\n');
#else
stream.writeByte('\n');
#endif
}