• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ccollect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ccollect的典型用法代码示例。如果您正苦于以下问题:C++ ccollect类的具体用法?C++ ccollect怎么用?C++ ccollect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ccollect类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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


示例3: 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


示例4: SaveStringList

void SaveStringList(const char *section, ccollect< carray<char> > &list)
{
	try {
		SysTextFileOut out;
				
		FSPath path = configDirPath;
		path.Push(CS_UTF8, carray_cat<char>(section, ".cfg").ptr());
		out.Open( (sys_char_t*)path.GetString(sys_charset_id) );
		
		for (int i = 0; i<list.count(); i++)
		{
			if (list[i].ptr() && list[i][0])
			{
				out.Put(list[i].ptr());
				out.PutC('\n');
			}
		}
		
		out.Flush();
		out.Close();
		
	} catch (cexception *ex) {
		ex->destroy();
		return ;
	}
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:26,代码来源:wcm-config.cpp


示例5: SaveOperCharsets

void SaveOperCharsets()
{
	ccollect< carray<char> > stringList;
	for (int i = 0; i<csList.count(); i++)
		stringList.append(new_char_str(csList[i]->name));
	SaveStringList(charsetSection, stringList);
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:7,代码来源:charsetdlg.cpp


示例6: 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


示例7: 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


示例8: 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


示例9: _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


示例10: GetNextOperCharsetId

int GetNextOperCharsetId(int id)
{
	if (csList.count()<=0) return CS_UTF8;
	int i;
	for (i = 0; i<csList.count(); i++)
		if (csList[i]->id == id) break;

	return (i+1 < csList.count()) ? csList[i+1]->id : csList[0]->id;
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:9,代码来源:charsetdlg.cpp


示例11:

const char *CfgLangDialog::GetId()
{ 
	int n = _list.GetCurrent();
	if (n <= 0 ) return "+";
	if (n == 1) return "-";
	n-=2;
	if (n >= nodeList->count()) return "+";
	return nodeList->get(n).id.ptr();
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:9,代码来源:wcm-config.cpp


示例12:

void CharsetDlg1::Del()
{
	int n = list.GetCurrent();
	if (n >=0 && n<csList.count() && csList.count() > 1 &&
			NCMessageBox((NCDialogParent*)Parent(), _LT("Del"), 
				carray_cat<char>(_LT("Delete element")," '", csList[n]->name ,"' ?").ptr(), false, bListOkCancel) == CMD_OK)
	{
		csList.del(n);
		list.SetList(csList.ptr(), csList.count());
		SaveOperCharsets();
		list.Invalidate();
	}
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:13,代码来源:charsetdlg.cpp


示例13: 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


示例14: RefreshFontInfo

void StyleOptDialog::RefreshFontInfo()
{
	int count = pList->count();
	int cur = fontList.GetCurrent();
	
	const char *s = "";
	if (count>=0 && cur>=0 && cur<count)
	{
		int n = fontList.GetCurrentInt();
		if (pList->get(n).newFont.ptr())
			s = pList->get(n).newFont->printable_name();
		else
		if (pList->get(n).oldFont)
			s = pList->get(n).oldFont->printable_name();
	}
		
	fontNameStatic.SetText(utf8_to_unicode(s).ptr());
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:18,代码来源:wcm-config.cpp


示例15: SetCurLang

void SysOptDialog::SetCurLang(const char *id)
{
	curLangId = new_char_str(id);
	if (id[0] == '-')
		langVal.SetText( utf8_to_unicode( _LT("English") ).ptr() );
	else if (id[0]=='+') 
		langVal.SetText( utf8_to_unicode( _LT("Autodetect") ).ptr() );
	else {
		for (int i = 0; i<list.count(); i++)
		{
			if (!strcmp(list[i].id.ptr(), id)) {
				langVal.SetText( utf8_to_unicode( list[i].name.ptr() ).ptr() );
				return;
			}
		}
		langVal.SetText( utf8_to_unicode( id ).ptr() );
	}
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:18,代码来源:wcm-config.cpp


示例16: GetFirstOperCharsetId

int GetFirstOperCharsetId()
{
	return csList.count()>0 ? csList[0]->id : CS_UTF8;
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:4,代码来源:charsetdlg.cpp


示例17: Command

bool StyleOptDialog::Command(int id, int subId, Win *win, void *data)
{
	
	if (win == &fontList)
	{
		RefreshFontInfo();
		return true;
	}
#ifdef _WIN32
	if (id == CMD_CHFONT)
	{
		int count = pList->count();
		int cur = fontList.GetCurrent();
	
		if (count<=0 || cur<0 || cur>=count) return true;

		LOGFONT lf;
		carray<char> *pUri = pList->get(fontList.GetCurrentInt()).pUri;
		cfont::UriToLogFont(&lf, pUri && pUri->ptr() ?  pUri->ptr() : 0);

		CHOOSEFONT cf;
		memset(&cf,0,sizeof(cf));
		cf.lStructSize = sizeof(cf);
		cf.hwndOwner = GetID();
		cf.lpLogFont = &lf;
		cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT ;

		if (pList->get(fontList.GetCurrentInt()).fixed)
			cf.Flags |= CF_FIXEDPITCHONLY;


		if (ChooseFont(&cf))
		{
			cptr<cfont> p = new cfont(cfont::LogFontToUru(lf).ptr());
			if (p.ptr()) {
				pList->get(fontList.GetCurrentInt()).newFont = p;
				RefreshFontInfo();
			}
		}

		return true;
	}

#else
	if (id == CMD_CHFONT)
	{
		int count = pList->count();
		int cur = fontList.GetCurrent();
	
		if (count<=0 || cur<0 || cur>=count) return true;
		
		carray<char> *pUri = pList->get(fontList.GetCurrentInt()).pUri;
		
		cptr<cfont> p = SelectFTFont((NCDialogParent*)Parent(), pList->get(fontList.GetCurrentInt()).fixed, (pUri && pUri->ptr()) ? pUri->ptr() : 0 );
		if (p.ptr()) {
			pList->get(fontList.GetCurrentInt()).newFont = p;
			RefreshFontInfo();
		}
		
		return true;
	}
	
	if (id == CMD_CHFONTX11)
	{
		int count = pList->count();
		int cur = fontList.GetCurrent();
	
		if (count<=0 || cur<0 || cur>=count) return true;

		cptr<cfont> p = SelectX11Font((NCDialogParent*)Parent(), pList->get(fontList.GetCurrentInt()).fixed);
		if (p.ptr()) {
			pList->get(fontList.GetCurrentInt()).newFont = p;
			RefreshFontInfo();
		}
		
		return true;
	}
#endif
	
	return NCVertDialog::Command(id, subId, win, data);
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:81,代码来源:wcm-config.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cfdemCloud类代码示例发布时间:2022-05-31
下一篇:
C++ ccHObject类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap