libutil.h File Reference

#include "defines.h"
#include "enum.h"
#include <cctype>
#include <string>
#include <vector>
#include <map>

Include dependency graph for libutil.h:

Go to the source code of this file.

Classes

class  mouse_control

Defines

#define CASE_ESCAPE   case ESCAPE: case CONTROL('G'): case -1:
#define TAG_UNFOUND   -20404

Functions

std::string apply_description (description_level_type desc, const std::string &name, int quantity=1, bool num_in_words=false)
description_level_type description_type_by_name (const char *desc)
std::stringescape_path_spaces (std::string &s)
std::string lowercase_string (std::string s)
std::stringlowercase (std::string &s)
std::stringuppercase (std::string &s)
std::string upcase_first (std::string)
void wait_for_keypress ()
bool key_is_escape (int key)
bool ends_with (const std::string &s, const std::string &suffix)
size_t strlcpy (char *dst, const char *src, size_t n)
int strwidth (const char *s)
int strwidth (const std::string &s)
bool strip_tag (std::string &s, const std::string &tag, bool nopad=false)
bool strip_suffix (std::string &s, const std::string &suffix)
int strip_number_tag (std::string &s, const std::string &tagprefix)
bool strip_bool_tag (std::string &s, const std::string &name, bool defval=false)
std::string strip_tag_prefix (std::string &s, const std::string &tagprefix)
std::string article_a (const std::string &name, bool lowercase=true)
std::string pluralise (const std::string &name, const char *stock_plural_quals[]=standard_plural_qualifiers, const char *no_of[]=NULL)
std::string apostrophise (const std::string &name)
std::string apostrophise_fixup (const std::string &msg)
std::string number_in_words (unsigned number, int pow=0)
std::string number_to_string (unsigned number, bool in_words=false)
bool shell_safe (const char *file)
int ends_with (const std::string &s, const char *suffixes[])
std::string strip_filename_unsafe_chars (const std::string &s)
std::string vmake_stringf (const char *format, va_list args)
std::string make_stringf (const char *format,...)
std::string replace_all (std::string s, const std::string &tofind, const std::string &replacement)
std::string replace_all_of (std::string s, const std::string &tofind, const std::string &replacement)
int count_occurrences (const std::string &text, const std::string &searchfor)
void play_sound (const char *file)
std::stringtrim_string (std::string &str)
std::stringtrim_string_right (std::string &str)
std::string trimmed_string (std::string s)
bool starts_with (const std::string &s, const std::string &prefix)
std::vector< std::stringsplit_string (const std::string &sep, std::string s, bool trim=true, bool accept_empties=false, int nsplits=-1)
std::string lowercase_first (std::string s)
std::string uppercase_first (std::string s)
template<typename Z>
std::string comma_separated_line (Z start, Z end, const std::string &andc=" and ", const std::string &comma=", ")
coord_def cgettopleft (GotoRegion region=GOTO_CRT)
coord_def cgetpos (GotoRegion region=GOTO_CRT)
void cgotoxy (int x, int y, GotoRegion region=GOTO_CRT)
GotoRegion get_cursor_region ()
coord_def cgetsize (GotoRegion region=GOTO_CRT)
void cscroll (int n, GotoRegion region)

Variables

const char * standard_plural_qualifiers []


Define Documentation

#define CASE_ESCAPE   case ESCAPE: case CONTROL('G'): case -1:

#define TAG_UNFOUND   -20404


Function Documentation

std::string apostrophise ( const std::string name  ) 

std::string apostrophise_fixup ( const std::string msg  ) 

Here is the call graph for this function:

std::string apply_description ( description_level_type  desc,
const std::string name,
int  quantity = 1,
bool  num_in_words = false 
)

Here is the call graph for this function:

std::string article_a ( const std::string name,
bool  lowercase = true 
)

Here is the call graph for this function:

coord_def cgetpos ( GotoRegion  region = GOTO_CRT  ) 

Here is the call graph for this function:

coord_def cgetsize ( GotoRegion  region = GOTO_CRT  ) 

coord_def cgettopleft ( GotoRegion  region = GOTO_CRT  ) 

void cgotoxy ( int  x,
int  y,
GotoRegion  region = GOTO_CRT 
)

Here is the call graph for this function:

template<typename Z>
std::string comma_separated_line ( start,
end,
const std::string andc = " and ",
const std::string comma = ", " 
) [inline]

int count_occurrences ( const std::string text,
const std::string searchfor 
)

Here is the call graph for this function:

void cscroll ( int  n,
GotoRegion  region 
)

Here is the call graph for this function:

description_level_type description_type_by_name ( const char *  desc  ) 

int ends_with ( const std::string s,
const char *  suffixes[] 
)

Returns 1 + the index of the first suffix that matches the given string, 0 if no suffixes match.

Here is the call graph for this function:

bool ends_with ( const std::string s,
const std::string suffix 
) [inline]

std::string& escape_path_spaces ( std::string s  ) 

GotoRegion get_cursor_region (  ) 

bool key_is_escape ( int  key  ) 

std::string& lowercase ( std::string s  ) 

std::string lowercase_first ( std::string  s  )  [inline]

std::string lowercase_string ( std::string  s  ) 

Here is the call graph for this function:

std::string make_stringf ( const char *  format,
  ... 
)

Here is the call graph for this function:

std::string number_in_words ( unsigned  number,
int  pow = 0 
)

Here is the call graph for this function:

std::string number_to_string ( unsigned  number,
bool  in_words = false 
)

Here is the call graph for this function:

void play_sound ( const char *  file  ) 

Here is the call graph for this function:

std::string pluralise ( const std::string name,
const char *  stock_plural_quals[] = standard_plural_qualifiers,
const char *  no_of[] = NULL 
)

Here is the call graph for this function:

std::string replace_all ( std::string  s,
const std::string tofind,
const std::string replacement 
)

std::string replace_all_of ( std::string  s,
const std::string tofind,
const std::string replacement 
)

bool shell_safe ( const char *  file  ) 

std::vector<std::string> split_string ( const std::string sep,
std::string  s,
bool  trim = true,
bool  accept_empties = false,
int  nsplits = -1 
)

Here is the call graph for this function:

bool starts_with ( const std::string s,
const std::string prefix 
) [inline]

bool strip_bool_tag ( std::string s,
const std::string name,
bool  defval = false 
)

Here is the call graph for this function:

std::string strip_filename_unsafe_chars ( const std::string s  ) 

Here is the call graph for this function:

int strip_number_tag ( std::string s,
const std::string tagprefix 
)

Here is the call graph for this function:

bool strip_suffix ( std::string s,
const std::string suffix 
)

Here is the call graph for this function:

bool strip_tag ( std::string s,
const std::string tag,
bool  nopad = false 
)

Here is the call graph for this function:

std::string strip_tag_prefix ( std::string s,
const std::string tagprefix 
)

Here is the call graph for this function:

size_t strlcpy ( char *  dst,
const char *  src,
size_t  n 
)

int strwidth ( const std::string s  ) 

int strwidth ( const char *  s  ) 

std::string& trim_string ( std::string str  ) 

std::string& trim_string_right ( std::string str  ) 

std::string trimmed_string ( std::string  s  ) 

Here is the call graph for this function:

std::string upcase_first ( std::string   ) 

std::string& uppercase ( std::string s  ) 

std::string uppercase_first ( std::string  s  )  [inline]

std::string vmake_stringf ( const char *  format,
va_list  args 
)

void wait_for_keypress (  ) 

Here is the call graph for this function:


Variable Documentation


Generated on Thu Jan 13 13:08:43 2011 by  doxygen 1.5.6