Qore Programming Language Reference Manual  0.8.12.11
 All Classes Namespaces Functions Variables Groups Pages
Miscellaneous Functions

Functions

string Qore::backquote (string cmd, *reference rc)
 Executes a process and returns a string of the output (stdout only) More...
 
nothing Qore::backquote ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
any Qore::call_builtin_function (string name,...)
 Calls a function and returns the return value, passing the remaining arguments after the function name to the builtin function. More...
 
any Qore::call_builtin_function_args (string name, *softlist vargs)
 Calls a function and returns the return value, using the optional second argument as a list of arguments for the function. More...
 
any Qore::call_function (string name,...)
 Calls a function and returns the return value, passing the remaining arguments after the function name to the function. More...
 
any Qore::call_function (code f,...)
 Calls the given call reference or closure and returns the result, passing the remaining arguments to the call reference or closure. More...
 
any Qore::call_function_args (string name, *softlist vargs)
 Calls a function and returns the return value, using the optional second argument as a list of arguments for the function. More...
 
any Qore::call_function_args (code f, *softlist vargs)
 Calls the given call reference or closure and returns the result, using the optional second argument as a list of arguments to the call reference or closure. More...
 
string Qore::decode_uri_request (string uri)
 Decodes percent-encoded codes in a URI path and converts "+" signs in the query component to spaces and returns the decoded string in UTF-8 encoding. More...
 
string Qore::decode_url (string url)
 Decodes percent numeric codes in a URL string and returns the decoded string in UTF-8 encoding. More...
 
nothing Qore::decode_url ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::encode_uri_request (string url)
 Encodes URI requests by substituting special characters in the path with percent-encoded ewquivalents and substituting spaces with "+" and "+" with the percent-encoded equivalent in the URI query component. More...
 
string Qore::encode_url (string url, softbool encode_all=False)
 Encodes URLs by substituting '%' characters with '%25', spaces (' ') with '%20', and non-ascii characters by percent-encoded representations. More...
 
bool Qore::exists (...)
 A function performing the same role as the exists operator. More...
 
bool Qore::existsFunction (string name)
 Returns True if the function exists in the current program's function name space. More...
 
bool Qore::existsFunction (code c)
 Always returns True. More...
 
nothing Qore::existsFunction ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
bool Qore::exists_function (string name)
 Returns True if the function exists in the current program's function name space. More...
 
bool Qore::exists_function (code c)
 Always returns True. More...
 
*string Qore::functionType (string name)
 Returns "builtin" (for a builtin function), "user" (for a user function), or NOTHING (if the function cannot be found) according to the function name passed. More...
 
nothing Qore::functionType ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
*string Qore::function_type (string name)
 Returns "builtin" (for a builtin function), "user" (for a user function), or NOTHING (if the function cannot be found) according to the function name passed. More...
 
*int Qore::getByte (string str, softint offset=0)
 Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
nothing Qore::getByte ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
*int Qore::getByte (binary b, softint offset=0)
 Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
string Qore::getClassName (object obj)
 Returns the class name of the object passed. More...
 
nothing Qore::getClassName ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::getFeatureList ()
 Returns a list of strings of the builtin and module-supplied features of Qore. More...
 
hash Qore::getModuleHash ()
 Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names. More...
 
list Qore::getModuleList ()
 Returns a list of hashes describing the currently-loaded Qore modules. More...
 
*int Qore::getWord32 (string str, softint offset=0)
 Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::getWord32 (binary b, softint offset=0)
 Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
nothing Qore::getWord32 ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
*int Qore::get_byte (string str, softint offset=0)
 Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_byte (binary b, softint offset=0)
 Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
string Qore::get_class_name (object obj)
 Returns the class name of the object passed. More...
 
string Qore::get_default_encoding ()
 Returns the name of the default character encoding. More...
 
string Qore::get_ex_pos (hash ex)
 returns a descriptive string for an exception location; the source and offset information will also be included in the string returned if present in the exception hash argument More...
 
list Qore::get_feature_list ()
 Returns a list of strings of the builtin and module-supplied features of Qore. More...
 
hash Qore::get_module_hash ()
 Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names. More...
 
list Qore::get_module_list ()
 Returns a list of hashes describing the currently-loaded Qore modules. More...
 
int Qore::get_parse_options ()
 returns the current parse options for the current Program object More...
 
hash Qore::get_qore_library_info ()
 Returns a hash of library build and version info. More...
 
hash Qore::get_qore_option_hash ()
 Returns a hash of hashes giving information about Qore library options for the current build. More...
 
list Qore::get_qore_option_list ()
 Returns a list of hashes giving information about Qore library options for the current build. More...
 
*string Qore::get_script_dir ()
 Returns the name of the directory from which the current script was executed or NOTHING if unknown (i.e. no parent script, script read from stdin, etc) More...
 
*string Qore::get_script_name ()
 Returns the filename of the current script if known or NOTHING if unknown (i.e. no parent script, script read from stdin, etc) More...
 
*string Qore::get_script_path ()
 Returns the path (directory and filename) of the current script or NOTHING if unknown (i.e. no parent script, script read from stdin, etc) More...
 
*int Qore::get_word_16 (string str, softint offset=0)
 Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_16 (binary b, softint offset=0)
 Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_16_lsb (string str, softint offset=0)
 Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_16_lsb (binary b, softint offset=0)
 Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_32 (string str, softint offset=0)
 Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_32 (binary b, softint offset=0)
 Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_32_lsb (string str, softint offset=0)
 Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_32_lsb (binary b, softint offset=0)
 Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_64 (string str, softint offset=0)
 Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_64 (binary b, softint offset=0)
 Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_64_lsb (string str, softint offset=0)
 Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
*int Qore::get_word_64_lsb (binary b, softint offset=0)
 Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data. More...
 
bool Qore::has_key (hash h, string key)
 Returns True if the given key exists in the hash (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered. More...
 
bool Qore::has_key (object obj, string key)
 Returns True if the given key exists in the object (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered or in case of object access errors. More...
 
list Qore::hash_values (hash h)
 Returns a list of all the values in the hash argument passed. More...
 
nothing Qore::hash_values ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::hextoint (string str)
 Returns an integer for a hexadecimal string value; throws an exception if non-hex digits are found. More...
 
nothing Qore::hextoint ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::html_decode (string str)
 Returns a string with any HTML escape codes translated to the original characters. More...
 
nothing Qore::html_decode ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::html_encode (string str)
 Returns a string with characters needing HTML escaping translated to HTML escape codes. More...
 
nothing Qore::html_encode ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
nothing Qore::load_module (string name)
 Loads in a Qore module at run-time. More...
 
nothing Qore::load_module ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
nothing Qore::load_user_module_with_program (string name, Qore::Program pgm)
 Loads in a Qore user module at run-time with using the given Program object as the container for the user module code. More...
 
string Qore::makeBase64String (string str, softint maxlinelen=-1)
 Returns a base64-encoded representation of a string. More...
 
string Qore::makeBase64String (binary bin, softint maxlinelen=-1)
 Returns a base64-encoded representation of a binary object. More...
 
nothing Qore::makeBase64String ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::makeHexString (string str)
 Returns a hex-encoded representation of a string. More...
 
string Qore::makeHexString (binary bin)
 Returns a hex-encoded representation of a binary object. More...
 
nothing Qore::makeHexString ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::make_base64_string (string str, softint maxlinelen=-1)
 Returns a base64-encoded representation of a string. More...
 
string Qore::make_base64_string (binary bin, softint maxlinelen=-1)
 Returns a base64-encoded representation of a binary object. More...
 
string Qore::make_hex_string (string str)
 Returns a hex-encoded representation of a string. More...
 
string Qore::make_hex_string (binary bin)
 Returns a hex-encoded representation of a binary object. More...
 
*hash Qore::parse (string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label=True)
 Adds the text passed to the current program's code, tagged with the given label. More...
 
nothing Qore::parse ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::parseBase64String (string str)
 Parses a base64 encoded string and returns a binary object of the decoded data. More...
 
nothing Qore::parseBase64String ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::parseBase64StringToString (string str, *string encoding)
 Parses a base64 encoded string and returns a string of the decoded data. More...
 
nothing Qore::parseBase64StringToString ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::parseHexString (string hexstr)
 Parses a hex-encoded string and returns the binary object. More...
 
nothing Qore::parseHexString ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
*hash Qore::parseURL (string url, bool keep_brackets=False)
 Parses a URL string and returns a hash of the components; if the URL cannot be parsed then NOTHING is returned. More...
 
nothing Qore::parseURL ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::parse_base64_string (string str)
 Parses a base64 encoded string and returns a binary object of the decoded data. More...
 
string Qore::parse_base64_string_to_string (string str, *string encoding)
 Parses a base64 encoded string and returns a string of the decoded data. More...
 
binary Qore::parse_hex_string (string hexstr)
 Parses a hex-encoded string and returns the binary object. More...
 
hash Qore::parse_url (string url, bool keep_brackets=False)
 Parses a URL string and returns a hash of the components; throws an exception if the string cannot be parsed as a URL. More...
 
nothing Qore::reload_module (string name)
 Reloads an already-loaded Qore module subject to code injection at run-time into Qore; the module's code is not imported into the current Program object. More...
 
 Qore::set_return_value (any val)
 sets the return value for a Program object when running with %exec-class More...
 
string Qore::splice (string str)
 This function always returns an empty string "". More...
 
string Qore::splice (string str, softint start)
 Returns a string based on the argument string but with characters removed from a certain character index. More...
 
string Qore::splice (string str, softint start, softint len, *string nstr)
 Returns a string based on the argument string but optionally with characters removed and/or added from a certain character index. More...
 
list Qore::splice (list l, softint start)
 Returns a list based on the argument list but with elements removed from the given index to the end of the list. More...
 
list Qore::splice (list l, softint start, softint len, *softlist nlist)
 Returns a list based on the argument list but optionally with elements removed and/or added from a certain index. More...
 
nothing Qore::splice ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::strtoint (string num, softint base=10)
 parses a string representing a number in a configurable base and returns the integer More...
 
nothing Qore::strtoint ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 

Detailed Description

Miscellaneous functions

Function Documentation

string Qore::backquote ( string  cmd,
*reference  rc 
)

Executes a process and returns a string of the output (stdout only)

Restrictions:
Qore::PO_NO_EXTERNAL_PROCESS
Parameters
cmdThe shell command to executed as a subprocess
rcan optional reference to an integer to return the return code of the process
Returns
The stdout of the shell command that was executed
Example:
1 int rc;
2 string files = backquote("ls", \rc);
Exceptions
BACKQUOTE-ERRORAn error occurred with the fork() or opening the stdout pipe
See Also
Since
Qore 0.8.8 the rc argument was added
nothing Qore::backquote ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
Qore::PO_NO_EXTERNAL_PROCESS
Code Flags:
RUNTIME_NOOP
any Qore::call_builtin_function ( string  name,
  ... 
)

Calls a function and returns the return value, passing the remaining arguments after the function name to the builtin function.

Parameters
nameThe name of the builtin function to call
...Any optional arguments to the function
Returns
The value returned by the called function
Example:
1 any result = call_builtin_function("func_name", arg1, arg2);
Exceptions
INVALID-FUNCTION-ACCESSParse options do not allow access to the function
NO-FUNCTIONThe function does not exist
Note
The function called could also throw other exceptions
Since
0.8.4 this function no longer restricts its search to builtin functions as as of Qore 0.8.4 builtin and user functions are stored identically internally; there is only one function implementation which can contain both builtin and user variants
any Qore::call_builtin_function_args ( string  name,
*softlist  vargs 
)

Calls a function and returns the return value, using the optional second argument as a list of arguments for the function.

Parameters
nameThe name of the builtin function to call
vargsOptionally a single argument to the function or a list of arguments to the function
Returns
The value returned by the called function
Example:
1 any result = call_builtin_function_args("func_name", (arg1, arg2));
Exceptions
INVALID-FUNCTION-ACCESSParse options do not allow access to the function
NO-FUNCTIONThe function does not exist
Note
The function called could also throw other exceptions
Since
0.8.4 this function no longer restricts its search to builtin functions as as of Qore 0.8.4 builtin and user functions are stored identically internally; there is only one function implementation which can contain both builtin and user variants
any Qore::call_function ( string  name,
  ... 
)

Calls a function and returns the return value, passing the remaining arguments after the function name to the function.

Parameters
nameThe name of the function to call
...Any optional arguments to the function
Returns
The value returned by the called function
Example:
1 any result = call_function("func_name", arg1, arg2);
Exceptions
INVALID-FUNCTION-ACCESSParse options do not allow access to the function
NO-FUNCTIONThe function does not exist
Note
The function called could also throw other exceptions
any Qore::call_function ( code  f,
  ... 
)

Calls the given call reference or closure and returns the result, passing the remaining arguments to the call reference or closure.

Parameters
fThe call reference or closure
...Any optional arguments to the call reference or closure
Example:
1 any result = call_function(call_ref, arg1, arg2);
Note
The call reference or closure called could also throw other exceptions
any Qore::call_function_args ( string  name,
*softlist  vargs 
)

Calls a function and returns the return value, using the optional second argument as a list of arguments for the function.

Parameters
nameThe name of the function to call
vargsOptionally a single argument to the function or a list of arguments to the function
Returns
The value returned by the called function
Example:
1 any result = call_function_args("func_name", (arg1, arg2));
Exceptions
INVALID-FUNCTION-ACCESSParse options do not allow access to the function
NO-FUNCTIONThe function does not exist
Note
The function called could also throw other exceptions
any Qore::call_function_args ( code  f,
*softlist  vargs 
)

Calls the given call reference or closure and returns the result, using the optional second argument as a list of arguments to the call reference or closure.

Parameters
fThe call reference or closure
vargsOptionally a single argument to the call reference or closure or a list of arguments to the call reference or closure
Example:
1 any result = call_function_args(call_ref, (arg1, arg2));
Note
The call reference or closure called could also throw other exceptions
string Qore::decode_uri_request ( string  uri)

Decodes percent-encoded codes in a URI path and converts "+" signs in the query component to spaces and returns the decoded string in UTF-8 encoding.

Code Flags:
CONSTANT
Example:
1 string decoded_uri = decode_uri_request("path/to/something%20else?query=1%2b1+%2b2");
2 # results in: "path/to/something else?query=1+1 +2"
Parameters
uria URI request string to decode
Returns
the decoded URI request string in UTF-8 encoding

The URI string is divided into three parts:

  • the path, which is the first part of the URI string up until any "?" or "#" character
  • the query, which is any string following a "?" character terminating the path and up to a possible "#" character
  • the fragment, which is any string following a "#" character

For all parts, any percent-encoded codes (RFC 3986 2.1) are decoded to the corresponinding character. The path component is identified and distinguished by a "?" or a "#" character. The path component is subjected to standard percent encoding. The query component is any part of the URI string following a "?" character up to the end of the URI string or until a "#" characer is found. The query component is subjected to special decoding for AJAX compatibility; "+" characters are decoded to ASCII space (therefore any "+" charaters in the query component of the URI must be encoded with percent encoding, such is the case with Qore::encode_uri_request() for example). The fragment component is identified as any text following a "#" character, and this is decoded with the same rules as in the path component.

Note
the difference between this function and Qore::decode_url() is that this function employs special logic in the decoding of the different components of the URI string for compatibility with common AJAX libraries that encode ASCII spaces as "+" in the query component of the URI string.
See Also
Since
Qore 0.8.12
string Qore::decode_url ( string  url)

Decodes percent numeric codes in a URL string and returns the decoded string in UTF-8 encoding.

Code Flags:
CONSTANT
Parameters
urla URL string with percent-encodings to decode
Returns
the URL string in UTF-8 encoding with all percent-encodings decoded
Example:
1 string decoded_url = decode_url(encoded_url);
Note
percent decoding is made according to RFC 3986 2.1
See Also
nothing Qore::decode_url ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
string Qore::encode_uri_request ( string  url)

Encodes URI requests by substituting special characters in the path with percent-encoded ewquivalents and substituting spaces with "+" and "+" with the percent-encoded equivalent in the URI query component.

Code Flags:
CONSTANT
Example:
1 string encoded_uri = encode_uri_request("path/to/something else?query=1+1 +2")'
2 # results in: "path/to/something%20else?query=1%2b1+%2b2"
Parameters
urla URL string to encode
Returns
the URI request string with encoded according to the arguments

The URI string is divided into three parts:

  • the path, which is the first part of the URI string up until any "?" or "#" character
  • the query, which is any string following a "?" character terminating the path and up to a possible "#" character
  • the fragment, which is any string following a "#" character

For all parts, any non-ASCII characters and the "%" character are subjected to percent encoding (RFC 3986 2.1). The path component is identified and distinguished by a "?" or a "#" character. Any spaces in the path component are also subjected to percent encoding. The query component is any part of the URI string following a "?" character up to the end of the URI string or until a "#" characer is found. Spaces in the query component are encoded with "+" for compatibility with AJAX libraries, and "+" signs are subjected to percent encoding. The fragment component is identified as any text following a "#" character, and this is encoded with the same rules as in the path component.

Note
the difference between this function and Qore::encode_url() is that this function employs special logic in the encoding of the different components of the URI string for compatibility with common AJAX libraries that encode ASCII spaces as "+" in the query component of the URI string
See Also
Since
Qore 0.8.12
string Qore::encode_url ( string  url,
softbool  encode_all = False 
)

Encodes URLs by substituting '%' characters with '%25', spaces (' ') with '%20', and non-ascii characters by percent-encoded representations.

Code Flags:
CONSTANT
Parameters
urla URL string to encode
encode_allif True, then in addition to '%', spaces (' '), and non-ascii characters the following reserved characters (according to RFC 3986 are also encoded: '!', '*', '\'', '(', ')', ';', ':', '@', '&', '=', '+', '$', ',', '/', '?', '#', '[', ']'
Returns
the URL string with encoded according to the arguments
Example:
1 string encoded_url = encode_url(url);
See Also
Since
Qore 0.8.9
bool Qore::exists (   ...)

A function performing the same role as the exists operator.

Code Flags:
CONSTANT
Parameters
...if only a single argument is passed, then this function returns True if the single argument exists, False if not; otherwise is multiple arguments are passed to the function, it always returns True; this is to emulate the behavior of the exists operator
Returns
if only a single argument is passed, then this function returns True if the single argument exists, False if not; otherwise is multiple arguments are passed to the function, it always returns True; this is to emulate the behavior of the exists operator
Example:
1 bool b = exists(val);
bool Qore::exists_function ( string  name)

Returns True if the function exists in the current program's function name space.

Code Flags:
CONSTANT
Parameters
namethe name of the function to check
Returns
True if the function exists in the current program's function name space, False if not
Example:
1 bool b = exists_function("func_name");
Since
Qore 0.8.12 as a replacement for deprecated camel-case existsFunction()
bool Qore::exists_function ( code  c)

Always returns True.

This function variant is included for backwards-compatibility

Code Flags:
NOOP
Parameters
ca call reference or closure:
Returns
always returns True
Since
Qore 0.8.12 as a replacement for deprecated camel-case existsFunction()
bool Qore::existsFunction ( string  name)

Returns True if the function exists in the current program's function name space.

Code Flags:
CONSTANT, DEPRECATED
Parameters
namethe name of the function to check
Returns
True if the function exists in the current program's function name space, False if not
Deprecated:
use exists_function(); camel-case function names were deprecated in Qore 0.8.12
bool Qore::existsFunction ( code  c)

Always returns True.

This function variant is included for backwards-compatibility

Code Flags:
NOOP, DEPRECATED
Parameters
ca call reference or closure:
Returns
always returns True
Deprecated:
use exists_function(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::existsFunction ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
*string Qore::function_type ( string  name)

Returns "builtin" (for a builtin function), "user" (for a user function), or NOTHING (if the function cannot be found) according to the function name passed.

Parameters
nameThe function name to check
Returns
"builtin" (for a builtin function), "user" (for a user function), or NOTHING (if the function cannot be found) according to the function name passed
Example:
1 *string type = function_type("print");
Since
Qore 0.8.12 as a replacement for deprecated camel-case functionType()
*string Qore::functionType ( string  name)

Returns "builtin" (for a builtin function), "user" (for a user function), or NOTHING (if the function cannot be found) according to the function name passed.

Code Flags:
CONSTANT, DEPRECATED
Parameters
nameThe function name to check
Returns
"builtin" (for a builtin function), "user" (for a user function), or NOTHING (if the function cannot be found) according to the function name passed
Deprecated:
use function_type(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::functionType ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
*int Qore::get_byte ( string  str,
softint  offset = 0 
)

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
CONSTANT
Parameters
strthe string data to process
offsetthe byte offset of the data to retrieve (the first value is at offset 0)
Returns
the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int byte = get_byte(str, 2); # returns the third byte of the string
Note
that for strings this function is not equivalent to the [] operator for multi-byte character encodings, as this function works purely on bytes and the [] operator operates on characters

Furthermore this function is identical to getByte(), except this function has no RUNTIME_NOOP variant
*int Qore::get_byte ( binary  b,
softint  offset = 0 
)

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
CONSTANT
Parameters
bthe data to process
offsetthe byte offset of the data to retrieve (the first value is at offset 0)
Returns
the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int byte = get_byte(bin, 2); # returns the third byte of the binary object
Note
this function is equivalent to the more efficient [] operator when used with a binary argument

Furthermore this function is identical to getByte(), except this function has no RUNTIME_NOOP variant
string Qore::get_class_name ( object  obj)

Returns the class name of the object passed.

Code Flags:
CONSTANT
Parameters
objthe object to get the class name of
Returns
the class name of the object passed
Example:
1 string name = get_class_name(obj);
Note
equivalent to <object>::className()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getClassName()
string Qore::get_default_encoding ( )

Returns the name of the default character encoding.

Returns
the name of the default character encoding
Example:
1 string encoding = get_default_encoding();
string Qore::get_ex_pos ( hash  ex)

returns a descriptive string for an exception location; the source and offset information will also be included in the string returned if present in the exception hash argument

Code Flags:
CONSTANT
Example:
1 try {
2  throw "oops", sprintf("arg %y is invalid", arg);
3 }
4 catch (hash ex) {
5  log("%s: %s: %s", get_ex_pos(ex), ex.err, ex.desc);
6 }
Parameters
exan exception hash
Returns
a string describing the exception location (ex: "sftp-poller.q:140")
Since
Qore 0.8.7
list Qore::get_feature_list ( )

Returns a list of strings of the builtin and module-supplied features of Qore.

Returns
a list of strings of the builtin and module-supplied features of Qore
Example:
1 list list = get_feature_list();
Note
this function is not flagged with CONSTANT since its value could change at runtime
Since
Qore 0.8.12 as a replacement for deprecated camel-case getFeatureList()
hash Qore::get_module_hash ( )

Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names.

Returns
a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names; the values are hashes with the following keys:
  • filename: the path to the module
  • name: the name of the module
  • desc: the description of the module
  • version: the version of the module
  • author: the author of the module
  • api_major: the major number of the Qore module API version the module support
  • api_minor: the minor number of the Qore module API version the module support
  • url: the module's URL
  • license: the module's license
Example:
1 hash mh = get_module_hash();
Note
this function is not flagged with CONSTANT since its value could change at runtime
Since
Qore 0.8.12 as a replacement for deprecated camel-case getModuleHash()
list Qore::get_module_list ( )

Returns a list of hashes describing the currently-loaded Qore modules.

Returns
a list of hashes describing the currently-loaded Qore modules; each element in the list is a hash with the following keys:
  • filename: the path to the module
  • name: the name of the module
  • desc: the description of the module
  • version: the version of the module
  • author: the author of the module
  • api_major: the major number of the Qore module API version the module support
  • api_minor: the minor number of the Qore module API version the module support
  • url: the module's URL
  • license: the module's license
Example:
1 list list = get_module_list();
Note
this function is not flagged with CONSTANT since its value could change at runtime
See Also
get_module_hash()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getModuleList()
int Qore::get_parse_options ( )

returns the current parse options for the current Program object

Code Flags:
CONSTANT
Example:
1 int i = get_parse_options();
Returns
the current parse options for the current Program object
Since
Qore 0.8.7
hash Qore::get_qore_library_info ( )

Returns a hash of library build and version info.

Returns
a hash of library build and version info with the following keys:
  • PlatformOS: The operating system used to build the Qore library
  • PlatformCPU: The CPU used as a target for the Qore library build
  • VersionString: The full version string for this version of the Qore library
  • VersionMajor: An integer giving the Qore library's major version number
  • VersionMinor: An integer giving the Qore library's minor version number
  • VersionSub: An integer giving the Qore library's release version number
  • Build: An integer giving the Qore library's subversion revision number
  • BuildHost: A string giving information about the host used to compile the Qore library
  • Compiler: The compiler used to build the Qore library
  • ModuleDir: The module directory assumed by default in the Qore library
  • CFLAGS: The compiler flags used to compile the Qore library
  • LDFLAGS: The linker flags used to link the Qore library
Code Flags:
CONSTANT
Example:
1 hash h = get_qore_library_info();
hash Qore::get_qore_option_hash ( )

Returns a hash of hashes giving information about Qore library options for the current build.

Returns
a hash of hashes giving information about Qore library options for the current build; the hash keys are the constant names and the values are hashes with the following keys:
  • option: The string description of the option
  • constant: A string giving the name of the constant that has the boolean value for this option (equal to the hash key name)
  • type: The type of option
  • value: The boolean value of the option
Code Flags:
CONSTANT
Example:
1 hash h = get_qore_option_hash();
See Also
get_qore_option_list()
Since
Qore 0.8.4
list Qore::get_qore_option_list ( )

Returns a list of hashes giving information about Qore library options for the current build.

Returns
a list of hashes giving information about Qore library options for the current build; each hash will have the following keys:
  • option: The string description of the option
  • constant: A string giving the name of the constant that has the boolean value for this option
  • type: The type of option
  • value: The boolean value of the option
Code Flags:
CONSTANT
Example:
1 list l = get_qore_option_list();
See Also
get_qore_option_hash()
*string Qore::get_script_dir ( )

Returns the name of the directory from which the current script was executed or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Returns
the name of the directory from which the current script was executed or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)
Example:
1 *string str = get_script_dir();
*string Qore::get_script_name ( )

Returns the filename of the current script if known or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Returns
the filename of the current script if known or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)
Example:
1 *string str = get_script_name();
*string Qore::get_script_path ( )

Returns the path (directory and filename) of the current script or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Returns
the path (directory and filename) of the current script or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)
Example:
1 *string str = get_script_path();
*int Qore::get_word_16 ( string  str,
softint  offset = 0 
)

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
strthe string data to process
offsetthe 2-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_16(str, 2); # returns the third 2-byte (16-bit) value in the string
See Also
get_word_16_lsb()
*int Qore::get_word_16 ( binary  b,
softint  offset = 0 
)

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
bthe data to process
offsetthe 2-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_16(bin, 2); # returns the third 2-byte (16-bit) value in the binary object
See Also
get_word_16_lsb()
*int Qore::get_word_16_lsb ( string  str,
softint  offset = 0 
)

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
strthe string data to process
offsetthe 2-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_16_lsb(str, 2); # returns the third 2-byte (16-bit) value in the string
See Also
get_word_16()
*int Qore::get_word_16_lsb ( binary  b,
softint  offset = 0 
)

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
bthe data to process
offsetthe 2-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_16_lsb(bin, 2); # returns the third 2-byte (16-bit) value in the binary object
See Also
get_word_16()
*int Qore::get_word_32 ( string  str,
softint  offset = 0 
)

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
strthe string data to process
offsetthe 4-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_32(str, 4); # returns the third 4-byte (32-bit) value in the string
Note
This function is identical to getWord32(), except this function has no RUNTIME_NOOP variant
See Also
get_word_32_lsb()
*int Qore::get_word_32 ( binary  b,
softint  offset = 0 
)

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
bthe data to process
offsetthe 4-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_32(bin, 2); # returns the third 4-byte (32-bit) value in the binary object
Note
This function is identical to getWord32(), except this function has no RUNTIME_NOOP variant
See Also
get_word_32_lsb()
*int Qore::get_word_32_lsb ( string  str,
softint  offset = 0 
)

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
strthe string data to process
offsetthe 4-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_32_lsb(str, 4); # returns the third 4-byte (32-bit) value in the string
Note
This function is identical to getWord32(), except this function has no RUNTIME_NOOP variant
See Also
get_word_32()
*int Qore::get_word_32_lsb ( binary  b,
softint  offset = 0 
)

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
bthe data to process
offsetthe 4-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_32_lsb(bin, 2); # returns the third 4-byte (32-bit) value in the binary object
See Also
get_word_32()
*int Qore::get_word_64 ( string  str,
softint  offset = 0 
)

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
strthe string data to process
offsetthe 8-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_64(str, 4); # returns the third 8-byte (64-bit) value in the string
See Also
get_word_64_lsb()
*int Qore::get_word_64 ( binary  b,
softint  offset = 0 
)

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
bthe data to process
offsetthe 8-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_64(bin, 2); # returns the third 8-byte (64-bit) value in the binary object
See Also
get_word_64_lsb()
*int Qore::get_word_64_lsb ( string  str,
softint  offset = 0 
)

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
strthe string data to process
offsetthe 8-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_64_lsb(str, 4); # returns the third 8-byte (64-bit) value in the string
See Also
get_word_64()
*int Qore::get_word_64_lsb ( binary  b,
softint  offset = 0 
)

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
CONSTANT
Parameters
bthe data to process
offsetthe 8-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Example:
1 *int val = get_word_64_lsb(bin, 2); # returns the third 8-byte (64-bit) value in the binary object
See Also
get_word_64()
*int Qore::getByte ( string  str,
softint  offset = 0 
)

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
CONSTANT, DEPRECATED
Parameters
strthe string data to process
offsetthe byte offset of the data to retrieve (the first value is at offset 0)
Returns
the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Note
that for strings this function is not equivalent to the [] operator for multi-byte character encodings, as this function works purely on bytes and the [] operator operates on characters

Furthermore this function is identical to get_byte(), except this function has a RUNTIME_NOOP variant
Deprecated:
since Qore 0.8.4 marked as deprecated; use the get_byte() function instead
nothing Qore::getByte ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
*int Qore::getByte ( binary  b,
softint  offset = 0 
)

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
CONSTANT, DEPRECATED
Parameters
bthe data to process
offsetthe byte offset of the data to retrieve (the first value is at offset 0)
Returns
the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Note
this function is equivalent to the more efficient [] operator when used with a binary argument

Furthermore this function is identical to get_byte(), except this function has a RUNTIME_NOOP variant
Deprecated:
Qore 0.8.4 marked as deprecated; use the get_byte() function instead
string Qore::getClassName ( object  obj)

Returns the class name of the object passed.

Code Flags:
CONSTANT, DEPRECATED
Parameters
objthe object to get the class name of
Returns
the class name of the object passed
Deprecated:
use get_class_name(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::getClassName ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
list Qore::getFeatureList ( )

Returns a list of strings of the builtin and module-supplied features of Qore.

Code Flags:
DEPRECATED
Returns
a list of strings of the builtin and module-supplied features of Qore
Note
this function is not flagged with CONSTANT since its value could change at runtime
Deprecated:
use get_feature_list(); camel-case function names were deprecated in Qore 0.8.12
hash Qore::getModuleHash ( )

Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names.

Code Flags:
DEPRECATED
Returns
a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names; the values are hashes with the following keys:
  • filename: the path to the module
  • name: the name of the module
  • desc: the description of the module
  • version: the version of the module
  • author: the author of the module
  • api_major: the major number of the Qore module API version the module support
  • api_minor: the minor number of the Qore module API version the module support
  • url: the module's URL
  • license: the module's license
Note
this function is not flagged with CONSTANT since its value could change at runtime
Since
Qore 0.8.1
Deprecated:
use get_module_hash(); camel-case function names were deprecated in Qore 0.8.12
list Qore::getModuleList ( )

Returns a list of hashes describing the currently-loaded Qore modules.

Code Flags:
DEPRECATED
Returns
a list of hashes describing the currently-loaded Qore modules; each element in the list is a hash with the following keys:
  • filename: the path to the module
  • name: the name of the module
  • desc: the description of the module
  • version: the version of the module
  • author: the author of the module
  • api_major: the major number of the Qore module API version the module support
  • api_minor: the minor number of the Qore module API version the module support
  • url: the module's URL
  • license: the module's license
Note
this function is not flagged with CONSTANT since its value could change at runtime
See Also
get_module_hash()
Deprecated:
use get_module_list(); camel-case function names were deprecated in Qore 0.8.12
*int Qore::getWord32 ( string  str,
softint  offset = 0 
)

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT, DEPRECATED
Parameters
strthe string data to process
offsetthe 4-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Note
This function is identical to get_word_32(), except this function has a RUNTIME_NOOP variant
Deprecated:
Qore 0.8.4 marked as deprecated; use the get_word_32() function instead
*int Qore::getWord32 ( binary  b,
softint  offset = 0 
)

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
CONSTANT, DEPRECATED
Parameters
bthe data to process
offsetthe 4-byte offset of the data to retrieve (the first value is at offset 0)
Returns
the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data
Note
This function is identical to get_word_32(), except this function has a RUNTIME_NOOP variant
Deprecated:
Qore 0.8.4 marked as deprecated; use the get_word_32() function instead
nothing Qore::getWord32 ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
bool Qore::has_key ( hash  h,
string  key 
)

Returns True if the given key exists in the hash (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered.

Parameters
hthe hash to check
keythe key name to check; this value will be converted to the default character encoding to check the hash
Returns
True if the given key exists in the hash (does not necessarily have to have a value assigned), False if the key is not present at all
Example:
1 bool b = has_key(hash, "key");
Exceptions
ENCODING-CONVERSION-ERRORthis error is thrown if the given key cannot be converted to the default character encoding
bool Qore::has_key ( object  obj,
string  key 
)

Returns True if the given key exists in the object (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered or in case of object access errors.

Example:
1 bool b = has_key(obj, "key");
Exceptions
ENCODING-CONVERSION-ERRORthis error is thrown if the given key cannot be converted to the default character encoding
Note
object access exceptions could also be raised
list Qore::hash_values ( hash  h)

Returns a list of all the values in the hash argument passed.

Code Flags:
CONSTANT
Parameters
ha hash to get all the values of
Returns
a list of all the values in the hash argument passed
Example:
1 list vl = hash_values(vl);
Note
equivalent to <hash>::values()
See Also
<hash>::keys()
nothing Qore::hash_values ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
int Qore::hextoint ( string  str)

Returns an integer for a hexadecimal string value; throws an exception if non-hex digits are found.

Parameters
stra string of hexadecimal digits (like "6d4f84e0"; with or without leading "x" or "0x")
Returns
the base-10 integer corresponding to the argument
Example:
1 int i = hextoint("ab3d4e0f12");
Exceptions
PARSE-HEX-ERRORinvalid hex digit found
nothing Qore::hextoint ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
string Qore::html_decode ( string  str)

Returns a string with any HTML escape codes translated to the original characters.

Code Flags:
CONSTANT
Parameters
strthe argument to decode
Returns
the string passed as an argument with any HTML escape codes translated to the original characters
Example:
1 string str = html_decode("&lt;hello&gt;"); # returns "<hello>"
Note
equivalent to <string>::getDecoded() with Qore::CD_HTML
See Also
<string>::getDecoded()
nothing Qore::html_decode ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
string Qore::html_encode ( string  str)

Returns a string with characters needing HTML escaping translated to HTML escape codes.

Code Flags:
CONSTANT
Parameters
strthe argument to process
Returns
the string passed as an argument with characters needing HTML escaping translated to HTML escape codes
Example:
1 string str = html_encode("<hello>"); # returns "&lt;hello&gt;"
Note
equivalent to <string>::getEncoded() with Qore::CE_HTML
See Also
<string>::getEncoded()
nothing Qore::html_encode ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
nothing Qore::load_module ( string  name)

Loads in a Qore module at run-time.

If a feature with the same name already exists, then this feature's code is imported into the current Program object if necessary and no further action is taken.

Note that modules providing objects resolved at parse time (classes, constants, functions, etc) must be loaded with the %requires directive instead, unless all references to the objects provided by the module will be made in code embedded in child Program objects.

Restrictions:
Qore::PO_NO_MODULES
Parameters
nameeither a feature name (a module will be searched with this feature name) or a path to a module to load
Example:
1 load_module("mysql");
Exceptions
LOAD-MODULE-ERRORmodule cannot be loaded: API incompatibility, module defines symbols already defined in the target object, etc
See Also
Since
Qore 0.8.7 this function can also be used in user module code
nothing Qore::load_module ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
Qore::PO_NO_MODULES
Code Flags:
RUNTIME_NOOP
nothing Qore::load_user_module_with_program ( string  name,
Qore::Program  pgm 
)

Loads in a Qore user module at run-time with using the given Program object as the container for the user module code.

This function allows a user module to be loaded with a custom API already present in the user module's Program container

Restrictions:
Qore::PO_NO_MODULES
Example:
1 load_user_module_with_program("MyModule", p);
Parameters
namethe name or path of the user module to load
pgmthe Program object to use as a container for the new user module, presumably this has a custom API that the user module can use; note that after this call the Program object will be owned by the user module, therefore the object itself will no longer be valid and any accesses to the object after this call will result in an exception
Exceptions
LOAD-MODULE-ERRORmodule cannot be loaded: binary modules cannot be loaded in Program containers, module defines symbols already defined in the target object, etc
Since
Qore 0.8.12
string Qore::make_base64_string ( string  str,
softint  maxlinelen = -1 
)

Returns a base64-encoded representation of a string.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
CONSTANT
Parameters
strthe string to encode
maxlinelenthe maximum length of a line in the resulting output string in bytes; if this value is > 0 then output lines will be separated by CRLF characters
Returns
the base64-encoded string of the data passed
Example:
1 string base64 = make_base64_string(data, 64);
See Also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeBase64String()
string Qore::make_base64_string ( binary  bin,
softint  maxlinelen = -1 
)

Returns a base64-encoded representation of a binary object.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
CONSTANT
Parameters
binthe data to encode
maxlinelenthe maximum length of a line in the resulting output string in bytes; if this value is > 0 then output lines will be separated by CRLF characters
Returns
the base64-encoded string of the data passed
Example:
1 string base64 = make_base64_string(data, 64);
See Also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeBase64String()
string Qore::make_hex_string ( string  str)

Returns a hex-encoded representation of a string.

Code Flags:
CONSTANT
Parameters
strthe string to encode
Returns
a string of hex digits repsenting the bytes of the argument passed
Example:
1 string str = make_hex_string(str2);
See Also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeHexString()
string Qore::make_hex_string ( binary  bin)

Returns a hex-encoded representation of a binary object.

Code Flags:
CONSTANT
Parameters
binthe binary object to encode
Returns
a string of hex digits repsenting the bytes of the argument passed
Example:
1 string str = make_hex_string(bin);
See Also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeHexString()
string Qore::makeBase64String ( string  str,
softint  maxlinelen = -1 
)

Returns a base64-encoded representation of a string.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
CONSTANT, DEPRECATED
Parameters
strthe string to encode
maxlinelenthe maximum length of a line in the resulting output string in bytes; if this value is > 0 then output lines will be separated by CRLF characters
Returns
the base64-encoded string of the data passed
Since
the maxlinelen parameter was added in Qore 0.8.4
See Also
Deprecated:
use make_base64_string(); camel-case function names were deprecated in Qore 0.8.12
string Qore::makeBase64String ( binary  bin,
softint  maxlinelen = -1 
)

Returns a base64-encoded representation of a binary object.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
CONSTANT, DEPRECATED
Parameters
binthe data to encode
maxlinelenthe maximum length of a line in the resulting output string in bytes; if this value is > 0 then output lines will be separated by CRLF characters
Returns
the base64-encoded string of the data passed
Since
the maxlinelen parameter was added in Qore 0.8.4
See Also
Deprecated:
use make_base64_string(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::makeBase64String ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
string Qore::makeHexString ( string  str)

Returns a hex-encoded representation of a string.

Code Flags:
CONSTANT, DEPRECATED
Parameters
strthe string to encode
Returns
a string of hex digits repsenting the bytes of the argument passed
See Also
Deprecated:
use make_hex_string(); camel-case function names were deprecated in Qore 0.8.12
string Qore::makeHexString ( binary  bin)

Returns a hex-encoded representation of a binary object.

Code Flags:
CONSTANT, DEPRECATED
Parameters
binthe binary object to encode
Returns
a string of hex digits repsenting the bytes of the argument passed
See Also
Deprecated:
use make_hex_string(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::makeHexString ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
*hash Qore::parse ( string  code,
string  label,
*softint  warning_mask,
*string  source,
*softint  offset,
softbool  format_label = True 
)

Adds the text passed to the current program's code, tagged with the given label.

Restrictions:
Qore::PO_NO_EMBEDDED_LOGIC, Qore::PO_IN_MODULE
Parameters
codethe string of Qore source code to parse; the parsed code will be added to the current program
labela label identifying the code or the code's source
warning_maskAn optional warning mask; see Warning Constants for values to combine by binary-or; if this arguments is 0 or not given then no warnings will be checked or issued and the return value will always be NOTHING
sourceAn optional source file name for the code being parsed; this is useful if sections of a file are parsed
offsetAn optional line offset for use with the source parameter; this gives the line offset in the file to the code being parsed
format_labelIf this argument is True, then the label is formatted as "<run-time-loaded: label>"; if False, then it is passed as-is
Example:
1 parse(code, filename);
Note
This function could throw many parse exceptions which are not enumerated here; any parse errors will result in an appropriate exception.
See Also
Since
Qore 0.8.7 the optional warning_mask, source, offset, and format_label arguments were added; also label formatting was added; these changes were made to align the functionality of this function with the Program::parse() and Program::parsePending() methods
nothing Qore::parse ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
Qore::PO_NO_EMBEDDED_LOGIC, Qore::PO_IN_MODULE
Code Flags:
RUNTIME_NOOP
binary Qore::parse_base64_string ( string  str)

Parses a base64 encoded string and returns a binary object of the decoded data.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
RET_VALUE_ONLY
Parameters
strthe base64-encoded input data to decode
Returns
a binary object of the decoded data
Example:
1 binary bin = parse_base64_string(base64_string);
Exceptions
BASE64-PARSE-ERRORA syntax error occurred parsing the base64 string (invalid character, etc)
See Also
Since
Qore 0.8.12 as a replacement for deprecated camel-case parseBase64String()
string Qore::parse_base64_string_to_string ( string  str,
*string  encoding 
)

Parses a base64 encoded string and returns a string of the decoded data.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
RET_VALUE_ONLY
Parameters
strthe base64-encoded input data to decode
encodingthe character encoding tag for the string return value; if not present, the default character encoding is assumed.
Returns
a string of the decoded data tagged with the given encoding
Example:
1 string str = parse_base64_string_to_string(base64_string);
Exceptions
BASE64-PARSE-ERRORA syntax error occurred parsing the base64 string (invalid character, etc)
Since
the encoding parameter was added in Qore 0.8.4
See Also
Since
Qore 0.8.12 as a replacement for deprecated camel-case parseBase64StringToString()
binary Qore::parse_hex_string ( string  hexstr)

Parses a hex-encoded string and returns the binary object.

Code Flags:
RET_VALUE_ONLY
Parameters
hexstra string of an even-number of only hexadecimal digits
Returns
a binary object of the decoded data
Example:
1 binary bin = parseHexString(hex_string);
Exceptions
PARSE-HEX-ERRORA syntax error occurred parsing the hex string (odd number of digits, invalid hex character, etc)
See Also
Since
Qore 0.8.12 as a replacement for deprecated camel-case parseHexString()
hash Qore::parse_url ( string  url,
bool  keep_brackets = False 
)

Parses a URL string and returns a hash of the components; throws an exception if the string cannot be parsed as a URL.

Parameters
urlthe URL to parse (ex: "https://user:pass@host:8080/path"); either a hostname or path is required at a minimum or a PARSE-URL-ERROR exception is raised
keep_bracketsif this argument is true then if the hostname or address is enclosed in square brackets, then the brackets will be included in the "host" key output as well; square brackets are used by some Qore methods to denote IPv6 addresses; for example see Socket::connect()
Returns
a hash of the components of the URL with the following keys (if data in the URL is present; note that at least either the "host" or the "path" keys will always be returned if no PARSE-URL-ERROR is raised):
  • protocol: the scheme in the URL (ex: "http")
  • path: any path given in the URL; the path will be prefixed by "/" if a hostname is found in the URL argument string, otherwise it will not if it was not given as such in the argument string
  • username: any username given in the URL
  • password: any password given in the URL
  • host: any hostname given in the URL; note that this key will be given if no other information can be found in the URL argument and the URL argument string has no "/" characters; depending on the usage context for this function, this may actually be a filename
  • port: any port number given in the URL
Example:
1 hash hash = parse_url(url_string);
Exceptions
PARSE-URL-ERRORThe URL string given could not be parsed
Note
URLs with UNIX sockets are generally supported in Qore with the following syntax: scheme://socket=<url_encoded_path>/path, where url_encoded_path is a path with URL-encoding as performed by encode_url(); for example: "http://socket=%2ftmp%socket-dir%2fsocket-file-1/url/path"; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well.
See Also
parseURL() for a version of this function that does not throw exceptions if the URL cannot be parsed
binary Qore::parseBase64String ( string  str)

Parses a base64 encoded string and returns a binary object of the decoded data.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Parameters
strthe base64-encoded input data to decode
Returns
a binary object of the decoded data
Exceptions
BASE64-PARSE-ERRORA syntax error occurred parsing the base64 string (invalid character, etc)
See Also
Deprecated:
use parse_base64_string(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::parseBase64String ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
string Qore::parseBase64StringToString ( string  str,
*string  encoding 
)

Parses a base64 encoded string and returns a string of the decoded data.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Parameters
strthe base64-encoded input data to decode
encodingthe character encoding tag for the string return value; if not present, the default character encoding is assumed.
Returns
a string of the decoded data tagged with the given encoding
Exceptions
BASE64-PARSE-ERRORA syntax error occurred parsing the base64 string (invalid character, etc)
Since
the encoding parameter was added in Qore 0.8.4
See Also
Deprecated:
use parse_base64_string_to_string(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::parseBase64StringToString ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
binary Qore::parseHexString ( string  hexstr)

Parses a hex-encoded string and returns the binary object.

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Parameters
hexstra string of an even-number of only hexadecimal digits
Returns
a binary object of the decoded data
Exceptions
PARSE-HEX-ERRORA syntax error occurred parsing the hex string (odd number of digits, invalid hex character, etc)
See Also
Deprecated:
use parse_hex_string(); camel-case function names were deprecated in Qore 0.8.12
nothing Qore::parseHexString ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED
*hash Qore::parseURL ( string  url,
bool  keep_brackets = False 
)

Parses a URL string and returns a hash of the components; if the URL cannot be parsed then NOTHING is returned.

Code Flags:
CONSTANT
Parameters
urlthe URL to parse (ex: "https://user:pass@host:8080/path"); either a hostname or path is required at a minimum or the function will return NOTHING
keep_bracketsif this argument is true then if the hostname or address is enclosed in square brackets, then the brackets will be included in the "host" key output as well; square brackets are used by some Qore methods to denote IPv6 addresses; for example see Socket::connect()
Returns
a hash of the components of the URL with the following keys (if data in the URL is present; note that at least either the "host" or the "path" keys will always be returned if a hash is returned):
  • protocol: the scheme in the URL (ex: "http")
  • path: any path given in the URL; the path will be prefixed by "/" if a hostname is found in the URL argument string, otherwise it will not if it was not given as such in the argument string
  • username: any username given in the URL
  • password: any password given in the URL
  • host: any hostname given in the URL; note that this key will be given if no other information can be found in the URL argument and the URL argument string has no "/" characters; depending on the usage context for this function, this may actually be a filename
  • port: any port number given in the URL
Example:
1 *hash hash = parseURL(url_string);
Note
URLs with UNIX sockets are generally supported in Qore with the following syntax: scheme://socket=<url_encoded_path>/path, where url_encoded_path is a path with URL-encoding as performed by encode_url(); for example: "http://socket=%2ftmp%socket-dir%2fsocket-file-1/url/path"; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well.
See Also
parse_url() for a version of this function that throws exceptions if the URL cannot be parsed
nothing Qore::parseURL ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
nothing Qore::reload_module ( string  name)

Reloads an already-loaded Qore module subject to code injection at run-time into Qore; the module's code is not imported into the current Program object.

Restrictions:
Qore::PO_NO_MODULES, MUST HAVE: Qore::PO_ALLOW_INJECTION
Parameters
namea feature name for an already-loaded module
Example:
1 reload_module("FixedLengthUtil");
Exceptions
LOAD-MODULE-ERRORmodule cannot be loaded: API incompatibility, etc
Note
  • unlike load_module(), this function does not cause the given module's code to be loaded in the current Program object
  • in case the given feature has not been loaded or has already been loaded and was not subject to code injection, this call is silently ignored
See Also
Since
Qore 0.8.12
Qore::set_return_value ( any  val)

sets the return value for a Program object when running with %exec-class

Restrictions:
Qore::PO_NO_PROCESS_CONTROL
Example:
Parameters
valthe return value for the Program
Exceptions
SETRETURNVALUE-ERRORthis exception is thrown if the Program is not currently running in %exec-class mode
Since
Qore 0.8.12
string Qore::splice ( string  str)

This function always returns an empty string "".

This function variant is included for backwards-compatibility

Code Flags:
NOOP
Parameters
strno action is taken on the argument
Returns
always returns an empty string ""
string Qore::splice ( string  str,
softint  start 
)

Returns a string based on the argument string but with characters removed from a certain character index.

An exception can only be thrown here if an invalid multi-byte encoding is found

Parameters
strthe string to process
startthe character index (where the first character is 0) to start removing characters; if this value is negative, it gives the offset from the end of the string
Returns
the processed string
Example:
1 string str = splice(str2, 5);
See Also
the splice operator
string Qore::splice ( string  str,
softint  start,
softint  len,
*string  nstr 
)

Returns a string based on the argument string but optionally with characters removed and/or added from a certain character index.

An exception can only be thrown here if an invalid multi-byte encoding is found

Parameters
strthe string to process
startthe character index (where the first character is 0) to start removing (and/or adding) characters; if this value is negative, it gives the offset from the end of the string
lenthe number of characters to remove; if this argument is 0 then no characters are removed; if this value is negative, then it gives an offset from the end of the string (ie -2 means remove all characters up to but not including the two last characters)
nstrthe optional string for inserting new characters
Returns
the processed string with characters removed and/or added according to the arguments
Example:
1 string str = splice(str2, 5, 7, "hello");
See Also
the splice operator
list Qore::splice ( list  l,
softint  start 
)

Returns a list based on the argument list but with elements removed from the given index to the end of the list.

Exceptions can only be thrown here if objects are removed from the list and this causes them to go out of scope and an exception is thrown in one of the destructors

Parameters
lthe list to process
startthe starting element (where the first element is 0) to start removing elements; if this value is negative, it gives the offset from the end of the list
Example:
1 list l = splice(l2, 5);
See Also
the splice operator
list Qore::splice ( list  l,
softint  start,
softint  len,
*softlist  nlist 
)

Returns a list based on the argument list but optionally with elements removed and/or added from a certain index.

Exceptions can only be thrown here if objects are removed from the list and this causes them to go out of scope and an exception is thrown in one of the destructors

Parameters
lthe list to process
startthe starting element (where the first element is 0) to start removing (and/or adding) elements; if this value is negative, it gives the offset from the end of the list
lenthe number of list elements to remove; if this argument is 0 then no elements are removed; if this value is negative, then it gives an offset from the end of the list (ie -2 means remove all elements up to but not including the two last elements)
nlistthe optional list for inserting new elements
Returns
the processed list with elements removed and/or added according to the arguments
Example:
1 list l = splice(l2, 5, 7, "hello");
See Also
the splice operator
nothing Qore::splice ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
int Qore::strtoint ( string  num,
softint  base = 10 
)

parses a string representing a number in a configurable base and returns the integer

Parameters
numa string representing a number
basethe base of the number
Returns
the integer represented by the string and the base
Example:
1 int i = strtoint("41", 8);
Exceptions
STRTOINT-ERRORcannot parse string; unsupported base, etc
nothing Qore::strtoint ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP