本文整理汇总了C++中getSection函数的典型用法代码示例。如果您正苦于以下问题:C++ getSection函数的具体用法?C++ getSection怎么用?C++ getSection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSection函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getSection
void FifoIndex::remove(RowHandle *rh)
{
RhSection *rs = getSection(rh);
if (first_ == rh) {
if (last_ == rh) {
first_ = last_ = NULL; // that was the last row
} else {
first_ = rs->next_;
RhSection *nextrs = getSection(first_);
nextrs->prev_ = NULL;
}
} else if (last_ == rh) {
last_ = rs->prev_;
RhSection *prevrs = getSection(last_);
prevrs->next_ = NULL;
} else {
RhSection *nextrs = getSection(rs->next_);
RhSection *prevrs = getSection(rs->prev_);
prevrs->next_ = rs->next_;
nextrs->prev_ = rs->prev_;
}
rs->prev_ = rs->next_ = NULL;
--size_;
}
开发者ID:imace,项目名称:triceps,代码行数:25,代码来源:FifoIndex.cpp
示例2: while
void Parser::scan_section()
{
if (current_char != L_SECTION)
return;
std::string line = "";
while (scan_char() && current_char != R_SECTION && current_char != NEWLINE)
{
line += current_char;
}
//Remember:
// Section takes care of freeing the resources of its siblings
// so new is actually safe here
Section *section = new Section(line);
//current_section might be a section, but if not, our ctor guarantees it to be NULL.
section->previous = current_section;
//Use current_section rather than the getter since we don't want it to instantiate.
if (current_section)
{
section->previous = getSection();
getSection()->next = section;
}
setSection(section);
};
开发者ID:Defavlt,项目名称:ini_parser,代码行数:29,代码来源:ini_parser.cpp
示例3: LineIterator
INIFile::LineIterator INIFile::getSectionFirstLine(const String& section_name)
{
if (!section_index_.has(section_name))
{
return LineIterator();
}
return LineIterator(sections_, getSection(section_name),
getSection(section_name)->lines_.begin());
}
开发者ID:HeyJJ,项目名称:ball,代码行数:10,代码来源:INIFile.C
示例4: getSection
INIFile::Section* INIFile::getSectionOrCreate(const std::string& sectionname) {
Section* curSection = getSection(sectionname);
if(curSection == NULL) {
// create new section
if(isValidSectionName(sectionname) == false) {
std::cerr << "INIFile: Cannot create section with name " << sectionname << "!" << std::endl;
return NULL;
}
curSection = new Section(sectionname);
if(FirstLine == NULL) {
FirstLine = curSection;
} else {
INIFileLine* curLine = FirstLine;
while(curLine->nextLine != NULL) {
curLine = curLine->nextLine;
}
curLine->nextLine = curSection;
curSection->prevLine = curLine;
}
InsertSection(curSection);
}
return curSection;
}
开发者ID:thebohemian,项目名称:dunelegacy-richiesbranch,代码行数:29,代码来源:INIFile.cpp
示例5: while
void Config::loadData(char *pbData, int iDatasize){
int pointer = 0;
while (pointer < iDatasize){
char *line = GetNextLine(pbData, iDatasize, &pointer);
//printf("Line: %s\r\n", line);
/**/
if (lineContainSection(line) == true){
char *section = getSection(line);
//printf("Section: [%s]\r\n", section);
do{
char *sectionDataLine = GetNextLine(pbData, iDatasize, &pointer);
char *key = NULL;
char *value = NULL;
if (sectionDataLine != NULL){
key = getKey(sectionDataLine);
value = getValue(sectionDataLine);
if (key != NULL && value != NULL){
config.put(section, key, value);
//printf(" (%s) = |%s|\r\n", key, value);
//printf()
}
}
if (sectionDataLine != NULL) delete[] sectionDataLine;
//if (key != NULL) delete[] key;
//if (value != NULL) delete[] value;
}
while (lineInCurrentSection(pbData, iDatasize, &pointer) == true);
//if(section != NULL) delete[] section;
}
if(line!=NULL) delete[]line;
}
}
开发者ID:haihoang1219931,项目名称:ProjectX1.0.0.1,代码行数:35,代码来源:config.cpp
示例6: getSection
std::vector<Section> File::sections(const util::Filter<Section>::type &filter) const
{
auto f = [this] (ndsize_t i) { return getSection(i); };
return getEntities<Section>(f,
sectionCount(),
filter);
}
开发者ID:neurodebian,项目名称:nix,代码行数:7,代码来源:File.cpp
示例7: while
bool FifoIndex::replacementPolicy(RowHandle *rh, RhSet &replaced)
{
size_t limit = type_->getLimit();
if (limit == 0)
return true; // no limit, nothing replaced
// Check if there is any row already marked for replacement and present in this index,
// then don't push out another one.
size_t subtract = 0;
for (RhSet::iterator it = replaced.begin(); it != replaced.end(); ++it) {
Index *rind = type_->findInstance(table_, *it);
if (rind == this)
++subtract; // it belongs here, so a record will be already pushed out
}
if (size_ - subtract >= limit && size_ >= subtract) { // this works well only with one-at-a-time inserts
if (type_->isJumping()) {
RowHandle *curh = first_;
while(curh != NULL) {
replaced.insert(curh);
RhSection *rs = getSection(curh);
curh = rs->next_;
}
} else {
replaced.insert(first_);
}
}
return true;
}
开发者ID:imace,项目名称:triceps,代码行数:31,代码来源:FifoIndex.cpp
示例8: RegCreate
/* ==========================================================================
Function Name : (HKEY) RegCreate()
Outline : 指定したレジストリキーを作成(またはオープン)する
Arguments : HKEY hCurrentKey (in) 現在のオープンキー
: LPCTSTR lpszKeyName (in) オープンするサブキーの
: 名前
Return Value : 成功 オープンまたは作成されたキーのハンドル
: 失敗 NULL
Reference :
Renewal :
Notes :
Attention :
Up Date :
======1=========2=========3=========4=========5=========6=========7======= */
HKEY RegCreate(HKEY hCurrentKey, LPCTSTR lpszKeyName)
{
if(bUseINI){
getSection(lpszKeyName);
return ERROR_SUCCESS;
}else{
long lError;
HKEY hkResult;
DWORD dwDisposition;
lError = ::RegCreateKeyEx(hCurrentKey,
lpszKeyName,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hkResult,
&dwDisposition);
if (lError != ERROR_SUCCESS) {
::SetLastError(lError);
return (HKEY) INVALID_HANDLE_VALUE;
}
return hkResult;
}
}
开发者ID:lifangbo,项目名称:teraterm,代码行数:41,代码来源:registry.cpp
示例9: KeyList_GetNextKey
/**
A IniFile::KeyListHandle can be used to list all keys of one section. This method opens the #IniFile::KeyListHandle.
To iterate all keys use KeyList_GetNextKey(). #IniFile::KeyListHandle should be closed by KeyList_Close().
If the section is empty IniFile::KeyList_EOF on the returned handle of IniFile::KeyList_Open(sectionname) is true.<br>
<br>
Example:<br>
IniFile::KeyListHandle myHandle;<br>
myHandle = myIniFile.KeyList_Open("Section1");<br>
<br>
while(!myIniFile.KeyList_EOF(myHandle)) {<br>
cout << myIniFile.KeyList_GetNextKey(&myHandle) << std::endl;<br>
}<br>
<br>
myIniFile.KeyList_Close(&myHandle);
\param sectionname The name of the section
\return handle to this section
\see KeyList_Close, KeyList_GetNextKey, KeyList_EOF
*/
IniFile::KeyListHandle IniFile::KeyList_Open(std::string sectionname) {
SectionEntry *curSection = getSection(sectionname);
if(curSection == nullptr) {
return nullptr;
} else {
return curSection->KeyRoot;
}
}
开发者ID:proyvind,项目名称:libeastwood,代码行数:26,代码来源:IniFile.cpp
示例10: switch
void CDirectiveConditional::Execute()
{
bool b;
switch (type)
{
case ConditionType::IFARM:
b = Value == 1;
Global.conditionData.addIf(b);
break;
case ConditionType::IFTHUMB:
b = Value == 3;
Global.conditionData.addIf(b);
break;
case ConditionType::IF:
b = Value != 0;
Global.conditionData.addIf(b);
break;
case ConditionType::ELSE:
Global.conditionData.addElse();
break;
case ConditionType::ELSEIF:
b = Value != 0;
Global.conditionData.addElseIf(b);
break;
case ConditionType::ENDIF:
Global.conditionData.addEndIf();
break;
case ConditionType::IFDEF:
b = checkLabelDefined(labelName,getSection());
Global.conditionData.addIf(b);
break;
case ConditionType::IFNDEF:
b = !checkLabelDefined(labelName,getSection());
Global.conditionData.addIf(b);
break;
case ConditionType::ELSEIFDEF:
b = checkLabelDefined(labelName,getSection());
Global.conditionData.addElseIf(b);
break;
case ConditionType::ELSEIFNDEF:
b = !checkLabelDefined(labelName,getSection());
Global.conditionData.addElseIf(b);
break;
}
}
开发者ID:kleenexfeu,项目名称:armips,代码行数:46,代码来源:CDirectiveConditional.cpp
示例11: getSection
bool ConfFile::hasSection(const std::string& section) {
ConfSection* sec = getSection(section);
if(sec==0) return false;
return true;
}
开发者ID:JickLee,项目名称:Core,代码行数:8,代码来源:conffile.cpp
示例12: assert
void ConfigFile::removeKey(const String &key, const String §ion) {
assert(isValidName(key));
assert(isValidName(section));
Section *s = getSection(section);
if (s)
s->removeKey(key);
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:8,代码来源:config-file.cpp
示例13: copy
/* Copy variant which takes an IVal */
void
copy(Uint32* dst, Uint32 srcFirstIVal)
{
SegmentedSectionPtr p;
getSection(p, srcFirstIVal);
copy(dst, p);
}
开发者ID:hobbytp,项目名称:percona-xtrabackup,代码行数:9,代码来源:LongSignal.cpp
示例14:
bool KLUPD::IniFile::createSection(const NoCaseString §ionName, const NoCaseString &comment)
{
if(getSection(sectionName))
return false;
m_sections.push_back(Section(sectionName, comment));
m_dirty = true;
return true;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:9,代码来源:IniFile.cpp
示例15: getSection
size_t IniReader::getKeyCount(const std::string & sectionName) const {
const IniSection * section = getSection(sectionName);
if(section) {
return section->size();
} else {
return 0;
}
}
开发者ID:Dimoks,项目名称:ArxLibertatis_fork,代码行数:9,代码来源:IniReader.cpp
示例16: getSection
RandomTileData::Section *RandomTileData::getSection(const char *name) {
for (int i = 0; i < sectionCount; i++) {
RandomTileData::Section *sect = getSection(i);
if (sect->getNameList()->contains(name))
return sect;
}
return 0;
}
开发者ID:InfosHack,项目名称:NewerSMBW,代码行数:10,代码来源:randtiles.cpp
示例17: getSection
void SettingsComponent::updatePossibleValues(const QString §ionID, const QString &key, const QVariantList &possibleValues)
{
SettingsSection* section = getSection(sectionID);
if (!section)
{
QLOG_ERROR() << "Section" << sectionID << "is unknown";
return;
}
section->updatePossibleValues(key, possibleValues);
QLOG_DEBUG() << "Updated possible values for:" << key << "to" << possibleValues;
}
开发者ID:norbusan,项目名称:plex-media-player,代码行数:11,代码来源:SettingsComponent.cpp
示例18: test_getSection
void test_getSection(void)
{
char* content = " echo \"\
[TcpClient] \n\
LogicName = tcpClient1 \n\
DestIp = 127.0.0.1 \n\
DestPort = 1111 \n\
LocalPort = 8888 \n\
\n\
[TcpClient] \n\
LogicName = tcpClient2 \n\
DestIp = 127.0.0.1 \n\
DestPort = 2222 \n\
LocalPort = 9999 \n\
\n\
[TcpClient] \n\
LogicName = tcpClient3 \n\
DestIp = 127.0.0.1 \n\
DestPort = 3333 \n\
LocalPort = 1234 \n\" > commModule.conf";
system(content);
char section[MAX_LEN_SECTION] = {0};
int ret = getSection("./commModule.conf", 0, "TcpClient", section);
TEST_ASSERT_EQUAL_INT(3, ret);
memset(section, 0, MAX_LEN_SECTION);
ret = getSection("./commModule.conf", 1, "TcpClient", section);
TEST_ASSERT_EQUAL_INT(TOOLS_SUCCESS, ret);
TEST_ASSERT_EQUAL_STRING("[TcpClient] \nLogicName = tcpClient1 \nDestIp = 127.0.0.1 \nDestPort = 1111 \nLocalPort = 8888 \n\n", section);
memset(section, 0, MAX_LEN_SECTION);
ret = getSection("./commModule.conf", 2, "TcpClient", section);
TEST_ASSERT_EQUAL_INT(TOOLS_SUCCESS, ret);
TEST_ASSERT_EQUAL_STRING("[TcpClient] \nLogicName = tcpClient2 \nDestIp = 127.0.0.1 \nDestPort = 2222 \nLocalPort = 9999 \n\n", section);
memset(section, 0, MAX_LEN_SECTION);
ret = getSection("./commModule.conf", 3, "TcpClient", section);
TEST_ASSERT_EQUAL_INT(TOOLS_SUCCESS, ret);
TEST_ASSERT_EQUAL_STRING("[TcpClient] \nLogicName = tcpClient3 \nDestIp = 127.0.0.1 \nDestPort = 3333 \nLocalPort = 1234 \n\n", section);
}
开发者ID:Abioy,项目名称:dust,代码行数:40,代码来源:test_toolsModule.c
注:本文中的getSection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论