edelib Namespace Reference


Classes

class  Config
 A config file reader. More...
class  TimeZone
 A class for getting time from desired time zone. More...
class  Date
 A class for date manipulation. More...
class  Time
 A class for time manipulation. More...
class  DesktopFile
 .desktop file reader and writer More...
class  DirWatch
 Directory changes notifier. More...
class  EdbusCallbackItem
 An item for callback table. More...
class  EdbusConnection
 D-Bus connection and data sender. More...
class  EdbusContainer
 Abstract container for D-Bus containers. More...
class  EdbusData
 Class for representing D-Bus data types. More...
class  EdbusVariant
 Represents D-Bus variant. More...
class  EdbusDictEntry
 An entry in EdbusDict. More...
class  EdbusDict
 Dictionary container for D-Bus types. More...
class  EdbusError
 A class representing D-Bus error. More...
class  EdbusList
 A class representing D-Bus struct and array. More...
class  EdbusMessage
 Data transporter for D-Bus. More...
class  EdbusObjectPath
 Represents D-Bus object path. More...
class  ExpandableGroup
 A group with applied layout on childs. More...
class  File
 A system file io stream. More...
class  IconLoader
 Loads icons with IconTheme. More...
class  IconTheme
 Finds named icon according to the given theme. More...
class  list
 Linked list class. More...
class  MenuBar
 Menu bar. More...
class  MenuBase
 Menu base class. More...
class  MenuButton
 Button with attached menu. More...
class  MenuItem
 The item in menu list. More...
class  MessageBox
 Standard dialog. More...
class  MimeType
 Mime handling class. More...
class  PTY
 emulate pty api More...
class  PtyProcess
 Synchronous communication with tty programs. More...
class  RegexMatch
 RegexMatch class. More...
class  Regex
 Regex class. More...
class  Resource
 Resource loader and saver. More...
class  SevenSeg
 Digital number widget. More...
class  SipcServer
 Simple IPC server. More...
class  SipcClient
 Simple IPC client. More...
class  String
 A (relatively simple) string implementation. More...
class  TableBase
 A base class for table widgets. More...
class  TempFile
 Temporary file class. More...
class  Theme
 Theming for FLTK and edelib widgets. More...
class  Window
 Window class. More...
class  XSettingsClient
 Client part of XSETTINGS protocol. More...
class  XSettingsColor
 Color data for XSETTINGS. More...
class  XSettingsSetting
 Structure for tracking XSETTINGS values. More...
class  XSettingsList
 List internaly used by XSETTINGS classes. More...
class  XSettingsData
 Main data shared between client and manager. More...
class  XSettingsManager
 Manager part of XSETTINGS protocol. More...

Typedefs

typedef int(* EdbusCallback )(const EdbusMessage *, void *)
typedef void(* SipcCallback )(const char *, void *)

Enumerations

enum  ConfigErrors {
  CONF_SUCCESS = 0, CONF_ERR_FILE, CONF_ERR_BAD, CONF_ERR_SECTION,
  CONF_ERR_KEY, CONF_ERR_MEMORY, CONF_ERR_NOVALUE
}
 Error codes from Config class. More...
enum  DateType { DATE_LOCAL = 0, DATE_UTC }
 Types of date settable via Date::set(). More...
enum  ErrorMessageType { ERROR_MESSAGE_DEBUG, ERROR_MESSAGE_WARNING, ERROR_MESSAGE_FATAL }
 Type of messages received in error message handler. More...
enum  DesktopFileErrors { DESK_FILE_SUCCESS = 0, DESK_FILE_EMPTY, DESK_FILE_ERR_FILE, DESK_FILE_ERR_BAD }
 Error codes from DesktopFile class. More...
enum  DesktopFileType { DESK_FILE_TYPE_UNKNOWN = 0, DESK_FILE_TYPE_APPLICATION, DESK_FILE_TYPE_LINK, DESK_FILE_TYPE_DIRECTORY }
 Reported file type from DesktopFile::type(). More...
enum  DirWatchFlags {
  DW_CREATE = (1 << 1), DW_MODIFY = (1 << 2), DW_ACCESS = (1 << 3), DW_RENAME = (1 << 4),
  DW_ATTRIB = (1 << 5), DW_DELETE = (1 << 6)
}
 Flags telling to DirWatch what changes to monitor. More...
enum  DirWatchNotifier { DW_NONE = 0, DW_INOTIFY, DW_FAM }
 Notifier type used by DirWatch. More...
enum  DirWatchReportFlags {
  DW_REPORT_NONE = -1, DW_REPORT_CREATE = 0, DW_REPORT_MODIFY, DW_REPORT_RENAME,
  DW_REPORT_DELETE
}
 Returned codes for received event. More...
enum  EdbusConnectionType { EDBUS_SYSTEM, EDBUS_SESSION }
 Represents connection either to system or session bus. More...
enum  EdbusNameMode { EDBUS_NAME_NO_REPLACE = 0, EDBUS_NAME_ALLOW_REPLACE = 1, EDBUS_NAME_REPLACE_EXISTING = 2 }
 What to do when known name is acquired. More...
enum  EdbusDataType {
  EDBUS_TYPE_INVALID, EDBUS_TYPE_BYTE, EDBUS_TYPE_BOOL, EDBUS_TYPE_INT16,
  EDBUS_TYPE_UINT16, EDBUS_TYPE_INT32, EDBUS_TYPE_UINT32, EDBUS_TYPE_INT64,
  EDBUS_TYPE_UINT64, EDBUS_TYPE_DOUBLE, EDBUS_TYPE_STRING, EDBUS_TYPE_OBJECT_PATH,
  EDBUS_TYPE_ARRAY, EDBUS_TYPE_STRUCT, EDBUS_TYPE_DICT, EDBUS_TYPE_VARIANT
}
 Type of data current EdbusData object holds. More...
enum  EdbusErrorType {
  EDBUS_ERROR_INVALID, EDBUS_ERROR_FAILED, EDBUS_ERROR_NO_MEMORY, EDBUS_ERROR_SERVICE_UNKNOWN,
  EDBUS_ERROR_NAME_HAS_NO_OWNER, EDBUS_ERROR_NO_REPLY, EDBUS_ERROR_IO_ERROR, EDBUS_ERROR_BAD_ADDRESS,
  EDBUS_ERROR_NOT_SUPPORTED, EDBUS_ERROR_LIMITS_EXCEEDED, EDBUS_ERROR_ACCESS_DENIED, EDBUS_ERROR_AUTH_FAILED,
  EDBUS_ERROR_NO_SERVER, EDBUS_ERROR_TIMEOUT, EDBUS_ERROR_NO_NETWORK, EDBUS_ERROR_DISCONNECTED,
  EDBUS_ERROR_INVALID_ARGS, EDBUS_ERROR_FILE_NOT_FOUND, EDBUS_ERROR_FILE_EXISTS, EDBUS_ERROR_UNKNOWN_METHOD,
  EDBUS_ERROR_TIMED_OUT, EDBUS_ERROR_INVALID_SIGNATURE, EDBUS_ERROR_USER_DEFINED
}
 EdbusError error type. More...
enum  FileErrors {
  FILE_SUCCESS = 0, FILE_EACCESS, FILE_ENOENT, FILE_EMFILE,
  FILE_ENSPC, FILE_FLAG
}
 Error codes returned by File class. More...
enum  FileIOMode {
  FIO_READ = (1<<1), FIO_WRITE = (1<<2), FIO_APPEND = (1<<3), FIO_BINARY = (1<<4),
  FIO_TRUNC = (1<<5)
}
 Open and write flags for File class. More...
enum  FileTestFlags {
  FILE_TEST_IS_REGULAR = 1 << 0, FILE_TEST_IS_DIR = 1 << 1, FILE_TEST_IS_SYMLINK = 1 << 2, FILE_TEST_IS_CHAR = 1 << 3,
  FILE_TEST_IS_BLOCK = 1 << 4, FILE_TEST_IS_FIFO = 1 << 5, FILE_TEST_IS_SOCKET = 1 << 6, FILE_TEST_IS_READABLE = 1 << 7,
  FILE_TEST_IS_WRITEABLE = 1 << 8, FILE_TEST_IS_EXECUTABLE = 1 << 9, FILE_TEST_EXISTS = 1 << 10
}
 Available flags for file_test(). More...
enum  IconLoaderOptions { ICON_LOADER_OPTION_NO_ABSOLUTE_PATH = (1 << 1), ICON_LOADER_OPTION_NO_WIDGET_REDRAW = (1 << 2), ICON_LOADER_OPTION_NO_ICON_SCALE = (1 << 3) }
 Settable options for IconLoader functions. More...
enum  IconSizes {
  ICON_SIZE_TINY = 16, ICON_SIZE_SMALL = 22, ICON_SIZE_MEDIUM = 32, ICON_SIZE_LARGE = 48,
  ICON_SIZE_HUGE = 64, ICON_SIZE_ENORMOUS = 128
}
 Icon sizes to look for. More...
enum  IconContext {
  ICON_CONTEXT_ANY = 0, ICON_CONTEXT_ACTION, ICON_CONTEXT_APPLICATION, ICON_CONTEXT_DEVICE,
  ICON_CONTEXT_FILESYSTEM, ICON_CONTEXT_MIMETYPE, ICON_CONTEXT_STOCK, ICON_CONTEXT_EMBLEM,
  ICON_CONTEXT_MISC
}
 Icon types to look for. More...
enum  { LISTENER_READ = 1, LISTENER_WRITE = 4, LISTENER_EXCEPT = 8 }
enum  MessageBoxType { MSGBOX_PLAIN = 0, MSGBOX_INPUT, MSGBOX_INPUT_SECRET }
 Type of MessageBox dialog. More...
enum  MessageBoxButtonType { MSGBOX_BUTTON_PLAIN = 0, MSGBOX_BUTTON_RETURN }
 Type of added button to MessageBox class. More...
enum  MessageBoxIconType {
  MSGBOX_ICON_TYPE_INFO = 0, MSGBOX_ICON_TYPE_ALERT, MSGBOX_ICON_TYPE_QUESTION, MSGBOX_ICON_TYPE_INPUT,
  MSGBOX_ICON_TYPE_PASSWORD
}
 Type of the icon in message box. More...
enum  RegexMode {
  RX_EXTENDED = (1 << 1), RX_CASELESS = (1 << 2), RX_DOLLAR_ENDONLY = (1 << 3), RX_DOTALL = (1 << 4),
  RX_MULTILINE = (1 << 5), RX_UNGREEDY = (1 << 6)
}
 Flags used for compile(). More...
enum  RegexMatchMode { RX_MATCH_ANCHORED = (1 << 1), RX_MATCH_NOTBOL = (1 << 2), RX_MATCH_NOTEOL = (1 << 3), RX_MATCH_NOTEMPTY = (1 << 4) }
 Flags used for match(). More...
enum  ResourceType { RES_SYS_FIRST, RES_USER_FIRST, RES_SYS_ONLY, RES_USER_ONLY }
 Flags showing what resource to load first or to load it only. More...
enum  {
  RUN_NOT_FOUND = 65535, RUN_EMPTY = 65534, RUN_NOT_EXEC = 65533, RUN_FORK_FAILED = 65532,
  RUN_WAITPID_FAILED = 65531, RUN_EXECVE_FAILED = 65530, RUN_PIPE_FAILED = 65529, RUN_NO_ACCESS = 65528
}
enum  WindowComponents { WIN_INIT_NONE = (1 << 1), WIN_INIT_ICON_THEME = (1 << 2), WIN_INIT_IMAGES = (1 << 3), WIN_INIT_ALL = (WIN_INIT_ICON_THEME | WIN_INIT_IMAGES) }
 Components used to be loaded with the window. More...
enum  XSettingsAction { XSETTINGS_ACTION_NEW = 0, XSETTINGS_ACTION_CHANGED, XSETTINGS_ACTION_DELETED }
 Flags telling what was done with setting. More...
enum  XSettingsType { XSETTINGS_TYPE_INT = 0, XSETTINGS_TYPE_STRING, XSETTINGS_TYPE_COLOR }
 Types used for XSETTINGS. More...

Functions

unsigned int color_rgb_to_fltk (unsigned char r, unsigned char g, unsigned char b)
void color_fltk_to_rgb (unsigned int color, unsigned char &r, unsigned char &g, unsigned char &b)
unsigned int color_html_to_fltk (const char *col)
void color_fltk_to_html (unsigned int color, char *buf)
void color_rgb_to_html (unsigned char r, unsigned char g, unsigned char b, char *buf)
void color_html_to_rgb (const char *buf, unsigned char &r, unsigned char &g, unsigned char &b)
void error_mesage_handler_install (void(*)(ErrorMessageType t, const char *msg))
bool dir_exists (const char *name)
bool dir_readable (const char *name)
bool dir_writeable (const char *name)
bool dir_create (const char *name, int perm=0777)
bool dir_create_with_parents (const char *name, int perm=0777)
bool dir_remove (const char *name)
bool dir_rename (const char *from, const char *to)
bool dir_empty (const char *name)
String dir_home (void)
String dir_current (void)
bool dir_list (const char *dir, list< String > &lst, bool full_path=false, bool show_hidden=false, bool show_dots=false)
EdbusListoperator<< (EdbusList &lst, const EdbusData &val)
EdbusMessageoperator<< (EdbusMessage &m, const EdbusData &val)
EdbusObjectPathoperator<< (EdbusObjectPath &p, const char *el)
bool file_test (const char *path, unsigned int flags)
int font_chooser (const char *name, const char *family, int &retsize, const char *default_name=0, int default_size=0)
String icon_chooser (const char *dir)
String icon_chooser (IconSizes sz, IconContext ctx=ICON_CONTEXT_ANY)
void listener_add_fd (int fd, int when, void(*cb)(int, void *), void *arg=0)
void listener_add_fd (int fd, void(*cb)(int, void *), void *arg=0)
void listener_remove_fd (int fd, int when)
void listener_remove_fd (int fd)
double listener_wait (double t)
int listener_wait (void)
void clear_dialog_icons (void)
char * nls_locale_to_c (void)
void nls_locale_from_c (char *old)
void nls_support_init (const char *appname, const char *dir)
int run_program (const char *cmd, bool wait=true)
int run_program_fmt (bool wait, const char *fmt,...)
int run_sync (const char *fmt,...)
int run_async (const char *fmt,...)
char * str_trimleft (char *str)
char * str_trimright (char *str)
char * str_trim (char *str)
unsigned char * str_tolower (unsigned char *str)
unsigned char * str_toupper (unsigned char *str)
bool str_ends (const char *str, const char *test)
template<typename Container >
void stringtok (Container &c, const String &str, const char *ws=" \t\n")
String user_config_dir (void)
String user_data_dir (void)
String user_cache_dir (void)
int system_config_dirs (list< String > &lst)
int system_data_dirs (list< String > &lst)
String build_filename (const char *p1, const char *p2=((void *) 0), const char *p3=((void *) 0))
void window_xid_create (Fl_Window *win, void(*before_map_func)(Fl_Window *)=((void *) 0), int background_pixel=-1)
bool xsettings_list_add (XSettingsList **list, XSettingsSetting *setting)
bool xsettings_list_remove (XSettingsList **list, const char *name)
XSettingsSettingxsettings_list_find (XSettingsList *list, const char *name)
void xsettings_list_free (XSettingsList *list)
XSettingsSettingxsettings_setting_copy (XSettingsSetting *setting)
void xsettings_setting_free (XSettingsSetting *setting)
bool xsettings_setting_equal (XSettingsSetting *s1, XSettingsSetting *s2)
int xsettings_setting_len (const XSettingsSetting *setting)
char xsettings_byte_order (void)
XSettingsListxsettings_decode (unsigned char *data, int len, unsigned long *serial)
void xsettings_encode (const XSettingsSetting *setting, XSettingsBuffer *buffer)

Detailed Description

This is a main namespace where all edelib components laid. Also namespace usage can be optional, and disabled during compilation phase.


Typedef Documentation

typedef void(* SipcCallback)(const char *, void *)

A callback type for SipcServer message callbacks


Enumeration Type Documentation

anonymous enum

Enumerator:
LISTENER_READ  callback is called when there is data to be read
LISTENER_WRITE  callback is called when there is data to be written without blocking
LISTENER_EXCEPT  callback is called when exception happens on descriptor

anonymous enum

Enumerator:
RUN_NOT_FOUND  executable not found
RUN_EMPTY  given parameter is NULL
RUN_NOT_EXEC  given parameter is not executable on system
RUN_FORK_FAILED  internal fork failed
RUN_WAITPID_FAILED  internal waitpid failed
RUN_EXECVE_FAILED  internal execve failed
RUN_PIPE_FAILED  internal pipe failed
RUN_NO_ACCESS  not enough permissions to execute it

Error codes from Config class.

Enumerator:
CONF_SUCCESS  successful operation
CONF_ERR_FILE  trouble accessing config file or directory
CONF_ERR_BAD  malformed file
CONF_ERR_SECTION  requested section was not found
CONF_ERR_KEY  requested key was not found
CONF_ERR_MEMORY  memory allocation error
CONF_ERR_NOVALUE  key found, but invalid value associated with it

enum DateType

Types of date settable via Date::set().

Enumerator:
DATE_LOCAL  use local date
DATE_UTC  use UTC date

Error codes from DesktopFile class.

Enumerator:
DESK_FILE_SUCCESS  successful operation
DESK_FILE_EMPTY  file not loaded
DESK_FILE_ERR_FILE  trouble accessing config file or directory
DESK_FILE_ERR_BAD  malformed file, or not .desktop file

Reported file type from DesktopFile::type().

Enumerator:
DESK_FILE_TYPE_UNKNOWN  Unknown type (Type key).
DESK_FILE_TYPE_APPLICATION  Application type.
DESK_FILE_TYPE_LINK  Link type.
DESK_FILE_TYPE_DIRECTORY  Directory type.

Flags telling to DirWatch what changes to monitor.

Enumerator:
DW_CREATE  In directory item created.
DW_MODIFY  In directory item modified.
DW_ACCESS  In directory item is accessed (read, ...).
DW_RENAME  In directory item renamed.
DW_ATTRIB  In directory item's attributes changed.
DW_DELETE  In directory item is deleted.

Notifier type used by DirWatch.

Enumerator:
DW_NONE  None notifier; watching disabled.
DW_INOTIFY  inotify (linux kernel >= 2.6.13)
DW_FAM  FAM/gamin.

Returned codes for received event.

Enumerator:
DW_REPORT_NONE  Not figured out what happened.
DW_REPORT_CREATE  A new item was created.
DW_REPORT_MODIFY  Existing item was modified.
DW_REPORT_RENAME  Existing item was renamed.
DW_REPORT_DELETE  Existing item was deleted.

Type of messages received in error message handler.

Enumerator:
ERROR_MESSAGE_DEBUG  Debug message.
ERROR_MESSAGE_WARNING  Warning message.
ERROR_MESSAGE_FATAL  Fatal message.

enum FileErrors

Error codes returned by File class.

Enumerator:
FILE_SUCCESS  successful operation
FILE_EACCESS  permission denied
FILE_ENOENT  no such file
FILE_EMFILE  too many opened files
FILE_ENSPC  no space left on device
FILE_FLAG  bad flag

enum FileIOMode

Open and write flags for File class.

Enumerator:
FIO_READ  open file in read-only mode
FIO_WRITE  open file in write mode, and truncate it to zero length
FIO_APPEND  open file in append mode
FIO_BINARY  open file in binary mode
FIO_TRUNC  truncate currently opened file

Available flags for file_test().

Enumerator:
FILE_TEST_IS_REGULAR  file
FILE_TEST_IS_DIR  directory
FILE_TEST_IS_SYMLINK  symbolic link
FILE_TEST_IS_CHAR  character device
FILE_TEST_IS_BLOCK  block device
FILE_TEST_IS_FIFO  FIFO (pipes).
FILE_TEST_IS_SOCKET  socket
FILE_TEST_IS_READABLE  readable
FILE_TEST_IS_WRITEABLE  writeable
FILE_TEST_IS_EXECUTABLE  executable
FILE_TEST_EXISTS  exists, no matter what type

Icon types to look for.

Enumerator:
ICON_CONTEXT_ANY  Can be any icon context.
ICON_CONTEXT_ACTION  Icons representing actions.
ICON_CONTEXT_APPLICATION  Icons representing applications.
ICON_CONTEXT_DEVICE  Icons representing devices.
ICON_CONTEXT_FILESYSTEM  Icons representing objects that are part of system.
ICON_CONTEXT_MIMETYPE  Icons representing MIME types.
ICON_CONTEXT_STOCK  Icons representing stock objects (gnome themes usually).
ICON_CONTEXT_EMBLEM  Icons representing emblem objects (gnome themes usually).
ICON_CONTEXT_MISC  Misc icons (gnome themes usually).

Settable options for IconLoader functions.

Todo:
Explain these better in IconLoader class, with some examples
Enumerator:
ICON_LOADER_OPTION_NO_ABSOLUTE_PATH  do not see given the path as absolute icon path
ICON_LOADER_OPTION_NO_WIDGET_REDRAW  do not redraw widget
ICON_LOADER_OPTION_NO_ICON_SCALE  do not scale icon

enum IconSizes

Icon sizes to look for.

Enumerator:
ICON_SIZE_TINY  16x16 icons
ICON_SIZE_SMALL  22x22 icons
ICON_SIZE_MEDIUM  32x32
ICON_SIZE_LARGE  48x48
ICON_SIZE_HUGE  64x64
ICON_SIZE_ENORMOUS  128x128

Flags used for match().

Enumerator:
RX_MATCH_ANCHORED  Match only at the first position.
RX_MATCH_NOTBOL  Subject is not the beginning of a line.
RX_MATCH_NOTEOL  Subject is not the end of a line.
RX_MATCH_NOTEMPTY  An empty string is not a valid match.

enum RegexMode

Flags used for compile().

Enumerator:
RX_EXTENDED  extended features
RX_CASELESS  ignore cases
RX_DOLLAR_ENDONLY  $ not to match newline at end
RX_DOTALL  . matches anything including newline
RX_MULTILINE  ^ and $ match newlines within data
RX_UNGREEDY  invert greediness of quantifiers

Flags showing what resource to load first or to load it only.

Enumerator:
RES_SYS_FIRST  Load system resource first.
RES_USER_FIRST  Load user resource first.
RES_SYS_ONLY  Load system resource ignoring user one.
RES_USER_ONLY  Load user resource ignoring system one.

Flags telling what was done with setting.

Enumerator:
XSETTINGS_ACTION_NEW  New setting added.
XSETTINGS_ACTION_CHANGED  One of the settings changed.
XSETTINGS_ACTION_DELETED  One of the settings deleted.

Types used for XSETTINGS.

Enumerator:
XSETTINGS_TYPE_INT  int type
XSETTINGS_TYPE_STRING  string (char*) type
XSETTINGS_TYPE_COLOR  RGBA type.


Function Documentation

String edelib::build_filename ( const char *  p1,
const char *  p2 = ((void *) 0),
const char *  p3 = ((void *) 0) 
)

This function will construct a path, separating each item with E_DIR_SEPARATOR separator. Each parameter will be separated with the one separator, except the case when one of the parameters contains multiple path elements separated with multiple separators.

Also, the number of leading separators in the first parameter and the number of trailing separators in the last parameter will be preserved.

For example:

   build_filename("home", "foo", "baz") == "home/foo/baz";
   build_filename("myplace/dir", "myfile") == "myplace/dir/myfile";

   // keep heading separators
   build_filename("/home", "foo", "baz") == "/home/foo/baz";
   build_filename("///home", "foo", "baz") == "///home/foo/baz";

   // keep trailing separators
   build_filename("/home/foo", "foofile", "baz/") == "/home/foo/foofile/baz/";
   build_filename("/home/foo", "foofile", "baz///") == "/home/foo/foofile/baz///";

   // first parameter have multiple elements, it will be preserved as is
   build_filename("/home///foo", "//foofile///", "/baz") == "/home///foo/foofile/baz";

   // correct trailing data, since does not match to separator
   build_filename("///home////foo", "//foofile///", "/baz//") == "/home/foo/foofile/baz";

   // if given only one parameter, heading and trailing number of separator will be preserved
   build_filename("///home///") == "///home///";

Returns:
constructed filename path
Parameters:
p1 first parameter
p2 optional second; if is NULL (default), it is ignored
p3 optional third; if is NULL (default), it is ignored

void edelib::color_fltk_to_html ( unsigned int  color,
char *  buf 
)

Convert FLTK color to html representation. Given buffer is assumed to be a prior allocated and must be at least 8 character wide. Final result will be in form #rrggbb and string will be null terminated.

Note:
For this function the same applies as for color_fltk_to_rgb()
Parameters:
color is FLTK color
buf is buffer where to place html color

void edelib::color_fltk_to_rgb ( unsigned int  color,
unsigned char &  r,
unsigned char &  g,
unsigned char &  b 
)

Decompose FLTK color to rgb components.

Note:
This function will decompose corectly values grater than 255 or FLTK colors (FL_WHIRE, FL_RED,...). When FLTK color is given, it will use colormap, the same one used by fltk.
Parameters:
color is FLTK color
r is extracted red component
g is extracted green component
b is extracted blue component

unsigned int edelib::color_html_to_fltk ( const char *  col  ) 

Tries to convert html-like color names to FLTK color space. This function does not support named colors, like #black, but only their hex values, like #abc. It will fail (return 0) if one of components is missing (eg. given #a or #ab).

Returns:
color value coresponding to FLTK color space or return 0 (black)
Parameters:
col is named color, if is NULL, it will return 0 (black)

void edelib::color_html_to_rgb ( const char *  buf,
unsigned char &  r,
unsigned char &  g,
unsigned char &  b 
)

Decompose html representation to rgb compontents. Because this function uses color_fltk_to_rgb(), the same properties applies here.

Parameters:
buf is buffer where to place html color (8 character wide)
r is extracted red component
g is extracted green component
b is extracted blue component

unsigned int edelib::color_rgb_to_fltk ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Convert separated rgb color components to FLTK color space.

Returns:
color value that can be used for widget color
Parameters:
r is red component
g is green component
b is blue component

void edelib::color_rgb_to_html ( unsigned char  r,
unsigned char  g,
unsigned char  b,
char *  buf 
)

Convert RGB color to html representation. Given buffer is assumed to be a prior allocated and must be at least 8 character wide. Final result will be in form #rrggbb and string will be null terminated.

Parameters:
r is red component
g is green component
b is blue component
buf is buffer where to place html color

bool edelib::dir_create ( const char *  name,
int  perm = 0777 
)

Creates directory calling system's mkdir() with apropriate permission (default is 0777).

This function will fail if given path exists (directory, file, link, etc.) Return true if succeded or false if failed.

bool edelib::dir_create_with_parents ( const char *  name,
int  perm = 0777 
)

Creates directory if does not exists and create intermedaite parents if needed too.

Return true if succeded or false if failed.

String edelib::dir_current ( void   ) 

Returns current directory or empty String if fails

bool edelib::dir_empty ( const char *  name  ) 

Return true if given directory is empty. If path is pointing to anything else than directory, it will return false. Use dir_exists() to check is path really a directory.

This function is alternative to this code:

   list<String> dlist;
   dir_list(path, dlist);
   dlist.empty() == true;

but is much faster.

bool edelib::dir_exists ( const char *  name  ) 

Check if directory exists

Deprecated:
with file_test()

String edelib::dir_home ( void   ) 

Returns user home directory or empty String if fails

bool edelib::dir_list ( const char *  dir,
list< String > &  lst,
bool  full_path = false,
bool  show_hidden = false,
bool  show_dots = false 
)

List content of given directory. If directory is accessible, given parameter will be filled with the content.

dir_list() can accept "." which will resolve to the current directory, but will not accept ".." (directory up), nor will resolve chainings on it (like "../../../").

list content will be cleared before items are added.

Returns:
true if target directory reading went fine; otherwise false
Parameters:
dir target directory
lst is a content of directory
full_path if set will append directory name to the each entry
show_hidden if set will show hidden files
show_dots if set will show . and .. directories

bool edelib::dir_readable ( const char *  name  ) 

Check if directory is readable

Deprecated:
with file_test()

bool edelib::dir_remove ( const char *  name  ) 

Remove given path (must be directory) calling system's rmdir(). Directory must be empty or operation will fail. Return true if succeded or false if failed.

bool edelib::dir_rename ( const char *  from,
const char *  to 
)

Rename given directory name. If name to be renamed to exists (file, directory, link and etc.) it will fail. Directory to be renamed must be empty.

bool edelib::dir_writeable ( const char *  name  ) 

Check if directory is writeable

Deprecated:
with file_test()

void edelib::error_mesage_handler_install ( void(*)(ErrorMessageType t, const char *msg)   ) 

Installs handler for error messages

bool edelib::file_test ( const char *  path,
unsigned int  flags 
)

file_test() is generic checker for target file type on the system, where file type could be directory, regular file socket and etc. This function, besides deducing type, can also check for file's existance and it's access flags.

flags should be set to specify what to test. These values can be OR-ed, so if you wan't to see if target object is file and is executable, you will use FILE_TEST_IS_REGULAR | FILE_TEST_IS_EXECUTABLE.

See also:
FileTestFlags for possible flags
Care must be taken when combine certain flags. For example, since file can be readable, writeable and executable, combination like FILE_TEST_IS_READABLE | FILE_TEST_IS_WRITEABLE | FILE_TEST_IS_EXECUTABLE | FILE_TEST_IS_REGULAR is perfectly valid. On other hand, FILE_TEST_IS_DIR | FILE_TEST_IS_REGULAR makes no sense, so only first bits will be considered (FILE_TEST_IS_DIR only), and these flags will yield false from file_test().

void edelib::listener_add_fd ( int  fd,
void(*)(int, void *)  cb,
void *  arg = 0 
) [inline]

listener_add_fd() function with LISTENER_READ bit set.

References listener_add_fd(), and LISTENER_READ.

void edelib::listener_add_fd ( int  fd,
int  when,
void(*)(int, void *)  cb,
void *  arg = 0 
)

listener_xxx are set of functions with ability to monitor file descriptors (files, sockets, etc.). They are doing much the same work as FLTK's Fl::add_fd() and Fl::remove_fd() with the Fl::wait() loop.

They are mainly created to avoid linking with FLTK libraries when is not needed, eg. console applications.

listener_add_fd() will add file descriptor to listen to. Whem descriptor becomes ready, a cb callback will be called.

Parameters:
fd is descriptor to be monitored
when is bitfield (LISTENER_READ, LISTENER_WRITE and LISTENER_EXCEPT) to indicate when callback should be done
cb is callback to be called
arg is optional parameter passed to the callback

Referenced by listener_add_fd().

void edelib::listener_remove_fd ( int  fd  )  [inline]

listener_remove_fd() function with LISTENER_READ bit set.

References LISTENER_READ, and listener_remove_fd().

void edelib::listener_remove_fd ( int  fd,
int  when 
)

Removes added descriptor.

Parameters:
fd is descriptor to be removed
when are bits to be removed from fd.

Referenced by listener_remove_fd().

int edelib::listener_wait ( void   )  [inline]

The same as for listener_wait(time), except it will run forever, until something happens and will return

References listener_wait().

double edelib::listener_wait ( double  t  ) 

This function corresponds (in some parts) to the FLTK's Fl::wait(). In this case, it will wait until some changes happens on monitored descriptors and will return. It will also call given callbacks (via listener_add_fd()).

listener_wait(), on other hand, is not replacement for Fl::wait(). It will not handle all things Fl::wait() does (like refreshing windows, calling idle callbacks, etc.) and in case listener_xxx be used with FLTK elements, listener_wait() must be called too.

Returns:
positive value if an event or fd happens before time elapsed. It is zero if nothing happens and negative is if error occurs, like signal
Parameters:
t is time to wait maximum seconds. It can return much sooner if something happens

Referenced by listener_wait().

void edelib::nls_locale_from_c ( char *  old  ) 

Restore locale set with nls_locale_to_c().

Parameters:
old is previous locale retrieved with nls_locale_to_c()

char* edelib::nls_locale_to_c ( void   ) 

Forces current locale to be set to "C".

The main intent for this function is to provide uniform data representation for some functions across locales. For example, strtod or printf family depends on current locale and if you want predictable behaviour or reading/writing across locales, the best way is to set "C" locale, call this functions and restore previous locale.

nls_locale_to_c() will return information of current locale, which is allocated c-string. You should not free it, use nls_locale_from_c(ret_value) instead, like:

   char* loc = nls_locale_to_c();
   strtod(...)
   nls_locale_from_c(loc);

Returns:
old locale. It can return NULL if NLS is disabled; nls_locale_from_c() will handle that too.

void edelib::nls_support_init ( const char *  appname,
const char *  dir 
)

A shorthand for textdomain() and bindtextdomain()

This function can be called before application starts, like:

   int main()
   {
      // LOCALEDIR should be set somewhere
      // and advice is to use autoconf for that
      nls_support_init("my_killer_app", LOCALEDIR);

      // app init, starting and etc.
   }

Todo:
what should set_textdomain_dir() and set_textdomain() return when NLS is disabled?
Parameters:
appname is a set of translatable messages, coresponding to the target application's executable
dir the base directory for appname

int edelib::run_async ( const char *  fmt,
  ... 
)

Same as run_sync(), except it will run command without blocking

int edelib::run_program ( const char *  cmd,
bool  wait = true 
)

Executes given program. Path for the program can be specified or not, but for case when is not specified, environment PATH should contain a path where is executable placed.

If parameter wait is set to true (default), this function will wait untill started program is not exited; in that case will return code from started program. On other hand, will just run program (will not check if program can be run or not) and return 0, which is default value for succesfull execution.

Returns:
0 if starting and quitting program went fine; otherwise return one of above codes, or errno value for not checked codes
Parameters:
cmd is commad to be executed with optional full path and parameters
wait if is true (default) function will not exit until program exists
Deprecated:
in a favor of run_sync() and run_async()

int edelib::run_program_fmt ( bool  wait,
const char *  fmt,
  ... 
)

Same as run_program(), but run printf-like constructed command

Deprecated:
in a favor of run_sync() and run_async()

int edelib::run_sync ( const char *  fmt,
  ... 
)

Executes the given program. If full path to the executable was given, it will be directly called; if not, PATH environment variable should contain a path where executable is placed.

Note:
Some programs that exists and are run without parameters (but internaly are executed via shell) could set errno to 2 which is usually interpreted as ENOENT (or program does not exists); for examle tar is known for this. Solution? Rewrite that tar!!!
This function will run a command and wait until it finishes.
Returns:
0 if starting and quitting program went fine; otherwise return one of above codes, or errno value for not checked codes
Parameters:
fmt is printf-like formated string

bool edelib::str_ends ( const char *  str,
const char *  test 
)

Check if string ends with given test string.

Returns:
true if ends or false if not
Parameters:
str is where to search
test is what to search

unsigned char* edelib::str_tolower ( unsigned char *  str  ) 

Makes all characters lower. Operates directly on buffer.

unsigned char* edelib::str_toupper ( unsigned char *  str  ) 

Makes all characters upper. Operates directly on buffer.

char* edelib::str_trim ( char *  str  ) 

Same as str_trimleft(str_trimright(str)).

char* edelib::str_trimleft ( char *  str  ) 

Removes leading space. Operates directly on buffer.

char* edelib::str_trimright ( char *  str  ) 

Removes leading space. Operates directly on buffer.

void edelib::stringtok ( Container &  c,
const String &  str,
const char *  ws = " \t\n" 
) [inline]

A generic String tokenizer (or spliter), similar to stringtok, but works on given container (container that have push_back()).

If delimiter is not found * in container will be put whole string parameter (or container will be size 1). If given string is empty, in container will not be put anything.

This tokenizer is found in libstdc++ documentation. Author is unknown.

Parameters:
c is container where will be tokenized data placed
str is string which should be tokenized
ws is delimiter by which we do splitting

References String::length(), stringtok(), and String::substr().

Referenced by stringtok().

int edelib::system_config_dirs ( list< String > &  lst  ) 

Get a list of directories where configuration files should be searched. List is determined according to the XDG Base Directory Specification.

Returns:
a size of list
Parameters:
lst is where to put founded data

int edelib::system_data_dirs ( list< String > &  lst  ) 

Get a list of directories where data files should be searched. List is determined according to the XDG Base Directory Specification.

Returns:
a size of list
Parameters:
lst is where to put founded data

String edelib::user_cache_dir ( void   ) 

Get default directory where should be stored application specific cached data. Place is determined according to the XDG Base Directory Specification.

Returns:
filled String with path or empty String if fails without directory separator at the end

String edelib::user_config_dir ( void   ) 

Get default directory where should be stored user specific configuration files. Place is determined according to the XDG Base Directory Specification.

Returns:
filled String with path or empty String if fails without directory separator at the end

String edelib::user_data_dir ( void   ) 

Get default directory where should be stored user specific data files like icons. Place is determined according to the XDG Base Directory Specification.

Returns:
filled String with path or empty String if fails without directory separator at the end

char edelib::xsettings_byte_order ( void   ) 

Returns byte order (MSBFirst/LSBFirst) used on client side.

XSettingsList* edelib::xsettings_decode ( unsigned char *  data,
int  len,
unsigned long *  serial 
)

Decode settings from given buffer. Returns NULL if failed or buffer was empty; otherwise returns list of recognised ones.

void edelib::xsettings_encode ( const XSettingsSetting *  setting,
XSettingsBuffer *  buffer 
)

Encode settings from list into buffer.

bool edelib::xsettings_list_add ( XSettingsList **  list,
XSettingsSetting *  setting 
)

Adds setting to the current list. Only pointer will be stored in list.

XSettingsSetting* edelib::xsettings_list_find ( XSettingsList *  list,
const char *  name 
)

Find setting with given name. Returns NULL if nothing was found.

void edelib::xsettings_list_free ( XSettingsList *  list  ) 

Clears settings list.

bool edelib::xsettings_list_remove ( XSettingsList **  list,
const char *  name 
)

Remove setting with given name. If not found, it will do nothing.

XSettingsSetting* edelib::xsettings_setting_copy ( XSettingsSetting *  setting  ) 

Copy given setting. Copy will be allocated, and should be freed with xsettings_setting_free().

bool edelib::xsettings_setting_equal ( XSettingsSetting *  s1,
XSettingsSetting *  s2 
)

Returns true if given two settings are equal or false if not.

void edelib::xsettings_setting_free ( XSettingsSetting *  setting  ) 

Free data allocated by given setting.

int edelib::xsettings_setting_len ( const XSettingsSetting *  setting  ) 

Returns setting lenght.


Generated on Thu Dec 24 05:12:27 2009 for edelib by  doxygen 1.5.9