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


C++ ccollect::append方法代码示例

本文整理汇总了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();
}
开发者ID:kamtec1,项目名称:WalCommander,代码行数:28,代码来源:ext-app-ux.cpp

示例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);
	}
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:45,代码来源:charsetdlg.cpp

示例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;
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:14,代码来源:wcm-config.cpp

示例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();
}
开发者ID:kamtec1,项目名称:WalCommander,代码行数:16,代码来源:ext-app-ux.cpp

示例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();
}
开发者ID:kamtec1,项目名称:WalCommander,代码行数:16,代码来源:ext-app-ux.cpp

示例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;
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:46,代码来源:wcm-config.cpp

示例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;
	}
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:18,代码来源:charsetdlg.cpp

示例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();
}
开发者ID:kamtec1,项目名称:WalCommander,代码行数:82,代码来源:ext-app-ux.cpp


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