![]()
|
TOP --> libjdl
A dynamic list of strings.
public CJdlStringList ( ) ; Default constructor. public CJdlStringList ( uint size ) ; Constructor.
public CJdlStringList ( const CJdlStringList & ) ; Copy constructor.
public CJdlStringList ( const char * str , const char * sep ) ; Tokenizing constructor. The constructor allows you to create a list of tokens from an input string. It is useful for parsing and is similar to the ::strtok() operator in "C". Sample usage: // Parse the tokens that are separated by colons. CJdlString str = "fld1:fld2:fld3:fld4::"; CJdlStringList list(str,":"); printf("token[0] = '%s'\n",0,token[0].str()); printf("token[1] = '%s'\n",0,token[1].str());
public ~ CJdlStringList ( ) ; Destructor. public void Append ( const char * str ) ; Append a string to the list. Sample usage: #include "jdlstringlist.h" static void foo() { CJdlStringList list; list.Append("this"); list.Append("that"); list.Append("the"); list.Append("other"); list.Append("zzz"); list.Append("aaa"); }
public void Append ( CJdlStringList & list ) ; Append a string list to the list. Sample usage: #include "jdlstringlist.h" static void foo() { CJdlStringList list; list.Append("this"); list.Append("that"); list.Append("the"); list.Append("other"); list.Append("zzz"); list.Append("aaa"); CJdlStringList list1; list1.Append(list); }
public const char * str ( CJdlString & out , const char * sep = 0 ) const ; Convert a list to a string. Sample usage: #include "jdlstringlist.h" static void foo() { CJdlStringList list; list.Append("this"); list.Append("that"); list.Append("the"); list.Append("other"); list.Append("zzz"); list.Append("aaa"); CJdlString tmp; printf("list contents:",list.str(tmp,"\n\t"); printf("\n"); }
public void Tokenize ( const char * str , const char * sep ) ; Tokenize a string and store the substrings in this list. Sample usage: // Parse the tokens that are separated by colons. CJdlString str = "fld1:fld2:fld3:fld4::"; CJdlStringList list; list.Tokenize(str,":"); printf("token[0] = '%s'\n",0,token[0].str()); printf("token[1] = '%s'\n",0,token[1].str());
public void ReadDir ( const char * dir , bool sort = true ) ; Read the contents of a directory and append it to this list. The file names in the returned list do not have the root directory pre-pended. An example is shown below: CJdlString list; list.ReadDir("."); for(uint i=0;i<list.Length();i++) { printf("file[%03d] = '%s'\n",list[i].str()); }
public bool BinarySearchFor ( const char * str ) const ; Do binary search to see whether the specified string exists in the list. This is only valid for sorted lists.
public bool SearchFor ( const char * str ) const ; Do linear search to see whether the specified string exists in the list.
public void Copy ( const CJdlStringList & list ) ; Copy.
public CJdlStringList & operator = ( const CJdlStringList & list ) ; Copy operator.
This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to return to the top of the page. |