Util Class Reference

#include <util.h>

List of all members.

Public Member Functions

 Util ()
 ~Util ()

Static Public Member Functions

static string nthToken (string str, char delim, unsigned int n)
static string lastToken (string str, char delim)
static string lowerCase (string str)
static string canonicalPath (string file)
static string canonicalDir (string path)
static bool containsWhitespaces (string str)
static string truncate (string str, char c)
static void swapChars (string *str, char from, char to, unsigned int *swapCount=0)
static string shortenString (string str, unsigned int n)
static string encodeEscapes (string str)
static unsigned int numDigits (unsigned int number)
static unsigned long modMaskForString (string modKeys)
static string stringForModMask (unsigned long modMask)
static string stringForButton (unsigned int button)
static unsigned int buttonForString (string button)
static char ** arguments (string command)
static string timestamp ()
static unsigned int strToUInt (string str)
static void fitInto (Rectangle *client, Rectangle *host)
static bool isPointWithinRect (unsigned int x, unsigned int y, Rectangle *rect, Rectangle *offset=0)
static Direction dirForString (string str)
static bool exists (const char *path)
static set< string > stringSplit (string s, string delimiter)
static string trimL (string s)
static Direction reverseDir (Direction dir)
template<class L, class LTI, class T>
static void destroy (L *l, LTI start, LTI end)
template<class L, class LTI, class T>
static bool contains (L *l, T *item)
static string get (MSettings *settings, string key)
static void remove (MSettings *settings, string prefix)
static Actionget (MBindings *bindings, string key)
static void remove (MBindings *bindings, string prefix)

Static Private Member Functions

static void fitIntoDirection (int horigin, int hw, int *corigin, int *cw)


Detailed Description

Contains various helper methods which are missing in STL library.

Definition at line 31 of file util.h.


Constructor & Destructor Documentation

Util::Util (  ) 

Definition at line 20 of file util.cpp.

Util::~Util (  ) 

Definition at line 23 of file util.cpp.


Member Function Documentation

string Util::nthToken ( string  str,
char  delim,
unsigned int  n 
) [static]

Returns n'th Token (substring) of str, delimeted by delim.

Definition at line 135 of file util.cpp.

Referenced by Kernel::initActionBindings().

string Util::lastToken ( string  str,
char  delim 
) [static]

Returns last token of str, delimeted by delim.

Definition at line 123 of file util.cpp.

Referenced by Shortcut::shortcut().

string Util::lowerCase ( string  str  )  [static]

Definition at line 26 of file util.cpp.

Referenced by dirForString().

string Util::canonicalPath ( string  file  )  [static]

Returns the canonical path of the given file string.

Definition at line 72 of file util.cpp.

References timestamp().

Referenced by canonicalDir().

Here is the call graph for this function:

string Util::canonicalDir ( string  path  )  [static]

Returns all dir components of the given path as new string.

Definition at line 60 of file util.cpp.

References canonicalPath().

Referenced by Loader::saveFile().

Here is the call graph for this function:

bool Util::containsWhitespaces ( string  str  )  [static]

Definition at line 36 of file util.cpp.

Referenced by Loader::saveSettings().

string Util::truncate ( string  str,
char  c 
) [static]

Returns truncated string without characters given by c or .

Definition at line 47 of file util.cpp.

Referenced by Shortcut::shortcut().

void Util::swapChars ( string *  str,
char  from,
char  to,
unsigned int *  swapCount = 0 
) [static]

Returns string with swapped characters (from -> to).

Definition at line 414 of file util.cpp.

string Util::shortenString ( string  str,
unsigned int  n 
) [static]

Shortens this string to n characters plus "..."

Definition at line 376 of file util.cpp.

Referenced by Label::update().

string Util::encodeEscapes ( string  str  )  [static]

Definition at line 97 of file util.cpp.

Referenced by Loader::saveSettings().

unsigned int Util::numDigits ( unsigned int  number  )  [static]

Definition at line 192 of file util.cpp.

unsigned long Util::modMaskForString ( string  modKeys  )  [static]

Definition at line 274 of file util.cpp.

Referenced by Shortcut::shortcut().

string Util::stringForModMask ( unsigned long  modMask  )  [static]

Definition at line 241 of file util.cpp.

Referenced by Binder::handleShortcutChains(), and Binder::prettyPrintKeyBindings().

string Util::stringForButton ( unsigned int  button  )  [static]

Definition at line 213 of file util.cpp.

Referenced by Binder::prettyPrintKeyBindings().

unsigned int Util::buttonForString ( string  button  )  [static]

Definition at line 220 of file util.cpp.

Referenced by Shortcut::shortcut().

char ** Util::arguments ( string  command  )  [static]

Converts string into char * argument array.

Definition at line 159 of file util.cpp.

Referenced by Launcher::exec().

string Util::timestamp (  )  [static]

Returns timestamp of current system time.

Definition at line 202 of file util.cpp.

Referenced by canonicalPath(), Logger::debug(), Logger::error(), Loader::load(), loadSettings(), main(), openDisplay(), Loader::saveFile(), and Logger::warning().

unsigned int Util::strToUInt ( string  str  )  [static]

Definition at line 306 of file util.cpp.

Referenced by Monitor::initGC(), Monitor::initWorkspaces(), Monitor::Monitor(), Frame::resize(), Kernel::start(), and StatusBar::updateMeters().

void Util::fitInto ( Rectangle client,
Rectangle host 
) [static]

Fits client rectangle into host rectangle.

Definition at line 334 of file util.cpp.

References fitIntoDirection(), Rectangle::height(), Rectangle::setHeight(), Rectangle::setWidth(), Rectangle::setX(), Rectangle::setY(), Rectangle::width(), Rectangle::x(), and Rectangle::y().

Referenced by Workspace::attachClient(), and Workspace::fitClient().

Here is the call graph for this function:

bool Util::isPointWithinRect ( unsigned int  x,
unsigned int  y,
Rectangle rect,
Rectangle offset = 0 
) [static]

Rectangle true if the coord is within the rectangle.

Definition at line 398 of file util.cpp.

References Rectangle::height(), Rectangle::width(), Rectangle::x(), and Rectangle::y().

Referenced by Workspace::frameForPoint().

Here is the call graph for this function:

Direction Util::dirForString ( string  str  )  [static]

Returns direction for the given string.

Definition at line 351 of file util.cpp.

References DOWN, LEFT, lowerCase(), RIGHT, and UP.

Here is the call graph for this function:

bool Util::exists ( const char *  path  )  [static]

Definition at line 371 of file util.cpp.

Referenced by Loader::saveFile().

set< string > Util::stringSplit ( string  s,
string  delimiter 
) [static]

Definition at line 382 of file util.cpp.

Referenced by Expander::rehash().

string Util::trimL ( string  s  )  [static]

removes leading blanks

Definition at line 393 of file util.cpp.

Referenced by Expander::queryString().

Direction Util::reverseDir ( Direction  dir  )  [static]

Definition at line 427 of file util.cpp.

References DOWN, LEFT, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH_EAST, SOUTH_WEST, and UP.

Referenced by Workspace::resizeClient(), and Workspace::resizeFrame().

template<class L, class LTI, class T>
static void Util::destroy ( L *  l,
LTI  start,
LTI  end 
) [inline, static]

Deletes all elements of a list L, between iterator start and end with type T.

Definition at line 109 of file util.h.

template<class L, class LTI, class T>
static bool Util::contains ( L *  l,
T *  item 
) [inline, static]

Returns true if the item is contained in this list.

Definition at line 122 of file util.h.

string Util::get ( MSettings settings,
string  key 
) [static]

Definition at line 457 of file util.cpp.

Referenced by Bar::Bar(), Kernel::bindShortcut(), Client::Client(), Actions::destroyAction(), Workspace::detachClient(), Launcher::execSeq(), Actions::executeTerm(), Workspace::focus(), Frame::Frame(), InputBar::handlePressedReturn(), Kernel::handlePropertyNotify(), Kernel::initActionBindings(), Menu::initActions(), Monitor::initBars(), Monitor::initFonts(), Thing::initFrameWindow(), Monitor::initGC(), Binder::initRegex(), Theme::initTheme(), Monitor::initWorkspaces(), Monitor::Monitor(), Monitor::rectForWorkspace(), Frame::resize(), Workspace::sendClient(), Kernel::start(), Thing::Thing(), Monitor::toggleClientBar(), Monitor::toggleStatusBar(), and Workspace::Workspace().

void Util::remove ( MSettings settings,
string  prefix 
) [static]

Definition at line 462 of file util.cpp.

Referenced by Kernel::bindShortcut(), Actions::destroyAction(), Monitor::destroyWorkspace(), and Client::setHooked().

Action * Util::get ( MBindings bindings,
string  key 
) [static]

Definition at line 477 of file util.cpp.

void Util::remove ( MBindings bindings,
string  prefix 
) [static]

Definition at line 482 of file util.cpp.

void Util::fitIntoDirection ( int  horigin,
int  hw,
int *  corigin,
int *  cw 
) [static, private]

Fits 1-dimensional c-coordinates directional into h-coordinates.

Definition at line 311 of file util.cpp.

Referenced by fitInto().


The documentation for this class was generated from the following files:
Generated on Thu May 24 15:20:27 2007 for ncwm by  doxygen 1.5.1