本文整理汇总了C++中NameMap::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ NameMap::begin方法的具体用法?C++ NameMap::begin怎么用?C++ NameMap::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameMap
的用法示例。
在下文中一共展示了NameMap::begin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 << '"';
}
}
}
示例2: Create
bool ArcApp::Create()
{
// turn m_args into a list of files, i.e. expand wildcards, recurse
// directories and remove duplicates
NameMap files;
MakeFileList(files);
wxOutputStreamPtr out(MakeOutputStream());
if (!out.get()) return false;
wxArchiveOutputStreamPtr arc(m_factory->NewStream(*out));
for (NameMap::iterator it = files.begin(); it != files.end(); ++it) {
wxString name = it->second;
wxDateTime dt(wxFileModificationTime(name));
*m_info << "adding " << name.mb_str() << std::endl;
if (wxDirExists(name)) {
if (!arc->PutNextDirEntry(name, dt))
return false;
}
else {
wxFFileInputStream in(name);
if (in.Ok()) {
if (!arc->PutNextEntry(name, dt, in.GetSize()) ||
!arc->Write(in) || !in.Eof())
return false;
}
}
}
return arc->Close() && out->Close();
}
示例3: setw
void
user_list(void)
{
NameMap users;
ServerPrx server;
server = meta->getServer(serverId, ctx);
users = server->getRegisteredUsers("", ctx);
for (NameMap::iterator ii=users.begin(); ii != users.end(); ii++)
cout << setw(8) << right << (*ii).first << " " << left << (*ii).second << endl;
}
示例4: 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;
}
}
}
示例5: 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;
}
}
}
}
示例6: 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;
}
}
//.........这里部分代码省略.........
示例7: Add
bool ArcApp::Add()
{
// turn m_args into a list of files, i.e. expand wildcards, recurse
// directories and remove duplicates
NameMap files;
MakeFileList(files);
wxInputStreamPtr in(MakeInputStream());
if (!in.get()) return false;
wxOutputStreamPtr out(MakeOutputStream());
if (!out.get()) return false;
wxArchiveInputStreamPtr arc(m_factory->NewStream(*in));
wxArchiveOutputStreamPtr outarc(m_factory->NewStream(*out));
wxArchiveEntryPtr entry(arc->GetNextEntry());
outarc->CopyArchiveMetaData(*arc);
for (;;) {
bool keep;
NameMap::iterator it;
if (!entry.get()) {
if (files.empty())
break;
it = files.begin();
keep = false;
} else {
it = files.find(entry->GetInternalName());
keep = true;
}
if (it != files.end()) {
wxString name = it->second;
files.erase(it);
if (wxDirExists(name)) {
*m_info << "adding " << name.mb_str() << std::endl;
wxDateTime dt(wxFileModificationTime(name));
if (!outarc->PutNextDirEntry(name, dt))
return false;
keep = false;
} else {
wxFFileInputStream file(name);
if (file.Ok()) {
*m_info << "adding " << name.mb_str() << std::endl;
wxDateTime dt(wxFileModificationTime(name));
if (!outarc->PutNextEntry(name, dt, file.GetSize()) ||
!outarc->Write(file) || !file.Eof())
return false;
keep = false;
}
}
}
if (keep)
if (!outarc->CopyEntry(entry.release(), *arc))
return false;
if (entry.get() || keep)
entry.reset(arc->GetNextEntry());
}
in.reset();
return arc->Eof() && outarc->Close() && out->Close();
}