Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

mootUtils.h File Reference

Go to the source code of this file.

Namespaces

Classes

String Utilities

Named File Utilities

Command-line utilities


Function Documentation

bool hmm_parse_model_name const std::string &  modelname,
std::string &  binfile,
std::string &  lexfile,
std::string &  ngfile,
std::string &  lcfile
 

Utility for mootHMM::load_model() and friends: parse a model name according to the conventions described in mootfiles(5).

Parameters:
modelname name of the model
binfile output string for binary model filename
lexfile output string for lexical frequency text-format filename
ngfile output string for n-gram frequency text-format filename
lcfile output string for class frequency text-format filename

bool hmm_parse_model_name_text const std::string &  modelname,
std::string &  lexfile,
std::string &  ngfile,
std::string &  lcfile
 

Utility for mootHMM::load_model() and friends: parse a text-model name according to the conventions described in mootfiles(5).

Parameters:
modelname name of the model
lexfile output string for lexical frequency text-format filename
ngfile output string for n-gram frequency text-format filename
lcfile output string for class frequency text-format filename

std::string moot_banner void   ) 
 

Return a banner string for the library

char* moot_extension const char *  filename  )  [inline]
 

Get extension of a filename (including leading '.')

char* moot_extension const char *  filename,
size_t  pos
[inline]
 

Get final extension of a filename (including leading '.'), reading backwards from (filename+pos). Returns a pointer into filename. If no next extension is found, returns NULL.

bool moot_file_exists const char *  filename  ) 
 

Check whether a file exists by trying to open it with 'fopen()'

std::string moot_normalize_ws const std::string &  s,
bool  trim_left = true,
bool  trim_right = true
[inline]
 

Create and return a whitespace-normalized STL string from a different STL string.

@param s source string @param trim_left whether to trim all leading whitespace @param trim_right whether to trim all trailing whitespace

std::string moot_normalize_ws const char *  s,
bool  trim_left = true,
bool  trim_right = true
[inline]
 

Create and return a whitespace-normalized STL string from a NUL-terminated C string.

@param s source string @param trim_left whether to trim all leading whitespace @param trim_right whether to trim all trailing whitespace

std::string moot_normalize_ws const char *  buf,
size_t  len,
bool  trim_left = true,
bool  trim_right = true
[inline]
 

Create and return a whitespace-normalized STL string from a C memory buffer.

@param buf source buffer @param len length of source buffer, in bytes @param trim_left whether to trim all leading whitespace @param trim_right whether to trim all trailing whitespace

void moot_normalize_ws const char *  s,
std::string &  out,
bool  trim_left = true,
bool  trim_right = true
[inline]
 

Append a whitespace-normalized NUL-terminated C string to an STL string.

@param s source string @param out destination STL string @param trim_left whether to trim all leading whitespace @param trim_right whether to trim all trailing whitespace

void moot_normalize_ws const std::string &  in,
std::string &  out,
bool  trim_left = true,
bool  trim_right = true
 

Append a whitespace-normalized C++ string to another C++ string. All whitespace substrings in are replaced with a single space in . is not cleared.

@param in source string @param out destination string @param trim_left whether to trim all leading whitespace @param trim_right whether to trim all trailing whitespace

void moot_normalize_ws const char *  buf,
size_t  len,
std::string &  out,
bool  trim_left = true,
bool  trim_right = true
 

Append a whitespace-normalized C buffer to an STL string. All whitespace substrings in s are replaced with a single space in out. out is not cleared.

@param buf source buffer @param len length of source buffer in bytes @param out destination STL string @param trim_left whether to trim all leading whitespace @param trim_right whether to trim all trailing whitespace

bool moot_parse_doubles char *  str,
double *  dbls,
size_t  ndbls
 

Parse a comma-separated list of doubles (at most 'ndbls') from str into dbls. You should already have allocated space for ndbls doubles in dbls.

std::string moot_program_banner const std::string &  prog_name,
const std::string &  prog_version,
const std::string &  prog_author,
bool  is_free = true
 

Return a full banner string for a program using the library.

void moot_remove_newlines std::string &  s  )  [inline]
 

Remove all newlines from an STL string.

void moot_remove_newlines char *  s  )  [inline]
 

Remove all newlines from a NUL-terminated C string.

void moot_remove_newlines char *  buf,
size_t  len
[inline]
 

Remove all newlines from a C buffer. Every newline is replaced with a single space.

@param s target string @param len length of target buffer in bytes

std::list<std::string> moot_strtok const std::string &  s,
const std::string &  delim
[inline]
 

Tokenize an STL string to a new list.

@param s source string @param delim string of delimiter characters

void moot_strtok const std::string &  s,
const std::string &  delim,
std::list< std::string > &  out
 

Tokenize an STL string to an existing list.

@param s source string @param delim string of delimiter characters @param out destination string list

std::string moot_unextend const char *  filename  ) 
 

Get path+basename of a file


Generated on Mon Jun 27 13:05:25 2005 for libmoot by  doxygen 1.3.8-20040913