Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
KStringArray Class Reference

The KStringArray class provides a list of strings. More...

#include <kstringarray.h>

Inheritance diagram for KStringArray:
[legend]
Collaboration diagram for KStringArray:
[legend]

Public Member Functions

int Add (const KString &str)
 Adds an element to the end of the array; grows the array if necessary.
 
int Append (const KStringArray &src)
 Appends another array to the array; grows the array if necessary.
 
void Copy (const CStringArray &strArray)
 Copies another array to the array; grows the array if necessary.
 
void Copy (const KStringArray &src)
 Copies another array to the array; grows the array if necessary.
 
QString & ElementAt (int nIndex)
 Returns a temporary reference to the element pointer within the array.
 
void FreeExtra ()
 Frees all unused memory above the current upper bound.
 
const QString & GetAt (int nIndex) const
 Returns the value at a given index.
 
int GetCount () const
 Gets the number of elements in this array.
 
int GetSize () const
 Gets the number of elements in this array.
 
int GetUpperBound () const
 Returns the largest valid index.
 
void InsertAt (int nIndex, const KString &newElement, int nCount=1)
 Inserts an element at a specified index.
 
void InsertAt (int nStartIndex, const KStringArray &pNewArray)
 Inserts all the elements in another array at a specified index.
 
bool IsEmpty () const
 Determines if the array is empty.
 
 KStringArray ()
 
 KStringArray (const QStringList &strList)
 
 operator QStringList () const
 
KStringArrayoperator= (const QStringList &strList)
 
void RemoveAll ()
 Removes all the elements from this array.
 
void RemoveAt (int nIndex, int nCount=1)
 Removes an element at a specific index.
 
void SetAt (int nIndex, const KString &newElement)
 Sets the value for a given index; array not allowed to grow.
 
void SetAtGrow (int nIndex, const QString &newElement)
 Sets the value for a given index; grows the array if necessary.
 
void SetSize (int nNewSize, int nGrowBy=-1)
 
QStringList toQStringList () const
 

Detailed Description

The KStringArray class provides a list of strings.

This class can replace CStringArray with the same API, and is vector of KString. It is compatible with both CStringArray and QStringlist.

See also
https://learn.microsoft.com/en-us/cpp/mfc/reference/cstringarray-class

Constructor & Destructor Documentation

◆ KStringArray() [1/2]

KStringArray::KStringArray ( )

◆ KStringArray() [2/2]

KStringArray::KStringArray ( const QStringList & strList)

Member Function Documentation

◆ Add()

int KStringArray::Add ( const KString & str)

Adds an element to the end of the array; grows the array if necessary.

◆ Append()

int KStringArray::Append ( const KStringArray & src)

Appends another array to the array; grows the array if necessary.

◆ Copy() [1/2]

void KStringArray::Copy ( const CStringArray & strArray)

Copies another array to the array; grows the array if necessary.

◆ Copy() [2/2]

void KStringArray::Copy ( const KStringArray & src)

Copies another array to the array; grows the array if necessary.

◆ ElementAt()

QString & KStringArray::ElementAt ( int nIndex)

Returns a temporary reference to the element pointer within the array.

◆ FreeExtra()

void KStringArray::FreeExtra ( )

Frees all unused memory above the current upper bound.

◆ GetAt()

const QString & KStringArray::GetAt ( int nIndex) const

Returns the value at a given index.

◆ GetCount()

int KStringArray::GetCount ( ) const

Gets the number of elements in this array.

◆ GetSize()

int KStringArray::GetSize ( ) const

Gets the number of elements in this array.

◆ GetUpperBound()

int KStringArray::GetUpperBound ( ) const

Returns the largest valid index.

◆ InsertAt() [1/2]

void KStringArray::InsertAt ( int nIndex,
const KString & newElement,
int nCount = 1 )

Inserts an element at a specified index.

◆ InsertAt() [2/2]

void KStringArray::InsertAt ( int nStartIndex,
const KStringArray & pNewArray )

Inserts all the elements in another array at a specified index.

◆ IsEmpty()

bool KStringArray::IsEmpty ( ) const

Determines if the array is empty.

◆ operator QStringList()

KStringArray::operator QStringList ( ) const

◆ operator=()

KStringArray & KStringArray::operator= ( const QStringList & strList)

◆ RemoveAll()

void KStringArray::RemoveAll ( )

Removes all the elements from this array.

◆ RemoveAt()

void KStringArray::RemoveAt ( int nIndex,
int nCount = 1 )

Removes an element at a specific index.

◆ SetAt()

void KStringArray::SetAt ( int nIndex,
const KString & newElement )

Sets the value for a given index; array not allowed to grow.

◆ SetAtGrow()

void KStringArray::SetAtGrow ( int nIndex,
const QString & newElement )

Sets the value for a given index; grows the array if necessary.

◆ SetSize()

void KStringArray::SetSize ( int nNewSize,
int nGrowBy = -1 )

Sets the number of elements to be contained in this array.

◆ toQStringList()

QStringList KStringArray::toQStringList ( ) const

The documentation for this class was generated from the following file: