Qore Programming Language Reference Manual  1.8.0
Object Functions

Functions

auto Qore::callObjectMethod (object obj, string method,...)
 Calls a method of an object, passing the remainder of the arguments to the function as arguments to the method. More...
 
nothing Qore::callObjectMethod ()
 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::callObjectMethodArgs (object obj, string method, *softlist< auto > varg)
 Calls a method of an object, using the optional third argument as the argument list to the method. More...
 
nothing Qore::callObjectMethodArgs ()
 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_object_method (object obj, string method,...)
 Calls a method of an object, passing the remainder of the arguments to the function as arguments to the method. More...
 
auto Qore::call_object_method_args (object obj, string method, *softlist< auto > varg)
 Calls a method of an object, using the optional third argument as the argument list to the method. More...
 
auto Qore::call_pseudo (any val, string meth,...)
 calls a pseudo-method on the given value More...
 
auto Qore::call_pseudo_args (any val, string meth, *softlist< auto > argv)
 calls a pseudo-method on the given value with arguments given as a list More...
 
auto Qore::call_static_method (string class_name, string method,...)
 Calls a static method of an object, passing the arguments to the function as arguments to the method. More...
 
auto Qore::call_static_method_args (string class_name, string method, *softlist< auto > call_args)
 Calls a static method of an object, passing the arguments to the function as arguments to the method. More...
 
object Qore::create_object (string class_name,...)
 creates an object from the class name (which can include a namespace path) and optionally any arguments for the constructor More...
 
object Qore::create_object_args (string class_name, *softlist< auto > argv)
 creates an object from the class name (which can include a namespace path) and optionally any arguments for the constructor More...
 
list Qore::getMethodList (object obj)
 Returns a list of strings of the names of the methods of the class of the object passed as a parameter. More...
 
nothing Qore::getMethodList ()
 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::get_method_list (object obj)
 Returns a list of strings of the names of the methods of the class of the object passed as a parameter. More...
 

Detailed Description

Object functions

Function Documentation

◆ call_object_method()

auto Qore::call_object_method ( object  obj,
string  method,
  ... 
)

Calls a method of an object, passing the remainder of the arguments to the function as arguments to the method.

Parameters
objthe object to use for the call
methodthe method to call
...any additional arguments to the method
Returns
the value returned by the method call
Example:
auto result = call_object_method(obj, "method", arg1, arg2);
auto call_object_method(object obj, string method,...)
Calls a method of an object, passing the remainder of the arguments to the function as arguments to t...
Exceptions
METHOD-DOES-NOT-EXISTThe named method does not exist in this class
ILLEGAL-EXPLICIT-METHOD-CALLThe named method may not be called explicitly
METHOD-IS-PRIVATEThe named method is private and therefore can only be called within the class
BASE-CLASS-IS-PRIVATEThe named method is a member of a privately inherited base class
Note
the method called could cause additional exceptions to be thrown
Since
Qore 0.8.12 as a replacement for deprecated camel-case callObjectMethod()
See also

◆ call_object_method_args()

auto Qore::call_object_method_args ( object  obj,
string  method,
*softlist< auto >  varg 
)

Calls a method of an object, using the optional third argument as the argument list to the method.

Parameters
objthe object to use for the call
methodthe method to call
vargany additional arguments to the method
Returns
the value returned by the method call
Example:
auto result = call_object_method_args(obj, "method", arglist);
auto call_object_method_args(object obj, string method, *softlist< auto > varg)
Calls a method of an object, using the optional third argument as the argument list to the method.
Exceptions
METHOD-DOES-NOT-EXISTThe named method does not exist in this class
ILLEGAL-EXPLICIT-METHOD-CALLThe named method may not be called explicitly
METHOD-IS-PRIVATEThe named method is private and therefore can only be called within the class
BASE-CLASS-IS-PRIVATEThe named method is a member of a privately inherited base class
Note
the method called could cause additional exceptions to be thrown
Since
Qore 0.8.12 as a replacement for deprecated camel-case callObjectMethodArgs()
See also

◆ call_pseudo()

auto Qore::call_pseudo ( any  val,
string  meth,
  ... 
)

calls a pseudo-method on the given value

Parameters
valthe value to call the pseudo-method on
meththe string method name of the pseudo-method to call
...any other arguments to the method
Returns
the return value of the pseudo-method
See also
<value> for the class hierarchy of pseudo-classes
Note
this function can be used for security to ensure that a given pseudo-method of the <object> class is called, as by default if a method of the same name is implemented by the object's class, the class method will be called instead.
Since
Qore 0.8.5

◆ call_pseudo_args()

auto Qore::call_pseudo_args ( any  val,
string  meth,
*softlist< auto >  argv 
)

calls a pseudo-method on the given value with arguments given as a list

Parameters
valthe value to call the pseudo-method on
meththe string method name of the pseudo-method to call
argvany other arguments to the method
Returns
the return value of the pseudo-method
See also
<value> for the class hierarchy of pseudo-classes
Note
this function can be used for security to ensure that a given pseudo-method of the <object> class is called, as by default if a method of the same name is implemented by the object's class, the class method will be called instead.
Since
Qore 0.8.8

◆ call_static_method()

auto Qore::call_static_method ( string  class_name,
string  method,
  ... 
)

Calls a static method of an object, passing the arguments to the function as arguments to the method.

Example:
auto result = call_static_method("Namespace::Class::method", arg1, arg2);
auto call_static_method(string class_name, string method,...)
Calls a static method of an object, passing the arguments to the function as arguments to the method.
Parameters
class_namethe with an optional namespace prefix
methodthe static method to call
...any additional arguments to the method
Returns
the value returned by the method call
Exceptions
METHOD-DOES-NOT-EXISTThe named method does not exist in this class
ILLEGAL-EXPLICIT-METHOD-CALLThe named method may not be called explicitly
METHOD-IS-PRIVATEThe named method is private and therefore can only be called within the class
BASE-CLASS-IS-PRIVATEThe named method is a member of a privately inherited base class
Note
the method called could cause additional exceptions to be thrown
See also

◆ call_static_method_args()

auto Qore::call_static_method_args ( string  class_name,
string  method,
*softlist< auto >  call_args 
)

Calls a static method of an object, passing the arguments to the function as arguments to the method.

Example:
auto result = call_static_method_args("Namespace::Class::method", (arg1, arg2));
auto call_static_method_args(string class_name, string method, *softlist< auto > call_args)
Calls a static method of an object, passing the arguments to the function as arguments to the method.
Parameters
class_namethe with an optional namespace prefix
methodthe static method to call
call_argsany additional arguments to the method
Returns
the value returned by the method call
Exceptions
METHOD-DOES-NOT-EXISTThe named method does not exist in this class
ILLEGAL-EXPLICIT-METHOD-CALLThe named method may not be called explicitly
METHOD-IS-PRIVATEThe named method is private and therefore can only be called within the class
BASE-CLASS-IS-PRIVATEThe named method is a member of a privately inherited base class
Note
the method called could cause additional exceptions to be thrown
See also

◆ callObjectMethod() [1/2]

nothing Qore::callObjectMethod ( )

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

◆ callObjectMethod() [2/2]

auto Qore::callObjectMethod ( object  obj,
string  method,
  ... 
)

Calls a method of an object, passing the remainder of the arguments to the function as arguments to the method.

Code Flags:
DEPRECATED
Parameters
objthe object to use for the call
methodthe method to call
...any additional arguments to the method
Returns
the value returned by the method call
Example:
auto result = callObjectMethod(obj, "method", arg1, arg2);
auto callObjectMethod(object obj, string method,...)
Calls a method of an object, passing the remainder of the arguments to the function as arguments to t...
Exceptions
METHOD-DOES-NOT-EXISTThe named method does not exist in this class
ILLEGAL-EXPLICIT-METHOD-CALLThe named method may not be called explicitly
METHOD-IS-PRIVATEThe named method is private and therefore can only be called within the class
BASE-CLASS-IS-PRIVATEThe named method is a member of a privately inherited base class
Note
the method called could cause additional exceptions to be thrown
Deprecated:
use call_object_method(); camel-case function names were deprecated in Qore 0.8.12

◆ callObjectMethodArgs() [1/2]

nothing Qore::callObjectMethodArgs ( )

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

◆ callObjectMethodArgs() [2/2]

auto Qore::callObjectMethodArgs ( object  obj,
string  method,
*softlist< auto >  varg 
)

Calls a method of an object, using the optional third argument as the argument list to the method.

Code Flags:
DEPRECATED
Parameters
objthe object to use for the call
methodthe method to call
vargany additional arguments to the method
Returns
the value returned by the method call
Exceptions
METHOD-DOES-NOT-EXISTThe named method does not exist in this class
ILLEGAL-EXPLICIT-METHOD-CALLThe named method may not be called explicitly
METHOD-IS-PRIVATEThe named method is private and therefore can only be called within the class
BASE-CLASS-IS-PRIVATEThe named method is a member of a privately inherited base class
Note
the method called could cause additional exceptions to be thrown
Deprecated:
use call_object_method_args(); camel-case function names were deprecated in Qore 0.8.12

◆ create_object()

object Qore::create_object ( string  class_name,
  ... 
)

creates an object from the class name (which can include a namespace path) and optionally any arguments for the constructor

Example
object obj = create_object(class_name, arg1, arg2);
object create_object(string class_name,...)
creates an object from the class name (which can include a namespace path) and optionally any argumen...
Parameters
class_namethe name of the class to instantiate (can be prefixed with a namespace path)
...any other arguments to the constructor
Returns
the object created
Exceptions
CREATE-OBJECT-ERRORunknown class, class implements features restricted by current parse options / sandboxing restrictions
CONSTRUCTOR-IS-PRIVATEattempt to instantiate an object with a private constructor from outside the class
Note
see the class documentation for the class to be instantiated for a list of additional exceptions that can be thrown
See also
create_object_args()
Since
Qore 0.8.12

◆ create_object_args()

object Qore::create_object_args ( string  class_name,
*softlist< auto >  argv 
)

creates an object from the class name (which can include a namespace path) and optionally any arguments for the constructor

Example
object obj = create_object_args(class_name, arg_list);
object create_object_args(string class_name, *softlist< auto > argv)
creates an object from the class name (which can include a namespace path) and optionally any argumen...
Parameters
class_namethe name of the class to instantiate (can be prefixed with a namespace path)
argvany other arguments to the constructor
Returns
the object created
Exceptions
CREATE-OBJECT-ERRORunknown class, class implements features restricted by current parse options / sandboxing restrictions
CONSTRUCTOR-IS-PRIVATEattempt to instantiate an object with a private constructor from outside the class
Note
see the class documentation for the class to be instantiated for a list of additional exceptions that can be thrown
See also
create_object()
Since
Qore 0.8.12

◆ get_method_list()

list<string> Qore::get_method_list ( object  obj)

Returns a list of strings of the names of the methods of the class of the object passed as a parameter.

Code Flags:
CONSTANT
Parameters
objan object of the class to get the method list from
Returns
a list of strings of the names of the methods of the class of the object passed as a parameter; returns all methods in the class, both private and public but does not return inherited methods
Example:
list<string> l = get_method_list(obj);
list< string > get_method_list(object obj)
Returns a list of strings of the names of the methods of the class of the object passed as a paramete...
Since
Qore 0.8.12 as a replacement for deprecated camel-case getMethodList()

◆ getMethodList() [1/2]

nothing Qore::getMethodList ( )

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

◆ getMethodList() [2/2]

list Qore::getMethodList ( object  obj)

Returns a list of strings of the names of the methods of the class of the object passed as a parameter.

Code Flags:
CONSTANT, DEPRECATED
Parameters
objan object of the class to get the method list from
Returns
a list of strings of the names of the methods of the class of the object passed as a parameter; returns all methods in the class, both private and public but does not return inherited methods
Deprecated:
use get_method_list(); camel-case function names were deprecated in Qore 0.8.12