本文整理汇总了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;
}
示例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 );
}
示例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 );
}
示例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 );
}