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

### (5431)

`#include <string.h>`
`#include <strings.h>`
`#include <stdarg.h>`
`#include <stddef.h>`
`#include <string>`
`#include <functional>`
`#include <list>`
`#include <set>`
`#include <vector>`
`#include <algorithm>`
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes

struct | free_ptr< T >
| functor template for calling free() on pointers More...
struct | simple_delete< T >
| functor template for deleting elements More...
struct | simple_deref< T >
| functor template for dereferencing elements More...
class | ltstr
| for simple c-string less-than comparisons More...
class | ltcstrcase
| for simple c-string case-insensitive less-than comparisons More...
class | ltstrcase
| for std::string case-insensitive less-than comparisons More...
class | ltchar
| for char less-than comparisons More...
class | cstr_vector_t
| non-thread-safe vector for storing "char *" that you want to delete More...

## Macros

#define | Q_AF_UNSPEC -1
| cross-platform define for AF_UNSPEC
#define | Q_AF_INET -2
| cross-platform define for AF_INET
#define | Q_AF_INET6 -3
| cross-platform define for AF_INET6
#define | Q_SOCK_STREAM -1
| platform-independent define for SOCK_STREAM

## Typedefs

typedef signed short | qore_type_t
| used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
typedef size_t | qore_size_t
| used for sizes (same range as a pointer)
typedef long | qore_offset_t
| used for offsets that could be negative
typedef unsigned | qore_classid_t
| used for the unique class ID for QoreClass objects
typedef std::set< int > | int_set_t
| set of integers
typedef std::vector< const QoreTypeInfo * > | type_vec_t
| vector of type information for parameter lists
typedef std::vector < AbstractQoreNode * > | arg_vec_t
| vector of value information for default argument lists
typedef std::vector< std::string > | name_vec_t
| vector of parameter names for parameter lists
typedef AbstractQoreNode *(* | q_func_t )(const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin function signatures
typedef int64(* | q_func_int64_t )(const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin function signatures returning an integer value
typedef bool(* | q_func_bool_t )(const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin function signatures returning a boolean value
typedef double(* | q_func_double_t )(const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin function signatures returning an double value
typedef AbstractQoreNode *(* | q_method_t )(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures
typedef int64(* | q_method_int64_t )(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures, returns int64
typedef int(* | q_method_int_t )(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants, returns int
typedef bool(* | q_method_bool_t )(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants, returns bool
typedef double(* | q_method_double_t )(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants, returns double
typedef AbstractQoreNode *(* | q_method2_t )(const QoreMethod &method, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures when called with the new generic calling convention
typedef AbstractQoreNode *(* | q_method3_t )(const QoreMethod &method, const type_vec_t &typeList, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants
typedef AbstractQoreNode *(* | q_static_method2_t )(const QoreMethod &method, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin static method signatures for static methods using the new generic calling convention
typedef AbstractQoreNode *(* | q_static_method3_t )(const QoreMethod &method, const type_vec_t &typeList, const void *ptr, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin static method signatures for static methods using the even newer generic calling convention supporting hard typing and method variants
typedef void(* | q_constructor_t )(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass constructor method signatures
typedef void(* | q_constructor2_t )(const QoreClass &thisclass, QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass constructor method signatures using the new generic calling convention
typedef void(* | q_constructor3_t )(const QoreClass &thisclass, const type_vec_t &typeList, const void *ptr, QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)
| the type used for builtin QoreClass constructor method signatures using the even newer generic calling convention supporting hard typing and method variants
typedef void(* | q_system_constructor_t )(QoreObject *self, int code, va_list args)
| the type used for builtin QoreClass system constructor method signatures
typedef void(* | q_system_constructor2_t )(const QoreClass &thisclass, QoreObject *self, int code, va_list args)
| the type used for builtin QoreClass system constructor method signatures using the new generic calling convention
typedef void(* | q_destructor_t )(QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass destructor signatures
typedef void(* | q_destructor2_t )(const QoreClass &thisclass, QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass destructor signatures with the new generic calling convention
typedef void(* | q_destructor3_t )(const QoreClass &thisclass, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass destructor signatures with the new generic calling convention and user-defined data
typedef void(* | q_copy_t )(QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass copy signatures
typedef void(* | q_copy2_t )(const QoreClass &thisclass, QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass copy signatures with the new generic calling convention
typedef void(* | q_copy3_t )(const QoreClass &thisclass, const void *ptr, QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass copy signatures with the new generic calling convention
typedef bool(* | q_delete_blocker_t )(QoreObject *self, AbstractPrivateData *private_data)
| the typed used for QoreClass deleteBlocker signatures
typedef unsigned | q_trid_t
| type for thread resource IDs (unique within a single running qore library process)

## Enumerations

enum | qore_license_t { QL_GPL = 0, QL_LGPL = 1 }
| qore library and module license type identifiers More...

## Detailed Description

provides type and other definitions for the Qore library

## Typedef Documentation

typedef void(* q_constructor2_t)(const QoreClass &thisclass, QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass constructor method signatures using the new generic calling convention

Parameters

  thisclass | a constant reference to the QoreClass being constructed (in a heirarchy, could be different than the QoreClass returned from QoreObject::getClass()
  self | the QoreObject that the function is being executed on
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef void(* q_constructor3_t)(const QoreClass &thisclass, const type_vec_t &typeList, const void *ptr, QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass constructor method signatures using the even newer generic calling convention supporting hard typing and method variants

Parameters

  thisclass | a constant reference to the QoreClass being constructed (in a heirarchy, could be different than the QoreClass returned from QoreObject::getClass()
  typeList | a constant reference to the list of types defined for the variant being called
  ptr | a pointer to user-defined member set when the variant is added to the method
  self | the QoreObject that the function is being executed on
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef void(* q_constructor_t)(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass constructor method signatures

Parameters

  self | the QoreObject that the function is being executed on
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef void(* q_copy2_t)(const QoreClass &thisclass, QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)

the type used for builtin QoreClass copy signatures with the new generic calling convention

this function must set any private data against the new object by calling QoreObject::setPrivate() on `self`

Parameters

  thisclass | a constant reference to the QoreClass being copied
  self | the QoreObject that the function is being executed on (the new copy of the object)
  old | the object being copied
  private_data | the object's private data representing the state of the object for the current builtin class
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef void(* q_copy3_t)(const QoreClass &thisclass, const void *ptr, QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)

the type used for builtin QoreClass copy signatures with the new generic calling convention

this function must set any private data against the new object by calling QoreObject::setPrivate() on `self`

Parameters

  thisclass | a constant reference to the QoreClass being copied
  ptr | a pointer to user-defined member set when the variant is added to the method
  self | the QoreObject that the function is being executed on (the new copy of the object)
  old | the object being copied
  private_data | the object's private data representing the state of the object for the current builtin class
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef void(* q_copy_t)(QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)

the type used for builtin QoreClass copy signatures

this function must set any private data against the new object by calling QoreObject::setPrivate() on `self`

Parameters

  self | the QoreObject that the function is being executed on (the new copy of the object)
  old | the object being copied
  private_data | the object's private data representing the state of the object for the current builtin class
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef bool(* q_delete_blocker_t)(QoreObject *self, AbstractPrivateData *private_data)

the typed used for QoreClass deleteBlocker signatures

Parameters

  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object for the current builtin class

Returns
  false if the object may be deleted normally, true if the deletion should be suppressed

typedef void(* q_destructor2_t)(const QoreClass &thisclass, QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)

the type used for builtin QoreClass destructor signatures with the new generic calling convention

destructors are optional, but, if present, must call AbstractPrivateData::deref() on any private data (if present)

Parameters

  thisclass | a constant reference to the QoreClass
  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object for the current builtin class
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef void(* q_destructor3_t)(const QoreClass &thisclass, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)

the type used for builtin QoreClass destructor signatures with the new generic calling convention and user-defined data

destructors are optional, but, if present, must call AbstractPrivateData::deref() on any private data (if present)

Parameters

  thisclass | a constant reference to the QoreClass
  ptr | a pointer to user-defined member set when the variant is added to the method
  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object for the current builtin class
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef void(* q_destructor_t)(QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)

the type used for builtin QoreClass destructor signatures

destructors are optional, but, if present, must call AbstractPrivateData::deref() on any private data (if present)

Parameters

  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object for the current builtin class
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

typedef AbstractQoreNode*(* q_func_t)(const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin function signatures

Parameters

  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0)

typedef AbstractQoreNode*(* q_method2_t)(const QoreMethod &method, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures when called with the new generic calling convention

Parameters

  method | a constant reference to the QoreMethod being called
  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0)

typedef AbstractQoreNode*(* q_method3_t)(const QoreMethod &method, const type_vec_t &typeList, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants

Parameters

  method | a constant reference to the QoreMethod being called
  typeList | a constant reference to the list of types defined for the variant being called
  ptr | a pointer to user-defined member set when the variant is added to the method
  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0)

typedef bool(* q_method_bool_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants, returns bool

Parameters

  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the integer return value of the function

typedef double(* q_method_double_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants, returns double

Parameters

  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the integer return value of the function

typedef int64(* q_method_int64_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures, returns int64

Parameters

  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the integer return value of the function

typedef int(* q_method_int_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures when called with the even newer generic calling convention supporting hard typing and method variants, returns int

Parameters

  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the integer return value of the function

typedef AbstractQoreNode*(* q_method_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures

Parameters

  self | the QoreObject that the function is being executed on
  private_data | the object's private data representing the state of the object
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0)

typedef AbstractQoreNode*(* q_static_method2_t)(const QoreMethod &method, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin static method signatures for static methods using the new generic calling convention

Parameters

  method | a constant reference to the QoreMethod being called
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0)

typedef AbstractQoreNode*(* q_static_method3_t)(const QoreMethod &method, const type_vec_t &typeList, const void *ptr, const QoreListNode *args, ExceptionSink *xsink)

the type used for builtin static method signatures for static methods using the even newer generic calling convention supporting hard typing and method variants

Parameters

  method | a constant reference to the QoreMethod being called
  typeList | a constant reference to the list of types defined for the variant being called
  ptr | a pointer to user-defined member set when the variant is added to the method
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0)

typedef void(* q_system_constructor2_t)(const QoreClass &thisclass, QoreObject *self, int code, va_list args)

the type used for builtin QoreClass system constructor method signatures using the new generic calling convention

System constructors are called for objects that are created automatically by the library, normally to be assigned to constants. System objects are treated specially by the Qore library as they are not associated with any QoreProgram object. Additionally, system object constructors are not allowed to raise exceptions.

Parameters

  self | the QoreObject that the function is being executed on
  code | this argument is necessary in order to be able to provide the va_list in the following argument due to the way QoreClass::execSystemConstructor() is called. If not required by the constuctor, this argument can be ignored.
  args | a variable-length list of arguments to the system constructor

typedef void(* q_system_constructor_t)(QoreObject *self, int code, va_list args)

the type used for builtin QoreClass system constructor method signatures

System constructors are called for objects that are created automatically by the library, normally to be assigned to constants. System objects are treated specially by the Qore library as they are not associated with any QoreProgram object. Additionally, system object constructors are not allowed to raise exceptions.

Parameters

  self | the QoreObject that the function is being executed on
  code | this argument is necessary in order to be able to provide the va_list in the following argument due to the way QoreClass::execSystemConstructor() is called. If not required by the constuctor, this argument can be ignored.
  args | a variable-length list of arguments to the system constructor

typedef unsigned q_trid_t

type for thread resource IDs (unique within a single running qore library process)

See Also
  qore_get_trid()

## Enumeration Type Documentation

enum qore_license_t

qore library and module license type identifiers

Enumerator
QL_GPL | code to be used under the GPL license
QL_LGPL | code to be used under the LGPL license