#include <util.h>
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 Action * | get (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) |
Definition at line 31 of file util.h.
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] |
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] |
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] |
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] |
unsigned int Util::numDigits | ( | unsigned int | number | ) | [static] |
unsigned long Util::modMaskForString | ( | string | modKeys | ) | [static] |
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] |
unsigned int Util::buttonForString | ( | string | button | ) | [static] |
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().
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] |
bool Util::exists | ( | const char * | path | ) | [static] |
set< string > Util::stringSplit | ( | string | s, | |
string | delimiter | |||
) | [static] |
string Util::trimL | ( | string | s | ) | [static] |
removes leading blanks
Definition at line 393 of file util.cpp.
Referenced by Expander::queryString().
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().
static void Util::destroy | ( | L * | l, | |
LTI | start, | |||
LTI | end | |||
) | [inline, static] |
static bool Util::contains | ( | L * | l, | |
T * | item | |||
) | [inline, static] |
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().
void Util::remove | ( | MBindings * | bindings, | |
string | prefix | |||
) | [static] |
void Util::fitIntoDirection | ( | int | horigin, | |
int | hw, | |||
int * | corigin, | |||
int * | cw | |||
) | [static, private] |