当前位置: 首页>>代码示例>>C++>>正文


C++ STRING::to_string方法代码示例

本文整理汇总了C++中STRING::to_string方法的典型用法代码示例。如果您正苦于以下问题:C++ STRING::to_string方法的具体用法?C++ STRING::to_string怎么用?C++ STRING::to_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在STRING的用法示例。


在下文中一共展示了STRING::to_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: saveRollbackInfo

bool Ini_UpdaterLists::saveRollbackInfo(const FileVector &rollbackList)
{
    STRING section_name = SS_KEY_RollbackTree;
    long k = 0;
    
    STRING rollbackFileAndPath;
    if(!getProductFolder(m_useCurrentFolder, rollbackFileAndPath, pLog))
    {
        TRACE_MESSAGE("Unable to save rollback information, because failed to get product folder");
        return false;
    }
    rollbackFileAndPath += UPDATER_LISTS_FILENEME;
    
    TRACE_MESSAGE2("Saving rollback list to '%s'", rollbackFileAndPath.to_string().c_str());

    removeRollbackSection();

    // for output saved entries in rows and save space in trace file
    std::string savedEntries;
    unsigned long logLineSplitIndex = 0;

    for(FileVector::const_iterator iter = rollbackList.begin(); iter != rollbackList.end(); ++iter)
    {
        if(iter->m_rollbackChange == STRING(SS_KEY_RecentStatusAdded)
            || iter->m_rollbackChange == STRING(SS_KEY_RecentStatusModified)
            || iter->m_rollbackChange == STRING(SS_KEY_RecentStatusDeleted))
        {
            STRING newSectionName;
            const long order_number = k++;
            makeNewSectionName(order_number, iter->m_filename, newSectionName);
            
            if(!saveRollbackListEntry(rollbackFileAndPath.c_str(), section_name.c_str(), order_number, newSectionName, *iter))
            {
                TRACE_MESSAGE2("Unable to save rollback information for file entry '%s'", (iter->m_localPath + iter->m_filename).to_string().c_str());
                return false;
            }


            // append comma before all items, but the very first one
            if(logLineSplitIndex++)
                savedEntries += ", ";
            // split line each 3 elements, but not before last element
            if(iter + 1 != rollbackList.end())
            {
                if(!(logLineSplitIndex % 3))
                    savedEntries += "\n\t";
            }
            savedEntries += (iter->m_localPath + iter->m_filename).to_string();
        }
    }

    TRACE_MESSAGE3("Rollback information saved successfully to %s, entries: %s", rollbackFileAndPath.to_string().c_str(), savedEntries.c_str());
    return true;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:54,代码来源:ini_updater_lists.cpp


注:本文中的STRING::to_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。