System class CATListValCATString

Usage: you must use this class as is. You should never derive it.


public class CATListValCATString

Class to implement a mutable list of CATString.
Role: The purpose of this class is to let C++ classes easily pass and receive lists of CATString. The class handles all the low-level memory allocation tasks such as reallocating the list once it capacity has been exceeded. It also provides high level operations such as sorting, comparison, etc... The first element has index 1.
Use the type CATListOfCATString


Constructor and Destructor Index


o CATListValCATString()
Constructs an empty list of CATStrings.
o CATListValCATString(int)
Constructs an empty list of CATStrings with a specified initial capacity.
o CATListValCATString(CATString*,int)
Constructs a list and initializes it with a C++ CATString array.
o CATListValCATString(CATString**,int)
Constructs a list and initializes it with a C++ pointer to CATString array.
o CATListValCATString(CATListValCATString&)
Copy constructor.
o ~CATListValCATString()
Destructor.

Method Index


o Append(CATString&)
Appends a CATString to the list.
o Append(CATListValCATString&)
Appends the content of a CATString list.
o Array(CATString*)
Fills a C++ array of CATStrings with elements from the list.
o Array(CATString**)
Fills a C++ array of pointers to CATStrings with elements from the list.
o Compare(CATListValCATString&,CATListValCATString&,int(*iPFCompare)(CATString*,*))
Compares two lists of CATStrings.
o InsertAfter(int,CATString&)
Inserts a CATString after the specified index.
o InsertBefore(int,CATString&)
Inserts a CATString before the specified index.
o Intersection(CATListValCATString&,CATListValCATString&,CATListValCATString&)
Computes the intersection of two lists.
o Locate(CATString&,int)
Finds the first occurrence of a CATString from a given index.
o NbOccur(CATString&)
Counts the occurrences of a CATString in the list.
o QuickSort(int(*iPFCompare)(CATString*,*))
Sorts the list using the quicksort algorithm.
o Remove(CATListValCATString&)
Removes all the values specifed in iSubstract from the list.
o RemoveAll(CATCollec::MemoryHandling)
Removes all the elements from the list.
o RemoveDuplicates()
Removes all the duplicate occurrences of a CATString from the list.
o RemoveDuplicates(CATListValCATString&)
Removes all the duplicate occurrences of a CATString from the list and appends them to another list.
o RemovePosition(int)
Removes the CATString located at a given index.
o RemoveValue(CATString&)
Removes the first occurrence of a CATString from the list.
o Replace(int,CATString&)
Replaces an element at a specified index with another CATString value.
o Size()
Returns the size of the list.
o Size(int,CATString*)
Forces the size of the list to an arbitrary size.
o Swap(int,int)
Swaps two list elements.
o operator !=(CATListValCATString&)
Inequality operator.
o operator >(CATListValCATString&)
Greater than operator.
o operator >=(CATListValCATString&)
Greater than or equal to operator.
o operator <(CATListValCATString&)
Less than operator.
o operator <=(CATListValCATString&)
Less than or equal to operator.
o operator ==(CATListValCATString&)
Equality operator.
o operator=(CATListValCATString&)
Assignment operator.
o operator[](int)
Subscripting operator.
o operator[](int)
Subscripting operator.

Constructor and Destructor


o CATListValCATString
public CATListValCATString()
Constructs an empty list of CATStrings.
o CATListValCATString
public CATListValCATString(int iInitAlloc)
Constructs an empty list of CATStrings with a specified initial capacity.
Parameters:
iInitAlloc
The default capacity of the list.
o CATListValCATString
public CATListValCATString(CATString* iArray,
int iSize)
Constructs a list and initializes it with a C++ CATString array.
Parameters:
iArray
A C++ array CATStrings used to initialize the list.
iSize
The size of the C++ array of CATStrings used to initialize the list.
o CATListValCATString
public CATListValCATString(CATString** iArray,
int iSize)
Constructs a list and initializes it with a C++ pointer to CATString array.
Parameters:
iArray
A C++ array of pointers to CATStrings used to initialize the list.
iSize
The size of the C++ array of CATStrings used to initialize the list.
o CATListValCATString
public CATListValCATString( const CATListValCATString& iCopy)
Copy constructor.
Parameters:
iCopy
The list to copy.
o ~CATListValCATString
public ~CATListValCATString()
Destructor.

Methods


o Append
public void Append( const CATString& iAdd)
Appends a CATString to the list.
Parameters:
iAdd
The CATString to append.
o Append
public void Append( const CATListValCATString& iConcat)
Appends the content of a CATString list.
Parameters:
iConcat
The CATString list to append.
o Array
public void Array(CATString* ioArray)const
Fills a C++ array of CATStrings with elements from the list.
Role: The array has to have the same size as the list.
Parameters:
ioArray
The C++ array to fill.
o Array
public void Array(CATString** ioArray)const
Fills a C++ array of pointers to CATStrings with elements from the list.
Role: The array has to have the same size as the list.
Parameters:
ioArray
The C++ array to fill.
o Compare
public static int Compare( const CATListValCATString& iLV1,
const CATListValCATString& iLV2,
int(*iPFCompare)(CATString*,*) CATString)
Compares two lists of CATStrings.
Parameters:
iLV1
the first list of CATStrings.
iLV2
the second list of CATStrings.
iPFCompare
A pointer to a function which compares two CATStrings and returns -1, 0 or 1 depending on the order of the strings.
Returns:

Legal values: 0 if the lists are equal, -1 if the first list is smaller than the second list (smaller means that the first list contains less elements than the second list or that iRC1[i] < iRC2[i] for the first i where iRC1[i] != iRC2[i] and < is a lexicographic comparison of two strings), or 1 otherwise.
o InsertAfter
public void InsertAfter(int iIndex,
const CATString& iAdd)
Inserts a CATString after the specified index.
Parameters:
iIndex
The index of the element.
iAdd
The element to insert.
o InsertBefore
public void InsertBefore(int iIndex,
const CATString& iAdd)
Inserts a CATString before the specified index.
Parameters:
iIndex
The index of the element.
iAdd
The element to insert.
o Intersection
public static void Intersection( const CATListValCATString& iL1,
const CATListValCATString& iL2,
CATListValCATString& ioResult)
Computes the intersection of two lists.
Parameters:
iL1
The first list.
iL2
The second list.
ioResult
A list to which elements in the intersection are appended.
o Locate
public int Locate( const CATString& iLocate,
int iIndex= 1 )const
Finds the first occurrence of a CATString from a given index.
Parameters:
iLocate
The CATString to locate.
iIndex
The index at which the search is to begin.
Returns:

Legal values: The index of the located CATString, or 0 if the list does not contain the specified CATString.
o NbOccur
public int NbOccur( const CATString& iTest)
Counts the occurrences of a CATString in the list.
Parameters:
iTest
The CATString for which the occurrences are to be counted.
Returns:
The count of occurrences of the CATString in the list.
o QuickSort
public void QuickSort(int(*iPFCompare)(CATString*,*) CATString)
Sorts the list using the quicksort algorithm.
Parameters:
iPFCompare
A pointer to a function which compares two CATStrings and returns -1, 0 or 1 depending on the order of the strings.
o Remove
public int Remove( const CATListValCATString& iSubstract)
Removes all the values specifed in iSubstract from the list.
Parameters:
iSubstract
A list of CATStrings to remove.
Returns:
The count of CATStrings removed from the list.
o RemoveAll
public void RemoveAll(CATCollec::MemoryHandling iMH= CATCollec::ReleaseAllocation )
Removes all the elements from the list.
Parameters:
iMH

Legal values: Specifies whether the list capacity should be shrunk to 0 (CATCollec::ReleaseAllocation) or not (CATCollec::KeepAllocation).
o RemoveDuplicates
public int RemoveDuplicates()
Removes all the duplicate occurrences of a CATString from the list.
Returns:
The count of duplicate CATStrings removed from the list.
o RemoveDuplicates
public void RemoveDuplicates(CATListValCATString& ioExtract)
Removes all the duplicate occurrences of a CATString from the list and appends them to another list.
Parameters:
ioExtract
A list to which duplicate CATStrings are appended.
o RemovePosition
public void RemovePosition(int iIndex)
Removes the CATString located at a given index.
Parameters:
iIndex
The list index of the CATString to remove.
o RemoveValue
public int RemoveValue( const CATString& iRemove)
Removes the first occurrence of a CATString from the list.
Parameters:
iRemove
The CATString to remove.
Returns:

Legal values: The index of the removed CATString, or 0 if the list does not contain the specified CATString.
o Replace
public void Replace(int iIndex,
const CATString& iReplace)
Replaces an element at a specified index with another CATString value.
Parameters:
iIndex
index of the element to replace.
iReplace
The new CATString value.
o Size
public int Size()const
Returns the size of the list.
Returns:
the size of the list.
o Size
public void Size(int iSize,
const CATString* iFiller= NULL )
Forces the size of the list to an arbitrary size.
Role: If iSize is larger than the current size, the newly allocated slots contain iFiller.
Parameters:
iSize
The desired size.
iFiller
A CATString used to fill newly allocated slots.
o Swap
public void Swap(int iIndex1,
int iIndex2)
Swaps two list elements.
Parameters:
iIndex1
index of the first element to swap.
iIndex2
index of the second element to swap.
o operator !=
public int operator !=( const CATListValCATString& iLV)const
Inequality operator.
Parameters:
iLV
The list to test for inequality
Returns:

Legal values: 1 if the two lists are not equal, 0 otherwise.
o operator >
public int operator >( const CATListValCATString& iLV)const
Greater than operator.
Parameters:
iLV
The list to compare the receiver to.
Returns:

Legal values: 1 the receiver is greater than iLV, 0 otherwise
o operator >=
public int operator >=( const CATListValCATString& iLV)const
Greater than or equal to operator.
Parameters:
iLV
The list to compare the receiver to.
Returns:

Legal values: 1 the receiver is greater than or equal to iLV, 0 otherwise
o operator <
public int operator <( const CATListValCATString& iLV)const
Less than operator.
Parameters:
iLV
The list to compare the receiver to.
Returns:

Legal values: 1 the receiver is less than iLV, 0 otherwise
o operator <=
public int operator <=( const CATListValCATString& iLV)const
Less than or equal to operator.
Parameters:
iLV
The list to compare the receiver to.
Returns:

Legal values: 1 the receiver is less than or equal to iLV, 0 otherwise
o operator ==
public int operator ==( const CATListValCATString& iLV)const
Equality operator.
Role: Two lists are equal if they contain the same elements in the same lexicographic order.
Parameters:
iLV
The list to test for equality
Returns:

Legal values: 1 if the two lists are equal, 0 otherwise
o operator=
public CATListValCATString& operator=( const CATListValCATString& iCopy)
Assignment operator.
Role: Overwrites the content of the list with another list.
Parameters:
iCopy
The assigned list.
o operator[]
public CATString& operator[](int iIndex)
Subscripting operator.
Parameters:
iIndex
The index of the element.
Returns:
The CATString at index iIndex.
o operator[]
public const CATString& operator[](int iIndex)const
Subscripting operator.
Parameters:
iIndex
The index of the element.
Returns:
The CATString at index iIndex.

This object is included in the file: CATListOfCATString.h
If needed, your Imakefile.mk should include the module: JS0GROUP

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.