本文整理汇总了C++中Section::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Section::name方法的具体用法?C++ Section::name怎么用?C++ Section::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSection
bool FileHDF5::deleteSection(const std::string &name_or_id) {
bool deleted = false;
// call deleteSection on sections to trigger recursive call to all sub-sections
if (hasSection(name_or_id)) {
// get instance of section about to get deleted
Section section = getSection(name_or_id);
// loop through all child sections and call deleteSection on them
for(auto &child : section.sections()) {
section.deleteSection(child.id());
}
// if hasSection is true then section_group always exists
deleted = metadata.removeAllLinks(section.name());
}
return deleted;
}
示例2: bufin
/**
* Load the ".INI" file from the given input stream.
* @param in stream to read file from.
* @return Created INI file.
* @throw Exception For any error (IO or format).
*/
File *File::load(io::InStream *in) throw (Exception) {
File *file = new File();
Section *sect = file->defaultSection();
io::BufferedInStream bufin(*in);
io::Input input(bufin);
try {
// read all lines
int num = 1;
while(true) {
// read the line
bool ended = false;
string line;
while(true) {
line = line + input.scanLine();
num++;
if(!line) {
ended = true;
break;
}
while(line[line.length() - 1] == '\n' || line[line.length() - 1] == '\r')
line = line.substring(0, line.length() - 1);
if(line[line.length() - 1] != '\\')
break;
line = line.substring(0, line.length() - 1);
}
if(ended)
break;
// empty line?
if(!line)
continue;
// is it a comment?
if(line[0] == ';')
continue;
// is it a section?
if(line[0] == '[') {
if(line[line.length() - 1] != ']')
throw Exception(_ << num << ": malformed section name");
sect = new Section(line.substring(1, line.length() - 2));
file->sects.put(sect->name(), sect);
continue;
}
// is it a key/value pair?
int p = line.indexOf('=');
if(p >= 0) {
sect->values.put(line.substring(0, p), line.substring(p + 1));
continue;
}
// syntax error?
throw Exception(_ << num << ": garbage here");
}
}
catch(io::IOException& e) {
delete file;
throw Exception(e.message());
}
return file;
}