ValueBase class reference
[Base module]
Declaration
This abstract class is for internal use only.
#include <QtLua/ValueBase>
namespace QtLua {
class ValueBase;
};
This class is a member of the QtLua namespace.
This abstract class is declared in QtLua/qtluavaluebase.hh source file, line 59.
This abstract class contains pure virtuals.
Description
Members
Types
- enum Bool
- struct List
- enum Operation
- typedef [...] Operations
- enum ValueType
- struct const_iterator
- struct iterator
Private type
- class iterator_
Functions
- Value at(const Value &key) const
- template Value at(const T &key) const
- ValueBase::iterator begin()
- ValueBase::const_iterator begin() const
- ValueBase::List call(const ValueBase::List &args) const
- ValueBase::const_iterator cbegin() const
- ValueBase::const_iterator cend() const
- bool connect(QObject *obj, const char *signal)
- bool disconnect(QObject *obj, const char *signal)
- ValueBase::iterator end()
- ValueBase::const_iterator end() const
- State * get_state() const
- bool is_dead() const
- bool is_empty() const
- bool is_nil() const
- int len() const
- Ref<Iterator> new_iterator() const
- operator Bool() const
- template operator QHash<Key,Val>() const
- template operator QList<X>() const
- template operator QMap<Key,Val>() const
- operator QString() const
- operator QVariant() const
- template operator QVector<X>() const
- template operator Ref<X>() const
- operator String() const
- operator Value() const
- operator double() const
- operator float() const
- operator signed char() const
- operator signed int() const
- operator signed long() const
- operator signed short() const
- operator unsigned char() const
- operator unsigned int() const
- operator unsigned long() const
- operator unsigned short() const
- ValueBase::List operator()() const
- ValueBase::List operator()(const Value &arg1) const
- ValueBase::List operator()(const Value &arg1, const Value &arg2) const
- ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3) const
- ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4) const
- ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5) const
- ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5, const Value &arg6) const
- bool operator<(const Value &lv) const
- bool operator==(const Value &lv) const
- bool operator==(const String &str) const
- bool operator==(const char *str) const
- bool operator==(double n) const
- Value operator[](const Value &key) const
- template Value operator[](const T &key) const
- ValueRef operator[](const Value &key)
- template ValueRef operator[](const T &key)
- ValueBase::List start(const Value &main, const ValueBase::List &args) const
- bool support(ValueBase::Operation c) const
- void table_shift(int pos, int count, const Value &init, int len = [...])
- void table_shift(int pos, int count, int len = [...])
- ValueBase::Bool to_boolean() const
- QByteArray to_bytecode() const
- template X * to_class_cast() const
- template X * to_class_cast_null() const
- int to_integer() const
- double to_number() const
- template QHash<Key, Val> to_qhash() const
- template QList<X> to_qlist() const
- template QMap<Key, Val> to_qmap() const
- QObject * to_qobject() const
- template X * to_qobject_cast() const
- QString to_qstring() const
- QVariant to_qvariant() const
- QVariant to_qvariant(int qt_type) const
- template QVector<X> to_qvector() const
- String to_string() const
- String to_string_p(bool quote_string = [...]) const
- Ref<UserData> to_userdata() const
- template Ref<X> to_userdata_cast() const
- template Ref<X> to_userdata_cast_null() const
- ValueBase::ValueType type() const
- String type_name() const
- String type_name_u() const
Protected functions
- void check_state() const
- void convert_error(ValueBase::ValueType type) const
- virtual void push_value(lua_State *st) const = 0;
- template HashContainer to_hash() const
- template ListContainer to_list() const
- virtual Value value() const = 0;
Private functions
- ValueBase(const State *ls)
- virtual ~ValueBase()
Static function
- static String type_name(ValueBase::ValueType t)
Protected static functions
- static uint qHash(lua_State *st, int index)
- static String to_string_p(lua_State *st, int index, bool quote_string)
Protected fields
- static double _id_counter
- QPointer<State> _st
Members detail
ValueBase(const State *ls)
This constructor is declared in QtLua/qtluavaluebase.hh source file, line 66.
This member access is private.
This virtual destructor is declared in QtLua/qtluavaluebase.hh source file, line 68.
This member access is private.
This enum is declared in QtLua/qtluavaluebase.hh source file, line 248.
Boolean type used for Value constructor.
The native C++ bool type is not used here due to implicit cast between bool and pointers which prevent proper constructor overloading.
Identifier | Value | Description |
---|---|---|
False | 0 | |
True | 1 |
This enum is declared in QtLua/qtluavaluebase.hh source file, line 169.
Specify lua operations performed on lua values.
Identifier | Value | Description |
---|---|---|
OpAdd | 0x0001 | Lua add binary operator + |
OpSub | 0x0002 | Lua subtract binary operator - |
OpMul | 0x0004 | Lua multiply binary operator * |
OpDiv | 0x0008 | Lua divied binary operator / |
OpMod | 0x0010 | Lua modulo binary operator % |
OpPow | 0x0020 | Lua power binary operator ^ |
OpUnm | 0x0040 | Lua negative unary operator - |
OpConcat | 0x0080 | Lua concatenation binary operator .. |
OpLen | 0x0100 | Lua length unary operator # |
OpEq | 0x0200 | Lua equal binary operator == |
OpLt | 0x0400 | Lua less than binary operator < |
OpLe | 0x0800 | Lua less than or equal binary operator <= |
OpIndex | 0x1000 | Table index operation |
OpNewindex | 0x2000 | Table newindex operation |
OpCall | 0x4000 | Function call operation |
OpIterate | 0x8000 | Iteration operation |
OpAll | 0xffff | All operations mask |
See also UserData::meta_operation function, UserData::support function and ValueBase::Operations typedef.
typedef ValueBase::Operation Operations
This typedef is declared in QtLua/qtluavaluebase.hh source file, line 191.
This enum is declared in QtLua/qtluavaluebase.hh source file, line 152.
Specify lua value types. This is the same as LUA_T* macros defined in lua headers
Identifier | Value | Description |
---|---|---|
TNone | -1 | No type |
TNil | 0 | Nil value |
TBool | 1 | Boolean value |
TNumber | 3 | Number value |
TString | 4 | String value |
TTable | 5 | Lua table value |
TFunction | 6 | Lua function value |
TUserData | 7 | Lua userdata value |
TThread | 8 | Lua thread value |
This function is declared in QtLua/qtluavaluebase.hh source file, line 442.
Index operation on a lua userdata or lua table value.
template <typename T> Value at(const T &key) const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 445.
Index operation on a lua userdata or lua table value.
ValueBase::iterator begin()
This function is declared in QtLua/qtluavaluebase.hh source file, line 269.
Get an ValueBase::iterator to traverse a lua userdata or lua table value.
ValueBase::const_iterator begin() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 273.
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
This function is declared in QtLua/qtluavaluebase.hh source file, line 255.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::const_iterator cbegin() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 275.
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
ValueBase::const_iterator cend() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 276.
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
bool connect(QObject *obj, const char *signal)
This function is declared in QtLua/qtluavaluebase.hh source file, line 543.
Connect a QObject signal to a lua value. The value will be called when the signal is emited.
See also ValueBase::disconnect function, QObject::connect and QObject wrapping section.
bool disconnect(QObject *obj, const char *signal)
This function is declared in QtLua/qtluavaluebase.hh source file, line 551.
Disconnect a QObject signal from a lua value.
See also ValueBase::connect function, QObject::disconnect and QObject wrapping section.
ValueBase::iterator end()
This function is declared in QtLua/qtluavaluebase.hh source file, line 270.
Get an ValueBase::iterator to traverse a lua userdata or lua table value.
ValueBase::const_iterator end() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 274.
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
State * get_state() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 534.
Get associated lua state.
This function is declared in QtLua/qtluavaluebase.hh source file, line 482.
Returns true if the value is a coroutine which is not resumable. This function always returns false if State::lua_version() returns a value less than 501.
This function is declared in QtLua/qtluavaluebase.hh source file, line 477.
Check if a table or userdata contains at leasts one entry. For lua tables this is different from comparing the result of the ValueBase::len function with zero because this function will return true even if the table keys are not integers.
This function is declared in QtLua/qtluavaluebase.hh source file, line 471.
Check if the value is nil
This function is declared in QtLua/qtluavaluebase.hh source file, line 503.
Return the lua len of tables and strings. Return the result of the ValueBase::OpLen operation on UserData objects if ValueBase::OpLen is supported.
This function is declared in QtLua/qtluavaluebase.hh source file, line 280.
Return an Iterator object suitable to iterate over lua value. This works for lua tables and UserData objects.
This function is declared in QtLua/qtluavaluebase.hh source file, line 305.
Convert a lua value to a boolean. Throw exception if conversion fails.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 348.
Create a QHash with elements from lua table.
See also Qt/Lua types conversion section.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 327.
Create a QList with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 358.
Create a QMap with elements from lua table.
See also Qt/Lua types conversion section.
This function is declared in QtLua/qtluavaluebase.hh source file, line 312.
Convert a lua string value to a String object. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 431.
Convert a bool, string or number value to a QVariant. The ValueBase::to_qvariant alternate function can be used to attempt a conversion of the value to a specified registered Qt type.
See also Qt/Lua types conversion section.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 338.
Create a QVector with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 406.
See also ValueBase::to_userdata_cast function.
This function is declared in QtLua/qtluavaluebase.hh source file, line 311.
Convert a lua string value to a String object. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 282.
This function is declared in QtLua/qtluavaluebase.hh source file, line 287.
Convert a lua number value to a double. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 288.
Convert a lua number value to a double. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 293.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 297.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 299.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 295.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 294.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 298.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 300.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 296.
Convert a lua number value to an integer. Throw exception if conversion fails.
ValueBase::List operator()() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 256.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
This function is declared in QtLua/qtluavaluebase.hh source file, line 257.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
This function is declared in QtLua/qtluavaluebase.hh source file, line 258.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
This function is declared in QtLua/qtluavaluebase.hh source file, line 259.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 260.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 261.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5, const Value &arg6) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 262.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
bool operator<(const Value &lv) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 517.
Compare two lua values. This function may not give the same result as the lua compare operation depending on value type. This function is designed to be used by ordered containers like QMap. This function can compare values of different types and never fails.
bool operator==(const Value &lv) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 524.
Compare two lua values. This function may not give the same result as the lua compare operation depending on value type. UserData values are considered equals if pointing to the same object. Other values are compared using the lua_rawequal function of the lua API. This function never fails.
bool operator==(const String &str) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 527.
Compare the lua value with the given string.
This function is declared in QtLua/qtluavaluebase.hh source file, line 529.
Compare the lua value with the given C string.
This function is declared in QtLua/qtluavaluebase.hh source file, line 531.
Compare the lua value with the given number.
This function is declared in QtLua/qtluavaluebase.hh source file, line 453.
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
template <typename T> Value operator[](const T &key) const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 458.
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
This function is declared in QtLua/qtluavaluebase.hh source file, line 463.
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
template <typename T> ValueRef operator[](const T &key)
This template function is declared in QtLua/qtluavaluebase.hh source file, line 468.
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
This function is declared in QtLua/qtluavaluebase.hh source file, line 266.
This function starts execution of a lua thread value. Resume after yield can be performed by invocation of the ValueBase::call function.
bool support(ValueBase::Operation c) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 511.
Check given operation support.
See also UserData::support function.
void table_shift(int pos, int count, const Value &init, int len = -1)
This function is declared in QtLua/qtluavaluebase.hh source file, line 507.
Make room in a lua table at given position if count > 0 or remove entries if count < 0.
This function is declared in QtLua/qtluavaluebase.hh source file, line 508.
Make room in a lua table at given position if count > 0 or remove entries if count < 0.
ValueBase::Bool to_boolean() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 304.
Convert a lua value to a boolean. Throw exception if conversion fails.
QByteArray to_bytecode() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 485.
Dump the bytecode for a function object
This template function is declared in QtLua/qtluavaluebase.hh source file, line 422.
Convert a lua value into a Ref pointer to an UserData and perform a dynamic_cast<X*>. Throw exception if either conversion fails, pointer is null or cast fails.
See also ValueBase::to_class_cast_null function.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 414.
Convert a lua value into a Ref pointer to an UserData and perform a dynamic_cast<X*>. Throw exception if conversion or cast fails.
See also ValueBase::to_class_cast function.
This function is declared in QtLua/qtluavaluebase.hh source file, line 292.
Convert a lua number value to an integer. Throw exception if conversion fails.
This function is declared in QtLua/qtluavaluebase.hh source file, line 286.
Convert a lua number value to a double. Throw exception if conversion fails.
template <typename Key, typename Val> QHash<Key, Val> to_qhash() const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 346.
Create a QHash with elements from lua table.
See also Qt/Lua types conversion section.
template <typename X> QList<X> to_qlist() const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 325.
Create a QList with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
template <typename Key, typename Val> QMap<Key, Val> to_qmap() const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 356.
Create a QMap with elements from lua table.
See also Qt/Lua types conversion section.
QObject * to_qobject() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 365.
Convert a lua value to a QObject pointer. Throw exception if conversion or cast fails.
See also ValueBase::to_qobject_cast function.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 374.
Convert a lua value to a QObject subclass pointer. Subclass must have the Q_OBJECT macro in it's definition. Throw exception if conversion or cast fails.
See also ValueBase::to_qobject function.
QString to_qstring() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 310.
Convert a lua string value to a String object. Throw exception if conversion fails.
QVariant to_qvariant() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 430.
Convert a bool, string or number value to a QVariant. The ValueBase::to_qvariant alternate function can be used to attempt a conversion of the value to a specified registered Qt type.
See also Qt/Lua types conversion section.
QVariant to_qvariant(int qt_type) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 439.
Convert a lua value to a QVariant. The lua value will be converted to an object of requested Qt type if possible.
See also Qt/Lua types conversion section.
template <typename X> QVector<X> to_qvector() const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 336.
Create a QVector with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
String to_string() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 309.
Convert a lua string value to a String object. Throw exception if conversion fails.
String to_string_p(bool quote_string = true) const
This function is declared in QtLua/qtluavaluebase.hh source file, line 316.
Convert any type to a string representation suitable for pretty printing. Never throw.
This function is declared in QtLua/qtluavaluebase.hh source file, line 382.
Convert a lua value into a Ref pointer to an UserData. Throw exception if conversion fails.
See also ValueBase::to_userdata_cast_null function and ValueBase::to_userdata_cast function.
template <typename X> Ref<X> to_userdata_cast() const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 402.
Convert a lua value into a Ref pointer to an UserData and dynamic cast to given Ref pointer to requested type. Throw exception if either conversion fails, pointer is null or cast fails.
See also ValueBase::to_userdata function and ValueBase::to_userdata_cast function.
template <typename X> Ref<X> to_userdata_cast_null() const
This template function is declared in QtLua/qtluavaluebase.hh source file, line 392.
Convert a lua value into a Ref pointer to an UserData and dynamic cast to given Ref pointer to requested type. Throw exception if conversion or cast fails.
See also ValueBase::to_userdata function and ValueBase::to_userdata_cast function.
ValueBase::ValueType type() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 488.
Get lua value type.
String type_name() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 491.
Get value raw lua type name.
This function is declared in QtLua/qtluavaluebase.hh source file, line 494.
Get value raw lua type name.
String type_name_u() const
This function is declared in QtLua/qtluavaluebase.hh source file, line 498.
Get value type name, if the value is a UserData, the type name is extracted using the UserData::get_type_name function.
This variable is for internal use only.
This variable is declared in QtLua/qtluavaluebase.hh source file, line 581.
This member access is protected.
This variable is for internal use only.
This variable is declared in QtLua/qtluavaluebase.hh source file, line 579.
This member access is protected.
This function is for internal use only.
This function is declared in QtLua/qtluavaluebase.hh source file, line 576.
This member access is protected.
void convert_error(ValueBase::ValueType type) const
This function is for internal use only.
This function is declared in QtLua/qtluavaluebase.hh source file, line 574.
This member access is protected.
This pure virtual function is for internal use only.
This pure virtual function is declared in QtLua/qtluavaluebase.hh source file, line 563.
This member access is protected.
static uint qHash(lua_State *st, int index)
This function is for internal use only.
This function is declared in QtLua/qtluavaluebase.hh source file, line 571.
This member access is protected.
This template function is for internal use only.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 556.
This member access is protected.
This template function is for internal use only.
This template function is declared in QtLua/qtluavaluebase.hh source file, line 560.
This member access is protected.
static String to_string_p(lua_State *st, int index, bool quote_string)
This function is for internal use only.
This function is declared in QtLua/qtluavaluebase.hh source file, line 568.
This member access is protected.
virtual Value value() const = 0;
This pure virtual function is for internal use only.
This pure virtual function is declared in QtLua/qtluavaluebase.hh source file, line 565.
This member access is protected.