本文整理汇总了C++中StringList::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::Count方法的具体用法?C++ StringList::Count怎么用?C++ StringList::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::Count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createArrayList
RRList* createArrayList(const rr::NewArrayList& aList)
{
if(!aList.Count())
{
return NULL;
}
RRListItemPtr myItem;
// Setup a RRStringArrayList structure from aList
RRListPtr theList = createRRList();
int itemCount = aList.Count();
for(int i = 0; i < itemCount; i++)
{
//Have to figure out subtype of item
NewArrayListItemObject* ptr = const_cast<NewArrayListItemObject*>(&aList[i]);
if(dynamic_cast<NewArrayListItem<int>*>(ptr))
{
int val = (int) *(dynamic_cast<NewArrayListItem<int>*>(ptr));
myItem = createIntegerItem (val);
addItem (theList, &myItem);
}
else if(dynamic_cast<NewArrayListItem<double>*>(ptr))
{
double val = (double) *(dynamic_cast<NewArrayListItem<double>*>(ptr));
myItem = createDoubleItem (val);
addItem (theList, &myItem);
}
else if(dynamic_cast<NewArrayListItem<string>*>(ptr))
{
string item = (string) *(dynamic_cast<NewArrayListItem<string>*>(ptr));
char* str = (char *) new char[item.size() + 1];
strcpy (str, item.c_str());
myItem = createStringItem (str);
addItem (theList, &myItem);
}
else if(dynamic_cast<NewArrayListItem<StringList>*>(ptr))
{
StringList list = (StringList) *(dynamic_cast<NewArrayListItem<StringList>*>(ptr));
NewArrayList aList;
for(int i = 0; i < list.Count(); i++)
{
aList.Add(list[i]);
}
RRListPtr myList = createArrayList (aList);
myItem = createListItem(myList);
addItem (theList, &myItem);
}
else if(dynamic_cast<NewArrayListItem<NewArrayList>*>(ptr))
{
NewArrayList list = (NewArrayList) *(dynamic_cast<NewArrayListItem<NewArrayList>*>(ptr));
RRListPtr myList = createArrayList (list);
RRListItemPtr myListItem = createListItem (myList);
addItem (theList, &myListItem);
}
}
return theList;
}
示例2: Add
void ArrayList::Add(const string& lbl, const StringList& list)
{
ArrayList temp;
temp.Add(lbl);
if (list.Count())
temp.Add(list);
Add(temp);
}
示例3: createList
RRStringArrayPtr createList(const StringList& sList)
{
if(!sList.Count())
{
return NULL;
}
RRStringArray* list = new RRStringArray;
list->Count = sList.Count();
list->String = new char*[list->Count];
for(int i = 0; i < list->Count; i++)
{
list->String[i] = rr::createText(sList[i]);
}
return list;
}
示例4: QuickSortDemo
static void QuickSortDemo() {
// item 541
StringList unsorted;
StringList sorted;
StringList reverse;
StringList empty;
StringList flat;
// item 540
const char* unsortedA[] = { "the", "sooner", "we", "start", "this", "the", "better", 0 };
const char* sortedA[] = { "aa", "bb", "cc", "dd", "ee", "ff", 0 };
const char* reverseA[] = { "ff", "ee", "dd", "cc", "bb", "aa", 0 };
const char* emptyA[] = { 0 };
const char* flatA[] = { "flat", "flat", "flat", "flat", "flat", 0};
// item 577
cout << "quick sort demo" << endl;
// item 563
Fill(&unsorted, unsortedA);
Fill(&sorted, sortedA);
Fill(&reverse, reverseA);
Fill(&empty, emptyA);
Fill(&flat, flatA);
// item 733
SimpleComparer comparer;
// item 669
QuickSort(&unsorted, 0, unsorted.Count(), &comparer);
QuickSort(&sorted, 0, sorted.Count(), &comparer);
QuickSort(&reverse, 0, reverse.Count(), &comparer);
QuickSort(&empty, 0, empty.Count(), &comparer);
QuickSort(&flat, 0, flat.Count(), &comparer);
// item 576
Print(&unsorted);
Print(&sorted);
Print(&reverse);
Print(&empty);
Print(&flat);
// item 711
StringsAreSorted(&unsorted);
StringsAreSorted(&sorted);
StringsAreSorted(&reverse);
StringsAreSorted(&empty);
StringsAreSorted(&flat);
}
示例5: AddItemsToListBox
void TMForm::AddItemsToListBox(const StringList& items)
{
Log(rr::lInfo)<<items;
for(int i = 0; i < items.Count(); i++)
{
SelList->Items->Add(items[i].c_str());
SelList->Checked[i] = true;
}
}
示例6: GetStringList
StringList ArrayList::GetStringList(const string& lName)
{
//Look for ann array list whose first item is a string with lName and second item is a stringlist, i.e. {{string, {string string string}}
StringList aList;
for(u_int i = 0; i < Count(); i++)
{
ArrayListItemBase* listPtr = const_cast<ArrayListItemBase*>(mList[i]);
//Check for a list which first element is a string, i.e. a {{string}, {string, string}} list
if(dynamic_cast< ArrayListItem<ArrayList> *>(listPtr))
{
ArrayList list = (ArrayList) *(dynamic_cast< ArrayListItem<ArrayList> *>(listPtr));
if(list.Count())
{
ArrayListItemBase* anItem = &list[0];
if(dynamic_cast<ArrayListItem<string>*>(anItem))
{
string str = (string) *dynamic_cast<ArrayListItem<string>*>(anItem);
if(str == lName && list.Count() > 1)
{
ArrayListItemBase* anItem = &list[1];
if(dynamic_cast<ArrayListItem<StringList> *>(anItem))
{
//This is a stringList
StringList list = (StringList) *(dynamic_cast<ArrayListItem<StringList>*>(anItem));
for(int i = 0; i < list.Count(); i++)
{
string str = list[i];
aList.add(str);
}
}
if(dynamic_cast<ArrayListItem<ArrayList> *>(anItem))
{
//Assume this list only contains strings!
ArrayList list = (ArrayList) *(dynamic_cast<ArrayListItem<ArrayList>*>(anItem));
for(int i = 0; i < list.Count(); i++)
{
string str = list.GetString(i);
aList.add(str);
}
}
}
}
}
}
}
return aList;
}
示例7: getSelectionListFromSettings
StringList getSelectionListFromSettings(const SimulationSettings& settings)
{
//read from settings the variables found in the amounts and concentrations lists
StringList theList;
TSelectionRecord record;
int nrOfVars = settings.mVariables.Count();
for(int i = 0; i < settings.mAmount.Count(); i++)
{
theList.Add("[" + settings.mAmount[i] + "]"); //In the setSelection list below, the [] selects the correct 'type'
}
for(int i = 0; i < settings.mConcentration.Count(); i++)
{
theList.Add(settings.mConcentration[i]);
}
//We may have variables
//A variable 'exists' only in "variables", not in the amount or concentration section
int currCount = theList.Count();
if( nrOfVars > currCount)
{
//Look for a variable that is not in the list
for(int i = 0; i < settings.mVariables.Count(); i++)
{
string aVar = settings.mVariables[i];
if(settings.mAmount.DontContain(aVar) && settings.mConcentration.DontContain(aVar))
{
theList.Add(settings.mVariables[i]);
}
}
}
theList.InsertAt(0, "time");
return theList;
}