本文整理汇总了C++中JsonArray::Construct方法的典型用法代码示例。如果您正苦于以下问题:C++ JsonArray::Construct方法的具体用法?C++ JsonArray::Construct怎么用?C++ JsonArray::Construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonArray
的用法示例。
在下文中一共展示了JsonArray::Construct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildIndexForUser
void UsersPanel::BuildIndexForUser(JsonArray * friends) {
/*
String letter, prevLetter = L"";
int currentGroup = 0;
JsonArray * array = new JsonArray();
array->Construct();
for (int i=0; i<friends->GetCount(); i++) {
JsonObject *user;
JsonParseUtils::GetObject(friends, i, user);
String name;
JsonParseUtils::GetString(*user, L"first_name", name);
name.SubString(0, 1, letter);
if (letter != prevLetter) {
_fastScrollIndex.Append(letter);
_pCurrentModel->AddUserGroup(prevLetter, array);
if (prevLetter.GetLength() > 0) {
AppLog("Adding %ls to %d item", prevLetter.GetPointer(), currentGroup);
_pLetterNav->Add(new String(prevLetter), new Integer(currentGroup));
currentGroup++;
}
prevLetter = letter;
delete array;
array = new JsonArray();
array->Construct();
} else {
array->Add(user);
}
}*/
HashMap *letterMap = new HashMap();
letterMap->Construct();
for(int i = 0; i < friends->GetCount(); i++) {
JsonObject *user;
JsonParseUtils::GetObject(friends, i, user);
String name;
JsonParseUtils::GetString(*user, L"first_name", name);
String letter;
name.SubString(0, 1, letter);
JsonArray *letterArray;
if(!letterMap->ContainsKey(letter)) {
letterArray = new JsonArray();
letterArray->Construct();
letterMap->Add(new String(letter), letterArray);
} else {
letterArray = static_cast<JsonArray*>(letterMap->GetValue(letter));
}
letterArray->Add(user);
}
IList *letterList = letterMap->GetKeysN();
StringComparer comparer;
letterList->Sort(comparer);
for(int i = 0; i < letterList->GetCount(); i++) {
String *letter = static_cast<String *>(letterList->GetAt(i));
_fastScrollIndex.Append(*letter);
_pCurrentModel->AddUserGroup(*letter, static_cast<JsonArray *>(letterMap->GetValue(*letter)));
_pLetterNav->Add(new String(*letter), new Integer(i));
}
delete letterList;
delete letterMap;
}