Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_string_aux.h
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1994,1995,1996 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author : Paul Taylor, Simon King */
34 /* Date : 1994-99 */
35 /*-----------------------------------------------------------------------*/
36 /* Utility EST_String Functions header file */
37 /* */
38 /*=======================================================================*/
39 
40 #ifndef __EST_STRING_AUX_H__
41 #define __EST_STRING_AUX_H__
42 
43 #include "EST_TList.h"
44 #include "EST_String.h"
45 #include "EST_types.h"
46 #include "EST_rw_status.h"
47 
48 void StringtoStrList(EST_String s, EST_StrList &l, EST_String sep="");
49 void BracketStringtoStrList(EST_String s, EST_StrList &l, EST_String sep="");
50 
51 EST_read_status load_StrList(EST_String filename, EST_StrList &l);
52 EST_write_status save_StrList(EST_String filename, EST_StrList &l,
53  EST_String style="words");
54 
55 
56 void strip_quotes(EST_String &s, const EST_String quote_char="\"");
57 
58 // makes EST_String from integer.
59 EST_String itoString(int n);
60 // makes EST_String from float, with variable precision
61 EST_String ftoString(float n, int pres=3, int width=0, int l=0);
62 int Stringtoi(EST_String s);
63 
64 int StrListtoIList(EST_StrList &s, EST_IList &il);
65 int StrListtoFList(EST_StrList &s, EST_FList &il);
66 
67 void StrList_to_StrVector(EST_StrList &l, EST_StrVector &v);
68 void StrVector_to_StrList(EST_StrVector &v,EST_StrList &l);
69 int StrVector_index(const EST_StrVector &v,const EST_String &s);
70 
71 int strlist_member(const EST_StrList &l,const EST_String &s);
72 int strlist_index(const EST_StrList &l,const EST_String &s);
73 
74 // strips path off front of filename
75 EST_String basename(EST_String full, EST_String ext="");
76 
77 // this is not the right place for these
78 void IList_to_IVector(EST_IList &l, EST_IVector &v);
79 void IVector_to_IList(EST_IVector &v,EST_IList &l);
80 int IVector_index(const EST_IVector &v,const int s);
81 
82 int ilist_member(const EST_IList &l,int i);
83 int ilist_index(const EST_IList &l,int i);
84 
85 #endif // __EST_STRING_AUX_H__