46 #include "EST_types.h"
47 #include "EST_String.h"
48 #include "EST_Pathname.h"
50 #include "EST_cutils.h"
51 #include "EST_Token.h"
57 for (p = s.head(); p; p = p->next())
58 if (!s(p).matches(RXdouble))
61 "Expecting a floating point value in StrListtoFlist(): got "
75 for (p = s.head(); p; p = p->next())
76 if (!s(p).matches(RXint))
79 "Expecting a integer value in StrListtoIList(): got "
122 for (
EST_Litem *p = l.head(); p; p = p->next())
131 if(ts.
open(filename) != 0){
132 cerr <<
"Can't open EST_StrList file " << filename << endl;
133 return misc_read_error;
154 outf =
new ofstream(filename);
159 if (style ==
"words")
161 for (p = l.head(); p; p = p->next())
170 else if (style ==
"lines")
171 for (p = l.head(); p; p = p->next())
172 *outf << l(p) << endl;
175 cerr <<
"Unknown style for writing StrLists: " << style << endl;
176 return misc_write_error;
187 for (p = l.head(); p != 0; p = p->next())
198 for (p = l.head(); p != 0; p = p->next())
217 for (p = l.head(),i=0; p != 0; p = p->next(),i++)
226 for (i=0;i<v.
length();i++)
void set_WhiteSpaceChars(const EST_String &ws)
set which characters are to be treated as whitespace
EST_TokenStream & get(EST_Token &t)
get next token in stream
void StrList_to_StrVector(EST_StrList &l, EST_StrVector &v)
Convert a list of strings to a vector of strings.
EST_write_status save_StrList(EST_String filename, EST_StrList &l, EST_String style)
Save tokens from a EST_StrList. If style is set to "lines" each item is stored on a separate line...
int StrListtoIList(EST_StrList &s, EST_IList &il)
Convert a list of strings to a list of integers.
void set_SingleCharSymbols(const EST_String &sc)
set which characters are to be treated as single character symbols
void BracketStringtoStrList(EST_String s, EST_StrList &l, EST_String sep)
Convert a EST_String enclosed in a single set of brackets to a EST_StrList by separating tokens in s ...
void close(void)
Close stream.
void clear(void)
remove all items in list
int open(const EST_String &filename)
open a EST_TokenStream for a file.
int open_string(const EST_String &newbuffer)
open a EST_TokenStream for string rather than a file
void set_PunctuationSymbols(const EST_String &ps)
set which characters are to be treated as (post) punctuation
INLINE int length() const
number of items in vector.
void resize(int n, int set=1)
int gsub(const char *os, const EST_String &s)
Substitute one string for another.
void StringtoStrList(EST_String s, EST_StrList &l, EST_String sep)
Convert a EST_String to a EST_StrList by separating tokens in s delimited by the separator sep...
void StrVector_to_StrList(EST_StrVector &v, EST_StrList &l)
Convert a vector of strings to a list of strings.
void append(const T &item)
add item onto end of list
int strlist_member(const EST_StrList &l, const EST_String &s)
Return true if s is in list l.
int strlist_index(const EST_StrList &l, const EST_String &s)
Search the vector and return the position of the first occurance of string s in the list...
int StrVector_index(const EST_StrVector &v, const EST_String &s)
Search the vector and return the position of the first occurance of string s in the vector...
int StrListtoFList(EST_StrList &s, EST_FList &f)
Convert a list of strings to a list of floats.
EST_read_status load_StrList(EST_String filename, EST_StrList &l)
Load tokens from a file and return them in a EST_StrList.
Utility EST_String Functions header file.
T & item(const EST_Litem *p)