Abstract class that represents a set of ordered strings. You can add strings to a set and retrieve them by a numeric index (index values for strings are 1-based). To create a string set, use :CreateStringSet.
virtual int AddString( LPCSTR lpszString ) |
:AddString adds a string to the end of a list. |
virtual int GetCount() |
:GetCount gets the number of strings contained in a list. |
virtual LPCSTR GetString( int iIndex ) |
:GetString gets the string located at the passed index. |
virtual int GetIndexForString( LPCSTR lpszString ) |
:GetIndexForString gets the index for the passed string. |
int CCFXStringSet::AddString(LPCSTR lpszString) |
Adds a string to the end of the list.
The index of the string that was added.
Parameter |
Description |
|---|---|
lpszString |
String to add to the list |
The following example demonstrates adding three strings to a string set and saving the indexes of the items that are added:
CCFXStringSet* pSet = pRequest->CreateStringSet() ; |
int CCFXStringSet::GetCount(void) |
Gets the number of strings in a string set. The value can be used with :GetString to iterate over the strings in the set (recall that the index values for strings in the list begin at 1).
Returns the number of strings contained in the string set.
The following example demonstrates using GetCount with :GetString to iterate over a string set and write the contents of the list back to the user:
int nNumItems = pStringSet->GetCount() ; |
int CCFXStringSet::GetIndexForString(LPCSTR lpszString) |
Searches for a passed string. The search is case-insensitive.
If the string is found, its index within the string set is returned. If it is not found, the constant CFX_STRING_NOT_FOUND is returned.
Parameter |
Description |
|---|---|
lpszString |
String to search for |
The following example demonstrates a search for a string and throwing an exception if it is not found:
CCFXStringSet* pAttribs = pRequest->GetAttributeList() ; |
LPCSTR CCFXStringSet::GetString(int iIndex) |
Retrieves the string located at the passed index (index values are 1-based).
Returns the string located at the passed index.
Parameter |
Description |
|---|---|
iIndex |
Index of string to retrieve |
The following example demonstrates GetString with :GetCount to iterate over a string set and write the contents of a list back to the user:
int nNumItems = pStringSet->GetCount() ; |
Sign in to your account