本文整理汇总了C++中Section类的典型用法代码示例。如果您正苦于以下问题:C++ Section类的具体用法?C++ Section怎么用?C++ Section使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Section类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: section_group
bool SectionHDF5::deleteSection(const string &name_or_id) {
boost::optional<H5Group> g = section_group();
bool deleted = false;
if (g) {
// 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 = g->removeAllLinks(section.name());
}
}
return deleted;
}
示例2: if
SectionSP
SectionList::FindSectionContainingLinkedFileAddress (addr_t vm_addr, uint32_t depth) const
{
SectionSP sect_sp;
const_iterator sect_iter;
const_iterator end = m_sections.end();
for (sect_iter = m_sections.begin(); sect_iter != end && sect_sp.get() == NULL; ++sect_iter)
{
Section *sect = sect_iter->get();
if (sect->ContainsLinkedFileAddress (vm_addr))
{
sect_sp = *sect_iter;
}
else if (depth > 0)
{
sect_sp = sect->GetChildren().FindSectionContainingLinkedFileAddress (vm_addr, depth - 1);
}
}
return sect_sp;
}
示例3: mem_conf
void mem_conf(std::string memtype, int option) {
std::string tmp;
Section* sec = control->GetSection("dos");
Section_prop * section=static_cast<Section_prop *>(sec);
if (!option) {
tmp = section->Get_bool(memtype) ? "false" : "true";
} else {
switch (option) {
case 1: tmp = "true"; break;
case 2: tmp = "false"; break;
case 3: tmp = "emsboard"; break;
case 4: tmp = "emm386"; break;
default: return;
}
}
if(sec) {
memtype += "=" + tmp;
sec->HandleInputline(memtype);
}
}
示例4: GetSection
/////////////////////////////////
// Create anti-action for insert
Action ActionModify::GetAntiAction() const
{
// Get section and original line
Section sect = GetSection(section);
Entry oldEntry = sect->GetEntry(lineNumber);
// Try to get a delta
DeltaCoder deltaCoder = oldEntry->GetDeltaCoder();
if (deltaCoder) {
VoidPtr _delta;
if (entry) _delta = deltaCoder->EncodeDelta(entry,oldEntry,!noTextFields);
else _delta = deltaCoder->EncodeReverseDelta(delta,oldEntry);
return Action(new ActionModify(GetModel(),_delta,lineNumber,section));
}
// Store the whole original line
else {
return Action(new ActionModify(GetModel(),oldEntry,lineNumber,section,noTextFields));
}
}
示例5: Assert
IniFile* IniFile::ReadIniFile(CStr fileName)
{
Assert(fileName);
CStr braceOpen = Text("[");
//CStr braceClose = Text("]");
CStr equal = Text("=");
IniFile* iniFile;
String::StrPtrVec* lines;
String::StrPtrVec::Element* it;
Section section;
Int index;
KeyValue keyValue;
iniFile = new IniFile();
lines = TextFile::ReadLines(fileName);
for(it = lines->Begin(); it < lines->End(); ++it)
{
String& line = **it;
if(line.TrimLeft().StartsWith(braceOpen))
{
if(!section.IsEmpty())
{
iniFile->SectionList.Add(section);
section.Clear();
}
section.Name = line;
}
else if((index = line.IndexOf(equal)) != -1)
{
if(!section.Name.IsEmpty())
{
keyValue.Key = line.SubString(0U, index - 2).Trim();
keyValue.Value = line.SubString(index - 1, line.Length() - index - 1).Trim();
section.KeyValueList.Add(keyValue);
}
}
}
return iniFile;
}
示例6: visit_Section
bool visit_Section(Section & s)
{
str_type base_dir = this->_base_dir;
if(s.has_key("__base_dir__"))
{
str_type section_base_dir = s.at("__base_dir__");
if(section_base_dir.size() > 0)
{
base_dir = section_base_dir;
}
}
str_type norm_base_dir = this->_normpath(base_dir);
//std::cout << "s<" << s << "> " << base_dir << " : " << this->_base_dir << std::endl;
if(base_dir.size() > 0 && norm_base_dir != this->_base_dir)
{
ResetBaseDirVisitor reset_base_dir_visitor(base_dir, this->_reset);
s.accept(reset_base_dir_visitor);
return false;
}
return true;
}
示例7: while
void
ConfigDocumentXML::parse()
{
QDomNode n = document_.firstChild();
if (!n.isNull()) {
QDomNode n1 = n.firstChild();
QListViewItem * pre = NULL;
while (!n1.isNull()) {
QDomElement e = n1.toElement();
if (!e.isNull() &&
e.tagName() == Section::XML_TAG) {
Section * section =
new Section(e,
listViewItem(), pre,
this, e.attribute("name"));
pre = section->listViewItem();
}
n1 = n1.nextSibling();
}
}
}
示例8: addGnuDebugLink
static void addGnuDebugLink(Object &Obj, StringRef DebugLinkFile) {
uint32_t StartRVA = getNextRVA(Obj);
std::vector<Section> Sections;
Section Sec;
Sec.setOwnedContents(createGnuDebugLinkSectionContents(DebugLinkFile));
Sec.Name = ".gnu_debuglink";
Sec.Header.VirtualSize = Sec.getContents().size();
Sec.Header.VirtualAddress = StartRVA;
Sec.Header.SizeOfRawData = alignTo(Sec.Header.VirtualSize,
Obj.IsPE ? Obj.PeHeader.FileAlignment : 1);
// Sec.Header.PointerToRawData is filled in by the writer.
Sec.Header.PointerToRelocations = 0;
Sec.Header.PointerToLinenumbers = 0;
// Sec.Header.NumberOfRelocations is filled in by the writer.
Sec.Header.NumberOfLinenumbers = 0;
Sec.Header.Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA |
IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_DISCARDABLE;
Sections.push_back(Sec);
Obj.addSections(Sections);
}
示例9: assert
void ConfigFile::setKey(const String &key, const String §ion, const String &value) {
assert(isValidName(key));
assert(isValidName(section));
// TODO: Verify that value is valid, too. In particular, it shouldn't
// contain CR or LF...
Section *s = getSection(section);
if (!s) {
KeyValue newKV;
newKV.key = key;
newKV.value = value;
Section newSection;
newSection.name = section;
newSection.keys.push_back(newKV);
_sections.push_back(newSection);
} else {
s->setKey(key, value);
}
}
示例10: printPath
void printPath() const {
int len = (int)size();
int pe = -1;
for(int i=0;i<len;++i) {
Section* s = at(i);
int se = positions[i];
if(pe == -1) {
pe = se;
}
if(se == pe) {
s->print('|', se);
}
else if(se < pe) {
s->print('/', se);
}
else {
s->print('\\', se);
}
pe = se;
}
}
示例11: Section
Section* Section::createSection(SectionInfo* sectionInfo,int index,int type,int p_index,int s_index){
Section *item = new Section();
if(item && item->init()){
PlayConfig* playConfig = (PlayConfig*)poptGlobal->gni->getConfig();
//音乐信息
MusicModel* musicModel = playConfig->musicModel;
//小节拍数
int beatFlag = musicModel->getBeatFlag();
//单元宽度,拍与拍之间的距离
float unitWidth = playConfig->unitWidth;
//小节总宽度
item->sectionWidth = unitWidth*beatFlag;
float sectionX = item->sectionWidth*(float)(index-1);
item->p_index = p_index;
item->s_index = s_index;
item->sectionIndex = index;
item->type = type;
item->playConfig = playConfig;
item->setAnchorPoint(Vec2::ZERO);
item->setPosition(Vec2(sectionX,0));
item->loadMusical(sectionInfo);
item->autorelease();
return item;
}
CC_SAFE_DELETE(item);
return nullptr;
}
示例12:
std::shared_ptr <NodeStore::Backend>
SHAMapStoreImp::makeBackendRotating (std::string path)
{
boost::filesystem::path newPath;
Section parameters = setup_.nodeDatabase;
if (path.size())
{
newPath = path;
}
else
{
boost::filesystem::path p = get<std::string>(parameters, "path");
p /= dbPrefix_;
p += ".%%%%";
newPath = boost::filesystem::unique_path (p);
}
parameters.set("path", newPath.string());
return NodeStore::Manager::instance().make_Backend (parameters, scheduler_,
nodeStoreJournal_);
}
示例13:
void
SectionList::BuildRangeCache() const
{
m_range_cache.Clear();
for (collection::size_type idx = 0, last_idx = m_sections.size();
idx < last_idx;
++idx)
{
Section *sect = m_sections[idx].get();
addr_t linked_file_address = sect->GetLinkedFileAddress();
if (linked_file_address != LLDB_INVALID_ADDRESS)
m_range_cache.Append(SectionRangeCache::Entry(linked_file_address, sect->GetByteSize(), idx));
}
m_range_cache.Sort();
#ifdef LLDB_CONFIGURATION_DEBUG
m_finalized = true;
#endif
}
示例14: RemoveSection
// administrator removes a section
bool Administrator::RemoveSection(const Section &s) const
{
/*delete a record from the section table*/
QString str;
str = "delete from Section where courseID = ";
str += QString::number(s.GetCourseID());
str += " and secID = ";
str += QString::number(s.GetSecID());
str += " and semester = '";
str += s.GetSemester().data();
str += "' and year = ";
str += QString::number(s.GetYear());
str += " and building = '";
str += s.GetBuilding().data();
str += "'";
QSqlQuery query;
if(!query.exec(str))
return false;
return true;
}
示例15:
std::vector<std::vector<Section*>> MysteryDungeonMaker::ClassifyGroups()
{
std::vector<std::vector<Section*>> groups;
int groupId = 0;
int mapHeight=dungeonSize->DungeonRowNum();
int sectionColumnNum = dungeonSize->DungeonColumnNum();
for (int i = 0; i < mapHeight; i++)
{
for (int j = 0; j < sectionColumnNum; j++)
{
Section* current = §ions[i][j];
if (current->HasRoom())
{
if (groups.empty())
{
groups.push_back(current->SetGroupId(groupId++));
}
else
{
int notMarked = 0;
for (size_t i_groups = 0; i_groups < groups.size(); i_groups++)
{
if (!DungeonMakerHelper::HasComponent(groups[i_groups], current->GetComponent()))
{
notMarked++;
}
}
if (notMarked == groups.size())
groups.push_back(current->SetGroupId(groupId++));
}
}
}
}
return groups;
}