DumontEXE 0.0.1
Public Slots | Public Member Functions | Private Attributes
cmcStringList Class Reference

Cmc StringList Object. More...

#include <cmcStringList.h>

Inheritance diagram for cmcStringList:

List of all members.

Public Slots

bool allowDupes ()
 Duplicates flag
.
void append (const QString &string)
 Append a string
.
void clear ()
 Clear the List
.
long count ()
 Count the strings
.
QString item (long index)
 Fetch a string
.
QString join (const QString &separator="\r\n")
 Single Delimited String
.
QString line (long index)
 Fetch a string
.
void prepend (const QString &string)
 Prepend
.
bool removeOne (const QString &string)
 Take an item
.
QString takeAt (long index)
 Take an Item
.
QString takeFirst ()
 Take First
.
QString takeLast ()
 Take Last
.

Public Member Functions

 cmcStringList (const cmcStringList &copy)
 Copy Constructor
.
 cmcStringList (long flags=0, QObject *parent=NULL)
 General Constructor
.

Private Attributes

long m_flags
 Stored Flags
.
QStringList m_stringList
 Stored Strings
.

Detailed Description

Cmc StringList Object.

This object is designed to provide a simple, fast, string-list interface for vbScript. Why? Because, vbScript multi-string handling is... a pain! Especially when it comes to multiple listed items, like items that might be found in a dimmensioned array sort of affair. In vbScript, assembling those arrays of string is... well... more work than it needs to be. This object encapsulates a variable-length, auto-sized array of strings that are easy to access and manipulate.

This object is ideal for assembling dynamic lists, when the number of items in the list is not known until it is fully assembled, and during assembly it is possible that some duplicate items might be processed, and you want them automatically eliminated from the final list.

vbScript Example ~ Using the String List object
 dim dexe: set dexe = createObject( "Dumont.EXE" )
 dim dlog: set dlog = dexe.logWindow("dstr demo")
 dim dstr: set dstr = dexe.getStringList ' no duplicates (default)

 dstr.append "one"
 dstr.append "two"
 dstr.append "tre"
 dstr.append "one"

 dim i: for i = 0 to dstr.count - 1
   dlog.print dstr.item(i)
 next

 '
 ' output should be:
 '  'one'
 '  'two'
 '  'tre'

Note that the output from this function does not output the additional duplicate "one" value. That's because the string list object was requested to not allow duplicates. Optionally the string list object can be constructed to allow duplicates:

vbScript Example ~ Allowing Duplicates
 const cmcStringList_allowDupes = 1
 dim dstr: set dstr = dexe.getStringList(cmcStringList_allowDupes)

Using the string list object constructed in this fashion causes it to allow duplicate strings to be appended to it.

Definition at line 89 of file cmcStringList.h.


Constructor & Destructor Documentation

cmcStringList ( const cmcStringList copy)

Copy Constructor
.

Definition at line 6 of file cmcStringList.cpp.

cmcStringList ( long  flags = 0,
QObject *  parent = NULL 
)

General Constructor
.

Definition at line 10 of file cmcStringList.cpp.


Member Function Documentation

bool allowDupes ( ) [slot]

Duplicates flag
.

Definition at line 51 of file cmcStringList.cpp.

void append ( const QString &  string) [slot]

Append a string
.

Parameters:
stringstring ~ append text

Definition at line 87 of file cmcStringList.cpp.

void clear ( void  ) [slot]

Clear the List
.

This removes all the items from the list.

Definition at line 40 of file cmcStringList.cpp.

long count ( void  ) [slot]

Count the strings
.

Definition at line 113 of file cmcStringList.cpp.

QString item ( long  index) [slot]

Fetch a string
.

Parameters:
indexlong ~ index of item to fetch

Definition at line 98 of file cmcStringList.cpp.

QString join ( const QString &  separator = "\r\n") [slot]

Single Delimited String
.

Parameters:
separatorstring ~ separator (defaults to vbCrLf)

Definition at line 118 of file cmcStringList.cpp.

QString line ( long  index) [slot]

Fetch a string
.

Parameters:
indexlong ~ index of line to fetch

Definition at line 108 of file cmcStringList.cpp.

void prepend ( const QString &  string) [slot]

Prepend
.

Add an item to the beginning of the list

Parameters:
stringstring ~ text to prepend

Definition at line 56 of file cmcStringList.cpp.

bool removeOne ( const QString &  string) [slot]

Take an item
.

This removes an item from the list by value.

Definition at line 82 of file cmcStringList.cpp.

QString takeAt ( long  index) [slot]

Take an Item
.

Take an item by index number.

Parameters:
indexlong ~ index of item to take

Definition at line 77 of file cmcStringList.cpp.

QString takeFirst ( ) [slot]

Take First
.

Take the first item from the list.

Definition at line 67 of file cmcStringList.cpp.

QString takeLast ( ) [slot]

Take Last
.

Take the last item from the list.

Definition at line 72 of file cmcStringList.cpp.


Member Data Documentation

long m_flags [private]

Stored Flags
.

Definition at line 240 of file cmcStringList.h.

QStringList m_stringList [private]

Stored Strings
.

Definition at line 246 of file cmcStringList.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com