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


C++ NameMap::size方法代码示例

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


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

示例1: bitch_about_junk_files

void bitch_about_junk_files(const NameMap &junk) {
  if (junk.size()) {
    if (junk.size() == 1) {
      FAIL() << "Junk file \"" << junk.begin()->first << '"';
    } else {
      FAIL() << "Found " << junk.size() << " junk files, including "
             << '"' << junk.begin()->first << '"';
    }
  }
}
开发者ID:enigma-dev,项目名称:enigma-dev,代码行数:10,代码来源:SmallTests.cpp

示例2: printContributors

void printContributors(const std::string& changeLog, bool printNumEntries)
{
    NameMap names;
    buildContributors(names);
    if (!changeLog.empty())
    {
        readContributors(names, changeLog);
    }

    typedef multimap<unsigned int, NamePair> SortedNameMap;

    SortedNameMap sortedNames;
    for (NameMap::iterator itr = names.begin(); itr != names.end(); ++itr)
    {
        sortedNames.insert(SortedNameMap::value_type(itr->second, itr->first));
    }

    cout << names.size() << " Contributors:" << endl << endl;

    if (printNumEntries)
    {
        cout << "Entries Firstname Surname" << endl;
        cout << "-------------------------" << endl;
        for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
        {
            cout << sitr->first << "\t" << sitr->second.first;
            if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
            cout << endl;
        }
    }
    else
    {
        cout << "Firstname Surname" << endl;
        cout << "-----------------" << endl;
        for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
        {
            cout << sitr->second.first;
            if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
            cout << endl;
        }
    }
}
开发者ID:AurL,项目名称:osg,代码行数:42,代码来源:Contributors.cpp

示例3: readContributors

void readContributors(NameMap& names, const string& file)
{
    osgDB::ifstream fin(file.c_str());

    Words words;
    while(fin)
    {
        string keyword;
        fin >> keyword;
        words.push_back(keyword);
    }

    string blank_string;

    for(unsigned int i = 0; i < words.size(); ++i)
    {
        if (submissionsSequence(words, i))
        {
            if (i + 2 < words.size() && validName(words[i + 1]))
            {
                NamePair name = createName(words[i + 1], words[i + 2]);
                nameCorrection(name);
                if (!name.first.empty()) ++names[name];
                i += 2;
            }
            else if (i + 1 < words.size() && validName(words[i + 1]))
            {
                NamePair name = createName(words[i + 1], blank_string);
                nameCorrection(name);
                if (!name.first.empty()) ++names[name];
                i += 1;
            }
        }
        else
        {
            if (words[i] == "robert")
            {
                ++names[NameRobertOsfield];
            }
            else if (words[i] == "don")
            {
                ++names[NameDonBurns];
            }
        }
    }

    // reassign fisrt name entries to their full names entries
    if (names.size() > 1)
    {
        for (NameMap::iterator itr = names.begin(); itr != names.end(); )
        {
            if (itr->first.second.empty())
            {
                NameMap::iterator next_itr = itr;
                ++next_itr;

                if (next_itr != names.end() && itr->first.first == next_itr->first.first)
                {
                    next_itr->second += itr->second;
                    names.erase(itr);
                    itr = next_itr;
                }
                else
                {
                    ++itr;
                }
            }
            else
            {
                ++itr;
            }
        }
    }

    // remove the double entries from Robert's contributions
    if (names.size() > 1)
    {
        for (NameMap::iterator itr = names.begin(); itr != names.end(); ++itr)
        {
            if (itr->first != NameRobertOsfield && itr->first != NameDonBurns)
            {
                names[NameRobertOsfield] -= itr->second;
            }
        }
    }
}
开发者ID:bianjinsong,项目名称:osg,代码行数:86,代码来源:Contributors.cpp

示例4: VFS_Archive_CreateFromFileList

// Create an Archive from the specified File List.
VFS_BOOL VFS_Archive_CreateFromFileList( const VFS_String& strArchiveFileName, const VFS_FileNameMap& Files, const VFS_FilterNameList& UsedFilters )
{
    static VFS_BYTE Chunk[ FILE_COPY_CHUNK_SIZE ];

    // If there's already an Archive with the same File Name and it's open...
    VFS_EntityInfo Info;
    if( VFS_Archive_GetInfo( ToLower( strArchiveFileName ), Info ) )
    {
        // Check if the Archive is open.
        if( GetOpenArchives().find( ToLower( Info.strPath ) ) != GetOpenArchives().end() )
        {
            // Check if the Reference Count is != 0.
            if( GetOpenArchives()[ ToLower( Info.strPath ) ]->GetRefCount() > 0 )
            {
                // We don't want to manipulate an open Archive, do we?
                SetLastError( VFS_ERROR_IN_USE );
                return VFS_FALSE;
            }
            else
            {
                // Free the Archive.
                delete GetOpenArchives()[ ToLower( Info.strPath ) ];
                GetOpenArchives().erase( ToLower( Info.strPath ) );
            }
        }
    }
    else
    {
        Info.strPath = ToLower( strArchiveFileName );
        SetLastError( VFS_ERROR_NONE );
    }

    // Check the Filter Names and make a List of all Filter Pointers.
    VFS_FilterList Filters;
    for( VFS_FilterNameList::const_iterator iter = UsedFilters.begin(); iter != UsedFilters.end(); iter++ )
    {
        // Bad Filter Name?
        if( !VFS_ExistsFilter( *iter ) )
        {
            SetLastError( VFS_ERROR_INVALID_PARAMETER );
            return VFS_FALSE;
        }

        // Add the Filter.
        Filters.push_back( VFS_GetFilter( *iter ) );
    }

    // Check all Files.
    for( VFS_FileNameMap::const_iterator iter2 = Files.begin(); iter2 != Files.end(); iter2++ )
    {
        if( !VFS_File_Exists( ( *iter2 ).first ) )
        {
            SetLastError( VFS_ERROR_NOT_FOUND );
            return VFS_FALSE;
        }

        VFS_String strName;
        VFS_Util_GetName( ( *iter2 ).second, strName );
        if( strName.size() > VFS_MAX_NAME_LENGTH )
        {
            SetLastError( VFS_ERROR_INVALID_PARAMETER );
            return VFS_FALSE;
        }
    }

    // Make a list of the Directories to create.
    typedef vector< VFS_String > NameMap;
    NameMap Dirs;
    for( VFS_FileNameMap::const_iterator iter3 = Files.begin(); iter3 != Files.end(); iter3++ )
    {
        VFS_String strDir;
        VFS_Util_GetPath( ( *iter3 ).second, strDir );
        strDir = ToLower( strDir );
        if( strDir != VFS_TEXT( "" ) && find( Dirs.begin(), Dirs.end(), strDir ) == Dirs.end() )
        {
            // Add the top-level Dirs.
            while( strDir.rfind( VFS_PATH_SEPARATOR ) != VFS_String::npos )
            {
                if( find( Dirs.begin(), Dirs.end(), strDir ) != Dirs.end() )
                    break;
                Dirs.push_back( ToLower( strDir ) );
                if( strDir.size() > VFS_MAX_NAME_LENGTH )
                {
                    SetLastError( VFS_ERROR_INVALID_PARAMETER );
                    return VFS_FALSE;
                }

                strDir = strDir.substr( 0, strDir.rfind( VFS_PATH_SEPARATOR ) );
            }

            if( find( Dirs.begin(), Dirs.end(), strDir ) == Dirs.end() )
            {
                Dirs.push_back( ToLower( strDir ) );
                if( strDir.size() > VFS_MAX_NAME_LENGTH )
                {
                    SetLastError( VFS_ERROR_INVALID_PARAMETER );
                    return VFS_FALSE;
                }
            }
//.........这里部分代码省略.........
开发者ID:bigdig,项目名称:KPackage,代码行数:101,代码来源:VFS_Archives.cpp


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