本文整理汇总了C++中ccollect::append方法的典型用法代码示例。如果您正苦于以下问题:C++ ccollect::append方法的具体用法?C++ ccollect::append怎么用?C++ ccollect::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccollect
的用法示例。
在下文中一共展示了ccollect::append方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMimeList
int MimeDB::GetMimeList( const unicode_t* fileName, ccollect<int>& outList )
{
ccollect<int> temp1;
if ( globs.GetMimeList( fileName, temp1 ) > 0 )
{
std::unordered_map<int, bool> hash;
int i;
for ( i = 0; i < temp1.count(); i++ )
{
bool Exists = hash.find( temp1[i] ) != hash.end();
if ( !Exists )
{
outList.append( temp1[i] );
hash[ temp1[i] ] = true;
AddParentsRecursive( temp1[i], &outList, &hash );
}
}
// for (i=0; i<temp1.count(); i++)
// AddParentsRecursive(temp1[i], &outList, &hash);
}
return outList.count();
}
示例2: InitOperCharsets
void InitOperCharsets()
{
csList.clear();
charset_struct *list[128];
int count = charset_table.GetList(list, 128);
cstrhash<charset_struct*> hash;
int i;
for (i = 0; i<count; i++) hash[list[i]->name] = list[i];
ccollect< carray<char> > stringList;
if (LoadStringList(charsetSection, stringList))
{
for (i = 0; i<stringList.count(); i++)
{
charset_struct ** p = hash.exist(stringList[i].ptr());
if (p) csList.append(*p);
}
}
if (csList.count()<=0)
{
const char *lang = sys_locale_lang();
if (!strcmp("ru", lang))
{
#ifdef WIN32
csList.append(charset_table[CS_WIN1251]);
csList.append(charset_table[CS_CP866]);
csList.append(charset_table[CS_UTF8]);
#else
csList.append(charset_table[CS_UTF8]);
csList.append(charset_table[CS_WIN1251]);
csList.append(charset_table[CS_KOI8R]);
csList.append(charset_table[CS_CP866]);
#endif
}
}
if (csList.count()<=0)
{
csList.append(charset_table[CS_UTF8]);
csList.append(&charsetLatin1);
}
}
示例3: LoadStringList
bool LoadStringList(const char *section, ccollect< carray<char> > &list)
{
char name[64];
list.clear();
for (int i=1; ; i++)
{
snprintf(name, sizeof(name), "v%i", i);
carray<char> s = RegReadString(section, name, "");
if (!s.ptr() || !s[0]) break;
list.append(s);
}
return true;
}
示例4: GetAppList
int AppDefListFile::GetAppList( int mime, ccollect<int>& appList )
{
auto i = hash.find( mime );
ccollect<int, 1>* p = ( i == hash.end() ) ? nullptr : &(i->second);
if ( p )
{
for ( int i = 0, cnt = p->count(); i < cnt; i++ )
{
appList.append( p->get( i ) );
}
}
return appList.count();
}
示例5: GetParentList
int MimeSubclasses::GetParentList( int mime, ccollect<int>& list )
{
auto i = hash.find( mime );
ccollect<int>* p = ( i == hash.end() ) ? nullptr : &(i->second);
if ( p )
{
for ( int i = 0, cnt = p->count(); i < cnt; i++ )
{
list.append( p->get( i ) );
}
}
return list.count();
}
示例6: LangListLoad
static bool LangListLoad(sys_char_t *fileName, ccollect<LangListNode> &list)
{
list.clear();
try {
BFile f;
f.Open(fileName);
char buf[4096];
while (f.GetStr(buf, sizeof(buf)))
{
char *s = buf;
while (IsSpace(*s)) s++;
if (*s == '#') continue;
if (!*s) continue;
ccollect<char,0x100> id;
ccollect<char,0x100> name;
while (*s && !IsSpace(*s)) {
id.append(*s);
s++;
}
while (IsSpace(*s)) s++;
int lastNs = -1;
for (int i = 0; *s; i++, s++) {
if (*s == '#') break;
if (!IsSpace(*s)) lastNs = i;
name.append(*s);
}
if (id.count()<=0 || lastNs < 0) continue;
id.append(0);
name.append(0);
name[lastNs + 1] = 0;
LangListNode(id.ptr(), name.ptr());
list.append(LangListNode(id.ptr(), name.ptr()) );
}
} catch (cexception *ex) {
ex->destroy();
return false;
}
return true;
}
示例7: dlg
void CharsetDlg1::Add()
{
charset_struct *buf[128];
int bufCount = GetOtherCharsetList(buf, 128);
CharsetDialog dlg( (NCDialogParent*) Parent(), 0, _LT("Add charsets"), buf, bufCount);
int ret = dlg.DoModal();
if (ret == CMD_OK)
{
charset_struct * p = dlg.CurrentCharset();
if (!p) return;
csList.append(p);
list.SetList(csList.ptr(), csList.count());
list.MoveCurrent(csList.count()-1);
SaveOperCharsets();
return;
}
}
示例8: _GetAppList
static int _GetAppList( const unicode_t* fileName, ccollect<AppNode*>& list )
{
if ( !mimeDb.ptr() )
{
if ( FileIsExist( "/usr/share/mime/globs" ) )
{
mimeDb = new MimeDB( "/usr/share/mime/" );
}
else
{
mimeDb = new MimeDB( "/usr/local/share/mime/" );
}
}
if ( !appDb.ptr() )
{
if ( DirIsExist( "/usr/share/applications" ) )
{
appDb = new AppDB( "/usr/share/applications/" );
}
else
{
appDb = new AppDB( "/usr/local/share/applications/" );
}
}
if ( !userDefApp.ptr() )
{
const char* home = getenv( "HOME" );
if ( home )
{
userDefApp = new AppDefListFile( carray_cat<char>( home, "/.local/share/applications/mimeapps.list" ).data() );
}
}
mimeDb->Refresh();
appDb->Refresh();
if ( userDefApp.ptr() )
{
userDefApp->Refresh();
}
ccollect<int> mimeList;
if ( mimeDb->GetMimeList( fileName, mimeList ) )
{
int i;
std::unordered_map<int, bool> hash;
for ( i = 0; i < mimeList.count(); i++ )
{
ccollect<int> appList;
if ( userDefApp.ptr() )
{
userDefApp->GetAppList( mimeList[i], appList );
}
appDb->GetAppList( mimeList[i], appList );
for ( int j = 0; j < appList.count(); j++ )
{
bool Exists = hash.find( appList[j] ) != hash.end();
if ( !Exists )
{
hash[appList[j]] = true;
AppNode* p = appDb->GetApp( appList[j] );
if ( p && p->exec.data() )
{
list.append( p );
}
}
}
}
}
return list.count();
}