All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreLib.h File Reference

### (5431)

`#include <qore/common.h>`
`#include <qore/QoreThreadLock.h>`
`#include <qore/qore_bitopts.h>`
`#include <qore/safe_dslist>`
`#include <time.h>`
`#include <string.h>`
`#include <strings.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <ctype.h>`
`#include <sys/types.h>`
Include dependency graph for QoreLib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes

class | FeatureList
| STL-like list containing all presently-loaded Qore features. More...
struct | qore_option_s
| definition of the elements in the qore_option_list More...

## Macros

#define | _QORE_HAS_HARD_TYPING 1
| not defined because this version of Qore has moved all XML functionality to the "xml" module
#define | _QORE_HAS_DBI_EXECRAW 1
| defined because this version of Qore supports the execRaw() DBI function
#define | _QORE_HAS_TIME_ZONES 1
| defined because this version of Qore has time zone support
#define | _QORE_HAS_THREAD_RESOURCE_IDS 1
| defined because this version of Qore has thread resource IDs
#define | _QORE_HAS_PREPARED_STATMENT_API 1
| defined because this version of Qore has the prepared statement API
#define | _QORE_HAS_DATASOURCE_ACTIVETRANSACTION 1
| defined because this version of Qore has the Datasource::activeTransaction() function
#define | _QORE_HAS_DBI_SELECT_ROW 1
| defined because this version of Qore supports the DBI selectRow() function
#define | _QORE_HAS_NUMBER_TYPE 1
| defined because this version of Qore supports the number type (QoreNumberNode)
#define | _QORE_HAS_PATH_IS_READABLE 1
| defined because this version of Qore has the q_path_is_readable() function
#define | _QORE_HAS_DBI_OPTIONS 1
| defined because this version of Qore supports the DBI option APIs
#define | _QORE_HAS_FIND_CREATE_TIMEZONE 1
| defined because this version of Qore has the find_create_timezone() function
#define | _QORE_HAS_NUMBER_CONS_WITH_PREC 1
| defined because this version of Qore has a QoreNumberNode constructor with a precision specifier
#define | _QORE_HAS_FILE_OBJECT_HELPER 1
| defined because this version of Qore has the QoreFileOjectHelper class
#define | _QORE_HAS_QUEUE_OBJECT_HELPER 1
| defined because this version of Qore has the QoreQueueOjectHelper class
#define | QORE_OPT_ATOMIC_OPERATIONS "atomic operations"
| option: atomic operations
#define | QORE_OPT_STACK_GUARD "stack guard"
| option: stack guard
#define | QORE_OPT_SIGNAL_HANDLING "signal handling"
| option: signal handling
#define | QORE_OPT_RUNTIME_STACK_TRACE "runtime stack tracing"
| option: runtime stack tracing
#define | QORE_OPT_LIBRARY_DEBUGGING "library debugging"
| option: library debugging
#define | QORE_OPT_SHA224 "openssl sha224"
| option: ssh224 algorithm supported (depends on openssl used to compile qore)
#define | QORE_OPT_SHA256 "openssl sha256"
| option: ssh256 algorithm supported (depends on openssl used to compile qore)
#define | QORE_OPT_SHA384 "openssl sha384"
| option: ssh384 algorithm supported (depends on openssl used to compile qore)
#define | QORE_OPT_SHA512 "openssl sha512"
| option: ssh512 algorithm supported (depends on openssl used to compile qore)
#define | QORE_OPT_MDC2 "openssl mdc2"
| option: mdc2 algorithm supported (depends on openssl used to compile qore)
#define | QORE_OPT_RC5 "openssl rc5"
| option: rc5 algorithm supported (depends on openssl used to compile qore)
#define | QORE_OPT_MD2 "openssl md2"
| option: md2 algorithm supported (depends on openssl used to compile qore)
#define | QORE_OPT_TERMIOS "termios"
| option: TermIOS class available
#define | QORE_OPT_FILE_LOCKING "file locking"
| option: file locking
#define | QORE_OPT_UNIX_USERMGT "unix user management"
| option: unix user/group management functions available
#define | QORE_OPT_UNIX_FILEMGT "unix file management"
| option: unix file management functions available
#define | QORE_OPT_FUNC_ROUND "round()"
| option: round() function available
#define | QORE_OPT_FUNC_TIMEGM "timegm()"
| option: timegm() function available
#define | QORE_OPT_FUNC_SETEUID "seteuid()"
| option: seteuid() function available
#define | QORE_OPT_FUNC_SETEGID "setegid()"
| option: setegid() function available
#define | QORE_OPT_FUNC_SYSTEM "system()"
| option: system() function available
#define | QORE_OPT_FUNC_KILL "kill()"
| option: kill() function available
#define | QORE_OPT_FUNC_FORK "fork()"
| option: fork() function available
#define | QORE_OPT_FUNC_GETPPID "getppid()"
| option: getppid() function available
#define | QORE_OPT_FUNC_STATVFS "statvfs()"
| option: statvfs() function available
#define | QORE_OPT_FUNC_SETSID "setsid()"
| option: setsid() function available
#define | QORE_OPT_FUNC_IS_EXECUTABLE "is_executable()"
| option: is_executable() function available
#define | QO_OPTION 0
| option type feature
#define | QORE_MAX(a, b) ((a) > (b) ? (a) : (b))
| macro to return the maximum of 2 numbers
#define | QORE_MIN(a, b) ((a) < (b) ? (a) : (b))
| macro to return the minimum of 2 numbers

## Functions

DLLEXPORT char * | make_class_name (const char *fn)
| function to try and make a class name out of a file path, returns a new string that must be free()ed
DLLEXPORT QoreStringNode * | q_sprintf (const class QoreListNode *params, int field, int offset, class ExceptionSink *xsink)
| a string formatting function that works with Qore data structures
DLLEXPORT QoreStringNode * | q_vsprintf (const class QoreListNode *params, int field, int offset, class ExceptionSink *xsink)
| a string formatting function that works with Qore data structures
DLLEXPORT struct tm * | q_localtime (const time_t *clock, struct tm *tms)
| thread-safe version of "localtime()"
DLLEXPORT struct tm * | q_gmtime (const time_t *clock, struct tm *tms)
| thread-safe version of "gmtime()"
DLLEXPORT int64 | q_epoch ()
| returns the seconds from the epoch
DLLEXPORT int64 | q_epoch_us (int &us)
| returns the seconds and microseconds from the epoch
DLLEXPORT int64 | q_epoch_ns (int &us)
| returns the seconds and nanoseconds from the epoch
DLLEXPORT char * | q_basename (const char *path)
| thread-safe basename function (resulting pointer must be free()ed)
DLLEXPORT char * | q_basenameptr (const char *path)
| returns a pointer within the same string
DLLEXPORT char * | q_dirname (const char *path)
| thread-safe dirname function (resulting pointer must be free()ed)
DLLEXPORT void * | q_realloc (void *ptr, size_t size)
| frees memory if there is an allocation error
DLLEXPORT QoreHashNode * | q_getpwuid (uid_t uid)
| thread-safe version of getpwuid(): returns a Qore hash of the passwd information from the uid if possible, otherwise 0
DLLEXPORT QoreHashNode * | q_getpwnam (const char *name)
| thread-safe version of getpwnam(): returns a Qore hash of the passwd information from the username if possible, otherwise 0
DLLEXPORT QoreHashNode * | q_getgrgid (uid_t uid)
| thread-safe version of getgrgid(): returns a Qore hash of the group information from the gid if possible, otherwise 0
DLLEXPORT QoreHashNode * | q_getgrnam (const char *name)
| thread-safe version of getgrnam(): returns a Qore hash of the group information from the group name if possible, otherwise 0
int | q_uname2uid (const char *name, uid_t &uid)
| thread-safe way to lookup a uid from a username
int | q_gname2gid (const char *name, gid_t &gid)
| thread-safe way to lookup a gid from a group name
DLLEXPORT void | qore_setup_argv (int pos, int argc, char *argv[])
| sets up the Qore ARGV and QORE_ARGV values
DLLEXPORT qore_license_t | qore_get_license ()
| returns the license type that the library has been initialized under
DLLEXPORT void | qore_exit_process (int rc)
| instead of calling "exit()", call qore_exit_process() to exit without risking a crash if other threads are running
static char * | strchrs (const char *str, const char *chars)
| find one of any characters in a string
static char * | strnchr (const char *str, int len, char c)
| find a character in a string up to len
static void | strtolower (char *str)
| convert a string to lower-case in place
static char * | strtoupper (char *str)
| convert a string to upper-case in place
DLLEXPORT int | getSecZeroInt (const AbstractQoreNode *a)
| for getting an integer number of seconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int64 | getSecZeroBigInt (const AbstractQoreNode *a)
| for getting an integer number of seconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int | getSecMinusOneInt (const AbstractQoreNode *a)
| for getting an integer number of seconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int64 | getSecMinusOneBigInt (const AbstractQoreNode *a)
| for getting an integer number of seconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int | getMsZeroInt (const AbstractQoreNode *a)
| for getting an integer number of milliseconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int64 | getMsZeroBigInt (const AbstractQoreNode *a)
| for getting an integer number of milliseconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int | getMsMinusOneInt (const AbstractQoreNode *a)
| for getting an integer number of milliseconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int64 | getMsMinusOneBigInt (const AbstractQoreNode *a)
| for getting an integer number of milliseconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int | getMicroSecZeroInt (const AbstractQoreNode *a)
| for getting an integer number of microseconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int64 | getMicroSecZeroInt64 (const AbstractQoreNode *a)
| for getting an integer number of microseconds, with 0 as the default, from either a relative time value or an integer value
static bool | is_nothing (const AbstractQoreNode *n)
| to check if an AbstractQoreNode object is NOTHING
static void | discard (AbstractQoreNode *n, ExceptionSink *xsink)
| to deref an AbstractQoreNode (when the pointer may be 0)
DLLEXPORT BinaryNode * | qore_deflate (void *ptr, unsigned long len, int level, ExceptionSink *xsink)
| compresses data with the DEFLATE algorithm
DLLEXPORT QoreStringNode * | qore_inflate_to_string (const BinaryNode *b, const QoreEncoding *enc, ExceptionSink *xsink)
| decompresses data compressed with the DEFLATE algorithm to a string
DLLEXPORT BinaryNode * | qore_inflate_to_binary (const BinaryNode *b, ExceptionSink *xsink)
| decompresses data compressed with the DEFLATE algorithm to a binary
DLLEXPORT BinaryNode * | qore_gzip (void *ptr, unsigned long len, int level, ExceptionSink *xsink)
| gzips data
DLLEXPORT QoreStringNode * | qore_gunzip_to_string (const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
| gunzips compressed data to a string
DLLEXPORT BinaryNode * | qore_gunzip_to_binary (const BinaryNode *bin, ExceptionSink *xsink)
| gunzips compressed data to a binary
DLLEXPORT BinaryNode * | qore_bzip2 (void *ptr, unsigned long len, int level, ExceptionSink *xsink)
| compresses data with bzip2
DLLEXPORT QoreStringNode * | qore_bunzip2_to_string (const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
| decompresses bzip2 data to a string
DLLEXPORT BinaryNode * | qore_bunzip2_to_binary (const BinaryNode *bin, ExceptionSink *xsink)
| decompresses bzip2 data to a binary
DLLEXPORT BinaryNode * | parseBase64 (const char *buf, int len, ExceptionSink *xsink)
| parses a string of base64-encoded data and returns a BinaryNode
DLLEXPORT BinaryNode * | parseHex (const char *buf, int len, ExceptionSink *xsink)
| parses a string of hex characters and returns a BinaryNode
DLLEXPORT const AbstractQoreZoneInfo * | findCreateOffsetZone (int seconds_east)
| returns a time zone for the given time zone UTC offset
DLLEXPORT const AbstractQoreZoneInfo * | find_create_timezone (const char *name, ExceptionSink *xsink)
| returns a time zone for the given region name or UTC offset given as a string ("+01:00")
DLLEXPORT int | tz_get_utc_offset (const AbstractQoreZoneInfo *tz, int64 epoch_offset, bool &is_dst, const char *&zone_name)
| returns the UTC offset and local time zone name for the given time given as seconds from the epoch (1970-01-01Z)
DLLEXPORT bool | tz_has_dst (const AbstractQoreZoneInfo *tz)
| returns true if the zone has daylight savings time ever
DLLEXPORT const char * | tz_get_region_name (const AbstractQoreZoneInfo *tz)
| returns the reion name for the given time zone
DLLEXPORT QoreStringNode * | q_strerror (int errnum)
| returns the error string as a QoreStringNode
DLLEXPORT void | q_strerror (QoreString &str, int errnum)
| concatenates the error string to the given string
DLLEXPORT QoreStringNode * | qore_reassign_signal (int sig, const char *name)
| allows a module to take over ownership of a signal
DLLEXPORT void | parse_set_time_zone (const char *zone)
| to set the time zone from the command line
DLLEXPORT int | qore_usleep (int64 usecs)
| use this function instead of usleep(), as usleep() is not signal-safe on some platforms (ex: Solaris 8, 9)
DLLEXPORT bool | q_path_is_readable (const char *path)
| platform-independent API that tells if the given path is readable by the current user
DLLEXPORT bool | q_parse_bool (const AbstractQoreNode *n)
| tries to parse a boolean value - standard conversion or uses q_parse_bool(const char*) if it's a string
DLLEXPORT bool | q_parse_bool (const char *str)
| parses a string and returns a boolean (ie case-insensitive "on","true","enable*","yes" are True, the rest is interpreted as a number where 0=false, everything else=true)
DLLEXPORT bool | q_get_option_value (const char *opt)
| returns the boolean value of qore library the given option name; false if the option is unknown
DLLEXPORT bool | q_get_option_constant_value (const char *opt)
| returns the boolean value of qore library the given name of the constant for the option; false if the option constant name is unknown

## Variables

DLLEXPORT FeatureList | qoreFeatureList
| list of qore features
DLLEXPORT const qore_option_s * | qore_option_list
| list of qore options
DLLEXPORT size_t | qore_option_list_size
| number of elements in the option list

## Detailed Description

contains prototypes for various helper functions in the Qore library

## Macro Definition Documentation

#define _QORE_HAS_HARD_TYPING 1

not defined because this version of Qore has moved all XML functionality to the "xml" module

not defined because this version of Qore has moved all XML functionality to the "xml" module not defined because this version of Qore has moved all XML functionality to the "xml" module defined because this version of Qore supports hard typing, overloading, default arguments, etc

## Function Documentation

DLLEXPORT const AbstractQoreZoneInfo* find_create_timezone | ( | const char * | name,
|  | ExceptionSink * | xsink
| ) |  |

returns a time zone for the given region name or UTC offset given as a string ("+01:00")

Parameters

  name | the name of the region to find or a UTC offset given as a string ("+01:00")
  xsink | if the given region is not found or valid or any error occur finding or loading the given region, exception info is stored here and the function returns 0

Returns
  the time zone region found or 0 if the timezone is UTC (also in case of an exception 0 is returned - check xsink after calling)

DLLEXPORT void parse_set_time_zone | ( | const char * | zone | ) |

to set the time zone from the command line

Note
  this function can only be called when a program exists

int q_gname2gid | ( | const char * | name,
|  | gid_t & | gid
| ) |  |

thread-safe way to lookup a gid from a group name

Parameters

  name | the group to look up
  gid | the gid returned

Returns
  0 for no error, non-zero is an error code like errno

int q_uname2uid | ( | const char * | name,
|  | uid_t & | uid
| ) |  |

thread-safe way to lookup a uid from a username

Parameters

  name | the username to look up
  uid | the uid returned

Returns
  0 for no error, non-zero is an error code like errno

DLLEXPORT QoreStringNode* qore_reassign_signal | ( | int | sig,
|  | const char * | name
| ) |  |

allows a module to take over ownership of a signal

Parameters

  sig | signal number
  name | module name taking ownership of managing the signal

Returns
  0 for OK, non-zero for failed (error message)