common.h File Reference
`#include <algorithm>`
`#include <cinttypes>`
`#include <cstdarg>`
`#include <cstddef>`
`#include <cstdlib>`
`#include <cstring>`
`#include <functional>`
`#include <list>`
`#include <set>`
`#include <string>`
`#include <strings.h>`
`#include <vector>`
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

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

## Macros

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

## Typedefs

typedef std::vector< QoreValue > | arg_vec_t
| vector of value information for default argument lists
typedef long long | int64
| 64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equivalence between long int and int
typedef std::set< int > | int_set_t
| set of integers
typedef std::vector< std::string > | name_vec_t
| vector of parameter names for parameter lists
typedef void(* | q_constructor_n_t) (QoreObject *self, const QoreListNode *args, q_rt_flags_t rtflags, ExceptionSink *xsink)
| the type used for builtin QoreClass constructor method signatures More...
typedef void(* | q_copy_t) (QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass copy signatures More...
typedef void(* | q_deserializer_t) (QoreObject &self, const QoreHashNode *sdata, QoreDeserializationContext &context, ExceptionSink *xsink)
| the type used for builtin QoreClass deserializer method signatures More...
typedef void(* | q_destructor_t) (QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
| the type used for builtin QoreClass destructor signatures More...
typedef void(* | q_external_constructor_t) (const QoreMethod &method, const void *ptr, QoreObject *self, const QoreListNode *args, q_rt_flags_t rtflags, ExceptionSink *xsink)
| the type used for builtin QoreClass constructor method signatures More...
typedef void(* | q_external_copy_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 More...
typedef void(* | q_external_destructor_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 More...
typedef QoreValue(* | q_external_func_t) (const void *ptr, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
| the type used for builtin function signatures for external functions More...
typedef QoreValue(* | q_external_method_t) (const QoreMethod &method, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures More...
typedef QoreValue(* | q_external_static_method_t) (const QoreMethod &method, const void *ptr, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
| the type used for external static methods More...
typedef QoreValue(* | q_func_n_t) (const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
| the type used for builtin function signatures More...
typedef QoreValue(* | q_method_n_t) (QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
| the type used for builtin QoreClass method signatures More...
typedef uint64_t | q_rt_flags_t
| runtime code execution flags
typedef QoreHashNode *(* | q_serializer_t) (const QoreObject &self, const AbstractPrivateData &data, QoreSerializationContext &context, ExceptionSink *xsink)
| the type used for builtin QoreClass serializer method signatures More...
typedef void(* | q_system_constructor_t) (QoreObject *self, int code, va_list args)
| the type used for builtin QoreClass system constructor method signatures More...
typedef unsigned | q_trid_t
| type for thread resource IDs (unique within a single running qore library process) More...
typedef unsigned | qore_classid_t
| used for the unique class ID for QoreClass objects
typedef intptr_t | qore_offset_t
| used for offsets that could be negative
typedef size_t | qore_size_t
| used for sizes (same range as a pointer)
typedef int16_t | qore_type_t
| used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
typedef std::vector< const QoreTypeInfo * > | type_vec_t
| vector of type information for parameter lists

## Enumerations

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

## Functions

DLLEXPORT long long | q_atoll (const char *str)
| returns an integer value for a string
DLLEXPORT const char * | type_get_name (const QoreTypeInfo *t)
| returns the type name for an opaqua QoreTypeInfo ptr More...

## Detailed Description

provides type and other definitions for the Qore library

## Typedef Documentation

## q_constructor_n_t

typedef void(* q_constructor_n_t) (QoreObject *self, const QoreListNode *args, q_rt_flags_t rtflags, 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
  flags | runtime flags
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

## q_copy_t

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()

## q_deserializer_t

typedef void(* q_deserializer_t) (QoreObject &self, const QoreHashNode *sdata, QoreDeserializationContext &context, ExceptionSink *xsink)

the type used for builtin QoreClass deserializer method signatures

Parameters

  self | the QoreObject that the function is being executed on
  sdata | the data that was returned by the serializer containing the object state and/or any members
  context | the deserialization context object
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the hash to be written to the class as members (may be nullptr)

This method must also set any private data against the object

## q_destructor_t

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()

## q_external_constructor_t

typedef void(* q_external_constructor_t) (const QoreMethod &method, const void *ptr, QoreObject *self, const QoreListNode *args, q_rt_flags_t rtflags, ExceptionSink *xsink)

the type used for builtin QoreClass constructor method signatures

Parameters

  method | a constant reference to the QoreMethod being called for the constructor (in a heirarchy, the class of this method could be different than the QoreClass returned from QoreObject::getClass() if the constructor for a base class is being executed)
  ptr | a pointer to user-defined data 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
  rtflags | runtime flags
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Since
  Qore 0.8.13

## q_external_copy_t

typedef void(* q_external_copy_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 data 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()

## q_external_destructor_t

typedef void(* q_external_destructor_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 data 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()

## q_external_func_t

typedef QoreValue(* q_external_func_t) (const void *ptr, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)

the type used for builtin function signatures for external functions

Parameters

  ptr | a pointer to user-defined data set when the variant is added to the function
  args | the list of arguments to the function (could be 0), use inline functions in params.h to access
  flags | runtime flags
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function; the caller owns any reference returned in the return value

Since
  Qore 0.9.5

## q_external_method_t

typedef QoreValue(* q_external_method_t) (const QoreMethod &method, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)

the type used for builtin QoreClass method signatures

Parameters

  method | a constant reference to the QoreMethod being called
  ptr | a pointer to user-defined data 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
  flags | runtime flags
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0); the caller owns any reference returned in the return value

Since
  Qore 0.8.13

## q_external_static_method_t

typedef QoreValue(* q_external_static_method_t) (const QoreMethod &method, const void *ptr, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)

the type used for external static methods

Parameters

  method | a constant reference to the QoreMethod being called
  ptr | a pointer to user-defined data 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
  flags | runtime flags
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function; the caller owns any reference returned in the return value

Since
  Qore 0.8.13

## q_func_n_t

typedef QoreValue(* q_func_n_t) (const QoreListNode *args, q_rt_flags_t flags, 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
  flags | runtime flags
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function; the caller owns any reference returned in the return value

## q_method_n_t

typedef QoreValue(* q_method_n_t) (QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, q_rt_flags_t flags, 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
  flags | runtime flags
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the return value of the function (can be 0); the caller owns any reference returned in the return value

## q_serializer_t

typedef QoreHashNode*(* q_serializer_t) (const QoreObject &self, const AbstractPrivateData &data, QoreSerializationContext &context, ExceptionSink *xsink)

the type used for builtin QoreClass serializer method signatures

Parameters

  self | the QoreObject that the function is being executed on
  data | the private data for the builtin class
  context | the serialization context object
  xsink | Qore-language exception information should be stored here by calling ExceptionSink::raiseException()

Returns
  the serialized private data hash for the object to be deserialized to object state and/or members in the deserialization method (may be nullptr)

## q_system_constructor_t

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

## q_trid_t

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

## qore_license_t

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
QL_MIT | code to be used under the MIT license

## Function Documentation

## type_get_name()

DLLEXPORT const char* type_get_name | ( | const QoreTypeInfo * | t | ) |

returns the type name for an opaqua QoreTypeInfo ptr

Since
  Qore 0.9