Qore Programming Language Reference Manual 1.14.2
Loading...
Searching...
No Matches
Miscellaneous Functions

Functions

string Qore::backquote (string cmd, *reference< int > 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...
 
auto 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...
 
auto Qore::call_builtin_function_args (string name, *softlist< auto > vargs)
 Calls a function and returns the return value, using the optional second argument as a list of arguments for the function. More...
 
auto 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...
 
auto 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...
 
auto Qore::call_function_args (string name, *softlist< auto > vargs)
 Calls a function and returns the return value, using the optional second argument as a list of arguments for the function. More...
 
auto Qore::call_function_args (code f, *softlist< auto > 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 equivalents 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< stringQore::getFeatureList ()
 Returns a list of strings of the builtin and module-supplied features of Qore. More...
 
hash< string, hash< auto > > Qore::getModuleHash ()
 Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names. More...
 
list< hash< auto > > 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...
 
code Qore::get_call_reference (string identifier)
 resolve the string as a call reference 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< auto > 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 ExceptionInfo hash argument More...
 
list< stringQore::get_feature_list ()
 Returns a list of strings of the builtin and module-supplied features of Qore. More...
 
hash< auto > Qore::get_global_vars ()
 returns a hash of global variables More...
 
hash< auto > Qore::get_local_vars (int frame)
 retrieves a hash of local variables for the given stack frame More...
 
hash< string, hash< auto > > 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< hash< auto > > Qore::get_module_list ()
 Returns a list of hashes describing the currently-loaded Qore modules. More...
 
auto Qore::get_module_option (string module, string option)
 returns the given global module option More...
 
int Qore::get_parse_options ()
 returns the current parse options for the current Program object More...
 
hash< auto > Qore::get_qore_library_info ()
 Returns a hash of library build and version info. More...
 
hash< string, hash< auto > > Qore::get_qore_option_hash ()
 Returns a hash of hashes giving information about Qore library options for the current build. More...
 
list< hash< auto > > Qore::get_qore_option_list ()
 Returns a list of hashes giving information about Qore library options for the current build. More...
 
string Qore::get_safe_url (string url)
 Returns the URL string passed without any password information. 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< auto > 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< auto > Qore::hash_values (hash< auto > 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, int warning_mask=WARN_MODULES)
 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...
 
*hash< ExceptionInfoQore::load_module_warn (string name, int warning_mask=WARN_MODULES)
 Loads in a Qore module at run-time. 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< auto > 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< UrlInfoQore::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< UrlInfoQore::parse_url (string url, bool keep_brackets)
 Parses a URL string and returns a hash of the components. More...
 
hash< UrlInfoQore::parse_url (string url, *int options)
 Parses a URL string and returns a hash of the components. 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...
 
nothing Qore::set_global_var_value (string name, auto value)
 set the value of a global variable More...
 
nothing Qore::set_local_var_value (int frame, string var, auto value)
 sets the value of the given local variable; if the variable cannot be found an exception is raised More...
 
nothing Qore::set_module_option (string module, string option, auto value)
 set the given module option More...
 
 Qore::set_return_value (auto 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< auto > Qore::splice (list< auto > 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< auto > Qore::splice (list< auto > l, softint start, softint len)
 Returns a list based on the argument list but optionally with elements removed and/or added from a certain index. More...
 
list< auto > Qore::splice (list< auto > l, softint start, softint len, softlist< auto > 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

◆ backquote() [1/2]

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

◆ backquote() [2/2]

string Qore::backquote ( string  cmd,
*reference< int 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:
int rc;
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

◆ call_builtin_function()

auto 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:
auto 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

◆ call_builtin_function_args()

auto Qore::call_builtin_function_args ( string  name,
*softlist< auto >  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:
auto 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

◆ call_function() [1/2]

auto 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:
auto result = call_function(call_ref, arg1, arg2);
Note
The call reference or closure called could also throw other exceptions
See also

◆ call_function() [2/2]

auto 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:
auto 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
See also

◆ call_function_args() [1/2]

auto Qore::call_function_args ( code  f,
*softlist< auto >  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:
auto result = call_function_args(call_ref, (arg1, arg2));
Note
The call reference or closure called could also throw other exceptions
See also

◆ call_function_args() [2/2]

auto Qore::call_function_args ( string  name,
*softlist< auto >  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:
auto 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
See also

◆ decode_uri_request()

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:
string decoded_uri = decode_uri_request("path/to/something%20else?query=1%2b1+%2b2");
# 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

◆ decode_url() [1/2]

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

◆ decode_url() [2/2]

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:
string decoded_url = decode_url(encoded_url);
Note
percent decoding is made according to RFC 3986 2.1
See also

◆ encode_uri_request()

string Qore::encode_uri_request ( string  url)

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

Code Flags:
CONSTANT
Example:
string encoded_uri = encode_uri_request("path/to/something else?query=1+1 +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

◆ encode_url()

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:
string encoded_url = encode_url(url);
See also
Since
Qore 0.8.9

◆ exists()

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:
bool b = exists(val);

◆ exists_function() [1/2]

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

◆ exists_function() [2/2]

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:
bool b = exists_function("func_name");
Since
Qore 0.8.12 as a replacement for deprecated camel-case existsFunction()

◆ existsFunction() [1/3]

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

◆ existsFunction() [2/3]

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

◆ existsFunction() [3/3]

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

◆ function_type()

*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:
*string type = function_type("print");
Since
Qore 0.8.12 as a replacement for deprecated camel-case functionType()

◆ functionType() [1/2]

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

◆ functionType() [2/2]

*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

◆ get_byte() [1/2]

*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:
*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

◆ get_byte() [2/2]

*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:
*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

◆ get_call_reference()

code Qore::get_call_reference ( string  identifier)

resolve the string as a call reference

Code Flags:
RET_VALUE_ONLY
Parameters
identifierthe string to resolve; function or static class method, can include namespace path
Returns
the call reference to the given function or static method; the string is resolved as follows:
  • if in a class method, a non-static method lookup is made
  • if not found, then a static method lookup is made
  • if not found, then a function lookup is made
  • if not found, an CALL-REFERENCE-ERROR exception is thrown
Exceptions
CALL-REFERENCE-ERRORcannot resolve call reference; method not accessible in the calling context
Note
  • use <object>::getCallReference() to get call references to non-public class methods; this builtin function will always run without any class context, however pseudo-methods run with the class context of the caller, which enables it to access any accessible private method
  • call references to non-static methods contain a weak reference to the object; the lifetime of the object is not extended by the call reference
See also
Since
Qore 0.9.4

◆ get_class_name()

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:
string name = get_class_name(obj);
Note
equivalent to <object>::className()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getClassName()

◆ get_default_encoding()

string Qore::get_default_encoding ( )

Returns the name of the default character encoding.

Returns
the name of the default character encoding
Example:
string encoding = get_default_encoding();

◆ get_ex_pos()

string Qore::get_ex_pos ( hash< auto >  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 ExceptionInfo hash argument

Code Flags:
CONSTANT
Example:
try {
throw "oops", sprintf("arg %y is invalid", arg);
} catch (hash<ExceptionSink> ex) {
log("%s: %s: %s", get_ex_pos(ex), ex.err, ex.desc);
}
Parameters
exa hash which should be an ExceptionInfo hash
Returns
a string describing the exception location (ex: "sftp-poller.q:140")
Since
Qore 0.8.7

◆ get_feature_list()

list< string > 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:
list<string> l = 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()

◆ get_global_vars()

hash< auto > Qore::get_global_vars ( )

returns a hash of global variables

Code Flags:
CONSTANT
Example:
hash<auto> h = get_global_vars();
Returns
a hash of global variables and their values
See also
Qore::Program::getGlobalVars()
Since
Qore 0.8.13

◆ get_local_vars()

hash< auto > Qore::get_local_vars ( int  frame)

retrieves a hash of local variables for the given stack frame

Restrictions:
MUST HAVE: Qore::PO_ALLOW_DEBUGGER
Code Flags:
RET_VALUE_ONLY
Example:
hash<auto> h = get_local_vars(0);
hash< auto > get_local_vars(int frame)
retrieves a hash of local variables for the given stack frame
Parameters
framethe stack frame where 0 is the current stack frame
Returns
a hash of local variables for the given stack frame; if the stack frame is invalid, an empty hash is returned; hash keys are variable names; hash values are hashes with the following keys:
  • "type": can be either "local" or "closure" for closure-bound local variables
  • "value": the value of the variable
Exceptions
CIRCULAR-REFERENCE-ERRORcircular reference found when retrieving local variable values
Since
Qore 0.8.13

◆ get_module_hash()

hash< string, hash< auto > > 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:
hash<string, hash<auto>> 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()

◆ get_module_list()

list< hash< auto > > 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:
list<hash<auto>> l = 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()

◆ get_module_option()

auto Qore::get_module_option ( string  module,
string  option 
)

returns the given global module option

Restrictions:
Qore::PO_NO_PROCESS_CONTROL
Code Flags:
CONSTANT
Example:
auto val = get_module_option(mod, opt);
auto get_module_option(string module, string option)
returns the given global module option
Parameters
modulethe name of the module
optionthe name of the option
Returns
the value of the given module option
See also
set_module_option()
Since
Qore 0.9

◆ get_parse_options()

int Qore::get_parse_options ( )

returns the current parse options for the current Program object

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

◆ get_qore_library_info()

hash< auto > 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:
hash<auto> h = get_qore_library_info();

◆ get_qore_option_hash()

hash< string, hash< auto > > 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:
hash<string, hash<auto>> h = get_qore_option_hash();
See also
get_qore_option_list()
Since
Qore 0.8.4

◆ get_qore_option_list()

list< hash< auto > > 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:
list<hash<auto>> l = get_qore_option_list();
See also
get_qore_option_hash()

◆ get_safe_url()

string Qore::get_safe_url ( string  url)

Returns the URL string passed without any password information.

Parameters
urlthe URL to process
Returns
the URL string passed without any password information
Since
Qore 1.13

◆ get_script_dir()

*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:
*string str = get_script_dir();

◆ get_script_name()

*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:
*string str = get_script_name();

◆ get_script_path()

*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:
*string str = get_script_path();

◆ get_word_16() [1/2]

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

◆ get_word_16() [2/2]

*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:
*int val = get_word_16(str, 2); # returns the third 2-byte (16-bit) value in the string
See also
get_word_16_lsb()

◆ get_word_16_lsb() [1/2]

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

◆ get_word_16_lsb() [2/2]

*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:
*int val = get_word_16_lsb(str, 2); # returns the third 2-byte (16-bit) value in the string
See also
get_word_16()

◆ get_word_32() [1/2]

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

◆ get_word_32() [2/2]

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

◆ get_word_32_lsb() [1/2]

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

◆ get_word_32_lsb() [2/2]

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

◆ get_word_64() [1/2]

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

◆ get_word_64() [2/2]

*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:
*int val = get_word_64(str, 4); # returns the third 8-byte (64-bit) value in the string
See also
get_word_64_lsb()

◆ get_word_64_lsb() [1/2]

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

◆ get_word_64_lsb() [2/2]

*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:
*int val = get_word_64_lsb(str, 4); # returns the third 8-byte (64-bit) value in the string
See also
get_word_64()

◆ getByte() [1/3]

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

◆ getByte() [2/3]

*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

◆ getByte() [3/3]

*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

◆ getClassName() [1/2]

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

◆ getClassName() [2/2]

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

◆ getFeatureList()

list< string > 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

◆ getModuleHash()

hash< string, hash< auto > > 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

◆ getModuleList()

list< hash< auto > > 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

◆ getWord32() [1/3]

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

◆ getWord32() [2/3]

*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

◆ getWord32() [3/3]

*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

◆ has_key() [1/2]

bool Qore::has_key ( hash< auto >  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:
bool b = has_key(hash, "key");
Note
no exception is thrown when checking an invalid key in a hashdecl-derived hash
Exceptions
ENCODING-CONVERSION-ERRORthis error is thrown if the given key cannot be converted to the default character encoding

◆ has_key() [2/2]

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:
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

◆ hash_values() [1/2]

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

◆ hash_values() [2/2]

list< auto > Qore::hash_values ( hash< auto >  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:
list<auto> vl = hash_values(vl);
Note
equivalent to <hash>::values()
See also
<hash>::keys()

◆ hextoint() [1/2]

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

◆ hextoint() [2/2]

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:
int i = hextoint("ab3d4e0f12");
Exceptions
PARSE-HEX-ERRORinvalid hex digit found

◆ html_decode() [1/2]

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

◆ html_decode() [2/2]

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:
string str = html_decode("&lt;hello&gt;"); # returns "<hello>"
Note
equivalent to <string>::getDecoded() with Qore::CD_HTML
See also
<string>::getDecoded()

◆ html_encode() [1/2]

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

◆ html_encode() [2/2]

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:
string str = html_encode("<hello>"); # returns "&lt;hello&gt;"
Note
equivalent to <string>::getEncoded() with Qore::CE_HTML
See also
<string>::getEncoded()

◆ load_module() [1/2]

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

◆ load_module() [2/2]

nothing Qore::load_module ( string  name,
int  warning_mask = WARN_MODULES 
)

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
warning_maskthe warning mask to use when loading the module; note that warnings are treated as errors
Example:
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
  • Qore 0.9 added the warning_mask parameter

◆ load_module_warn()

*hash< ExceptionInfo > Qore::load_module_warn ( string  name,
int  warning_mask = WARN_MODULES 
)

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
warning_maskthe warning mask to use when loading the module; note that warnings are treated as errors
Example:
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
  • Qore 0.9 added the warning_mask parameter

◆ load_user_module_with_program()

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:
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

◆ make_base64_string() [1/2]

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:
string base64 = make_base64_string(data, 64);
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeBase64String()

◆ make_base64_string() [2/2]

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:
string base64 = make_base64_string(data, 64);
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeBase64String()

◆ make_hex_string() [1/2]

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:
string str = make_hex_string(bin);
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeHexString()

◆ make_hex_string() [2/2]

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:
string str = make_hex_string(str2);
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case makeHexString()

◆ makeBase64String() [1/3]

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

◆ makeBase64String() [2/3]

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

◆ makeBase64String() [3/3]

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

◆ makeHexString() [1/3]

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

◆ makeHexString() [2/3]

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

◆ makeHexString() [3/3]

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

◆ parse() [1/2]

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

◆ parse() [2/2]

*hash< auto > 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_labelQore 0.9 is obsolete / ignored
Example:
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; Qore 0.9 the format_label is obsolete / ignored; these changes were made to align the functionality of this function with the Program::parse() and Program::parsePending() methods

◆ parse_base64_string()

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

◆ parse_base64_string_to_string()

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

◆ parse_hex_string()

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

◆ parse_url() [1/2]

hash< UrlInfo > Qore::parse_url ( string  url,
*int  options 
)

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
optionsa bitfield of URL Parsing Options
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; subject to percent decoding if QURL_DECODE passed in options
  • username: any username given in the URL; subject to percent decoding if QURL_DECODE or QURL_DECODE_PATH passed in options
  • password: any password given in the URL; subject to percent decoding if QURL_DECODE or QURL_DECODE_PATH passed in options
  • 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; subject to percent decoding if QURL_DECODE or QURL_DECODE_PATH passed in options
  • port: any port number given in the URL
Example:
hash<UrlInfo> h = parse_url(url_string, QURL_DECODE);
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(string, True); 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

◆ parse_url() [2/2]

hash< UrlInfo > Qore::parse_url ( string  url,
bool  keep_brackets 
)

Parses a URL string and returns a hash of the components.

Throws an exception if the string cannot be parsed as a URL; does not perform percent decoding

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 - not subjected to percent decoding (see note below)
  • username: any username given in the URL - not subjected to percent decoding (see note below)
  • password: any password given in the URL - not subjected to percent decoding (see note below)
  • 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:
hash<UrlInfo> h = parse_url(url_string, True);
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(string, True); 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.
  • none of the string fields returned here are subjected to percent decoding; to decode percent encoding, call decode_url() on the strings manually or use the parse_url(string, *int) variant with the QURL_DECODE or QURL_DECODE_PATH option
See also
parseURL() for a version of this function that does not throw exceptions if the URL cannot be parsed

◆ parseBase64String() [1/2]

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

◆ parseBase64String() [2/2]

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

◆ parseBase64StringToString() [1/2]

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

◆ parseBase64StringToString() [2/2]

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

◆ parseHexString() [1/2]

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

◆ parseHexString() [2/2]

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

◆ parseURL() [1/2]

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

◆ parseURL() [2/2]

*hash< UrlInfo > 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 - not subjected to percent decoding (see note below)
  • username: any username given in the URL - not subjected to percent decoding (see note below)
  • password: any password given in the URL - not subjected to percent decoding (see note below)
  • 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 - not subjected to percent decoding (see note below)
  • port: any port number given in the URL
Example:
*hash<UrlInfo> h = 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(string, True); 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.
  • none of the string fields returned here are subjected to percent decoding; to decode percent encoding, call decode_url() on the strings manually or use the parse_url(string, *int) variant with the QURL_DECODE or QURL_DECODE_PATH options
See also
parse_url() for a version of this function that throws exceptions if the URL cannot be parsed

◆ reload_module()

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:
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

◆ set_global_var_value()

nothing Qore::set_global_var_value ( string  name,
auto  value 
)

set the value of a global variable

Example:
nothing set_global_var_value(string name, auto value)
set the value of a global variable
Parameters
namethe name of the variable
valuethe value to assign
Exceptions
UNKNOWN-VARIABLEthe variable is not a global variable
Note
other exceptions could be thrown if the value cannot be assigned to the given variable
See also
Qore::Program::setGlobalVarValue()
Since
Qore 0.8.13

◆ set_local_var_value()

nothing Qore::set_local_var_value ( int  frame,
string  var,
auto  value 
)

sets the value of the given local variable; if the variable cannot be found an exception is raised

Restrictions:
MUST HAVE: Qore::PO_ALLOW_DEBUGGER
Example:
set_local_var_value(0, "var", 1);
nothing set_local_var_value(int frame, string var, auto value)
sets the value of the given local variable; if the variable cannot be found an exception is raised
Parameters
framethe stack frame where 0 is the current or highest stack frame
varthe name of the local variable
valuethe value to assign
Exceptions
UNKNOWN-VARIABLEthe given local variable is not present in the current stack frame
Note
  • other exceptions could be raised when making the assignment such as incompatible type exceptions
  • pure local variables (i.e. not closure bound and not subject to the reference operator) are not stored with type information at runtime; type information is only enforced at parse / compile time, therefore it's possible to set local variables with invalid values that contradict their declarations with this function
Since
Qore 0.8.13

◆ set_module_option()

nothing Qore::set_module_option ( string  module,
string  option,
auto  value 
)

set the given module option

Restrictions:
Qore::PO_NO_PROCESS_CONTROL
Example:
set_module_option(mod, opt, val);
nothing set_module_option(string module, string option, auto value)
set the given module option
Parameters
modulethe name of the module
optionthe name of the option
valuethe value to assign; setting to NOTHING removes the module option
See also
get_module_option()
Since
Qore 0.9

◆ set_return_value()

Qore::set_return_value ( auto  val)

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

Restrictions:
Qore::PO_NO_PROCESS_CONTROL
Example:
set_return_value(1);
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

◆ splice() [1/7]

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

◆ splice() [2/7]

list< auto > Qore::splice ( list< auto >  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:
list<auto> l = splice(l2, 5);
See also
the splice operator

◆ splice() [3/7]

list< auto > Qore::splice ( list< auto >  l,
softint  start,
softint  len 
)

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)
Returns
the processed list with elements removed and/or added according to the arguments
Example:
list<auto> l = splice(l2, 5, 7);
See also
the splice operator

◆ splice() [4/7]

list< auto > Qore::splice ( list< auto >  l,
softint  start,
softint  len,
softlist< auto >  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 new list for inserting new elements
Returns
the processed list with elements removed and/or added according to the arguments
Example:
list<auto> l = splice(l2, 5, 7, "hello");
See also
the splice operator

◆ splice() [5/7]

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 ""

◆ splice() [6/7]

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:
string str = splice(str2, 5);
See also
the splice operator

◆ splice() [7/7]

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:
string str = splice(str2, 5, 7, "hello");
See also
the splice operator

◆ strtoint() [1/2]

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

◆ strtoint() [2/2]

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:
int i = strtoint("41", 8);
Exceptions
STRTOINT-ERRORcannot parse string; unsupported base, etc