0

所以我在这里有一个函数,据称它从 .cfg 文件中读取值并且文件设置正确,但我对文件所做的更改并未反映我的值。所以我调试。问题是它跳过了寻找值的迭代!所以我无法判断它是否只是接受默认值,或者是否有其他问题。

bool ConfigReader::GetBool(const std::string theSection,
                           const std::string theName, const bool theDefault) const
{
    bool anResult = theDefault; // this is the line where I have a breakpoint set

    // Check if theSection really exists
    std::map<const std::string, typeNameValue*>::const_iterator iter;
    iter = mSections.find(theSection);
    if(iter != mSections.end())
    {
        // Try to obtain the name, value pair
        typeNameValue* anMap = iter->second;
        if(NULL != anMap)
        {
            typeNameValueIter iterNameValue;
            iterNameValue = anMap->find(theName);
            if(iterNameValue != anMap->end())
            {
                anResult = ParseBool(iterNameValue->second, theDefault);
            }
        }
    }

    // Return the result found or theDefault assigned above
    return anResult; // this is the line where it skips to (not much help)
}

我尝试在跳过之间的行上放置断点,但无论如何它都会跳过它们。

我不确定我的问题是否与此有关,但听起来很相似: 当使用 Xcode 4.5 调试 c++ 时,单步执行代码在 STL 代码上停止

任何人都知道这里会发生什么,或者我可以做些什么来修复/避免它?另外,如果我发错了,我提前道歉。

调用 GetBool 函数:

mProperties.Add<bool>("bMusicOn",
                      settingsConfig.GetAsset().GetBool("music", "on", true));
4

0 回答 0