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


C++ JArray::SetSortOrder方法代码示例

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


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

示例1:

JArray<JTEStyler::TokenData>*
JTEStyler::NewTokenStartList()
{
	JArray<TokenData>* list = new JArray<TokenData>(kListBlockSize);
	assert( list != NULL );
	list->SetSortOrder(JOrderedSetT::kSortAscending);
	list->SetCompareFunction(CompareTokenStarts);
	return list;
}
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:9,代码来源:JTEStyler.cpp

示例2: getpwuid

static JBoolean
jGetUserInfo
	(
	const uid_t uid,
	jUIDInfo*	info
	)
{
	if (theUserInfoMap.IsEmpty())
		{
		theUserInfoMap.SetCompareFunction(jCompareUIDs);
		theUserInfoMap.SetSortOrder(JOrderedSetT::kSortAscending);
		atexit(jCleanUserInfoMap);
		}

	const jUIDInfo target = { uid, NULL, NULL };
	JIndex i;
	if (theUserInfoMap.SearchSorted(target, JOrderedSetT::kAnyMatch, &i))
		{
		*info = theUserInfoMap.GetElement(i);
		}
	else
		{
		passwd* pwbuf = getpwuid(uid);
		if (pwbuf != NULL)
			{
			info->userName = new JString(pwbuf->pw_name);
			assert( info->userName != NULL );

			info->realName = new JString(pwbuf->pw_gecos);
			assert( info->realName != NULL );

			info->homeDirectory = new JString(pwbuf->pw_dir);
			assert( info->homeDirectory != NULL );

			info->shell = new JString(pwbuf->pw_shell);
			assert( info->shell != NULL );

			info->id = uid;
			const JBoolean inserted = theUserInfoMap.InsertSorted(*info, kJFalse);
			assert( inserted );
			}
		else
			{
			info->userName = info->realName = info->homeDirectory = info->shell = NULL;
			}
		}

	return JI2B( info->userName != NULL );
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:49,代码来源:jSysUtil_UNIX.cpp

示例3: JConvertToBoolean

JBoolean
CBSymbolList::ClosestMatch
	(
	const JString&	prefixStr,
	JArray<JIndex>&	visibleList,
	JIndex*			index
	)
	const
{
	visibleList.SetCompareObject(ClosestMatchCompare(prefixStr, *itsSymbolList));
	visibleList.SetSortOrder(itsSymbolList->GetSortOrder());

	JBoolean found;
	*index = visibleList.SearchSorted1(0, JOrderedSetT::kFirstMatch, &found);
	if (*index > visibleList.GetElementCount())		// insert beyond end of list
		{
		*index = visibleList.GetElementCount();
		}

	return JConvertToBoolean( *index > 0 );
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:21,代码来源:CBSymbolList.cpp

示例4: getgrgid

static JBoolean
jGetGroupInfo
	(
	const gid_t	gid,
	jGIDInfo*	info
	)
{
	if (groupInfoMap.IsEmpty())
		{
		groupInfoMap.SetCompareFunction(jCompareGIDs);
		groupInfoMap.SetSortOrder(JOrderedSetT::kSortAscending);
		}

	const jGIDInfo target = { gid, NULL };
	JIndex i;
	if (groupInfoMap.SearchSorted(target, JOrderedSetT::kAnyMatch, &i))
		{
		*info = groupInfoMap.GetElement(i);
		}
	else
		{
		group* grpbuf = getgrgid(gid);
		if (grpbuf != NULL)
			{
			info->groupName = new JString(grpbuf->gr_name);
			assert( info->groupName != NULL );

			info->id = gid;
			const JBoolean inserted = groupInfoMap.InsertSorted(*info, kJFalse);
			assert( inserted );
			}
		else
			{
			info->groupName = NULL;
			}
		}

	return JI2B( info->groupName != NULL );
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:39,代码来源:jSysUtil_UNIX.cpp


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