An implicitly shared discriminated union. More...
#include <tvariant.h>
Public Types | |
enum | Type { Void , Bool , Int , UInt , LongLong , ULongLong , Double , String , StringList , ByteVector , ByteVectorList , VariantList , VariantMap } |
Public Member Functions | |
Variant () | |
Variant (int val) | |
Variant (unsigned int val) | |
Variant (long long val) | |
Variant (unsigned long long val) | |
Variant (bool val) | |
Variant (double val) | |
Variant (const char *val) | |
Variant (const TagLib::String &val) | |
Variant (const TagLib::StringList &val) | |
Variant (const TagLib::ByteVector &val) | |
Variant (const TagLib::ByteVectorList &val) | |
Variant (const TagLib::List< TagLib::Variant > &val) | |
Variant (const TagLib::Map< TagLib::String, TagLib::Variant > &val) | |
Variant (const Variant &v) | |
~Variant () | |
Type | type () const |
bool | isEmpty () const |
int | toInt (bool *ok=nullptr) const |
unsigned int | toUInt (bool *ok=nullptr) const |
long long | toLongLong (bool *ok=nullptr) const |
unsigned long long | toULongLong (bool *ok=nullptr) const |
bool | toBool (bool *ok=nullptr) const |
double | toDouble (bool *ok=nullptr) const |
TagLib::String | toString (bool *ok=nullptr) const |
TagLib::StringList | toStringList (bool *ok=nullptr) const |
TagLib::ByteVector | toByteVector (bool *ok=nullptr) const |
TagLib::ByteVectorList | toByteVectorList (bool *ok=nullptr) const |
TagLib::List< TagLib::Variant > | toList (bool *ok=nullptr) const |
TagLib::Map< TagLib::String, TagLib::Variant > | toMap (bool *ok=nullptr) const |
template<typename T > | |
T | value (bool *ok=nullptr) const |
bool | operator== (const Variant &v) const |
bool | operator!= (const Variant &v) const |
Variant & | operator= (const Variant &v) |
Friends | |
TAGLIB_EXPORT std::ostream & | operator<< (std::ostream &s, const TagLib::Variant &v) |
Related Functions | |
(Note that these are not member functions.) | |
TAGLIB_EXPORT std::ostream & | operator<< (std::ostream &s, const TagLib::Variant &v) |
An implicitly shared discriminated union.
This is an implicitly shared discriminated union.
The use of implicit sharing means that copying a variant is cheap. These Variant objects are immutable (have only const methods).
TagLib::Variant::Variant | ( | ) |
Constructs an empty Variant.
TagLib::Variant::Variant | ( | int | val | ) |
TagLib::Variant::Variant | ( | unsigned int | val | ) |
TagLib::Variant::Variant | ( | long long | val | ) |
TagLib::Variant::Variant | ( | unsigned long long | val | ) |
TagLib::Variant::Variant | ( | bool | val | ) |
TagLib::Variant::Variant | ( | double | val | ) |
TagLib::Variant::Variant | ( | const char * | val | ) |
TagLib::Variant::Variant | ( | const TagLib::String & | val | ) |
TagLib::Variant::Variant | ( | const TagLib::StringList & | val | ) |
TagLib::Variant::Variant | ( | const TagLib::ByteVector & | val | ) |
TagLib::Variant::Variant | ( | const TagLib::ByteVectorList & | val | ) |
TagLib::Variant::Variant | ( | const TagLib::List< TagLib::Variant > & | val | ) |
TagLib::Variant::Variant | ( | const TagLib::Map< TagLib::String, TagLib::Variant > & | val | ) |
TagLib::Variant::Variant | ( | const Variant & | v | ) |
Make a shallow, implicitly shared, copy of v. Because this is implicitly shared, this method is lightweight and suitable for pass-by-value usage.
TagLib::Variant::~Variant | ( | ) |
Destroys this Variant instance.
bool TagLib::Variant::isEmpty | ( | ) | const |
Returns true
if the Variant is empty.
bool TagLib::Variant::operator!= | ( | const Variant & | v | ) | const |
Returns true
if the Variant and v differ in type or value.
Performs a shallow, implicitly shared, copy of v, overwriting the Variant's current data.
bool TagLib::Variant::operator== | ( | const Variant & | v | ) | const |
Returns true
if the Variant and v are of the same type and contain the same value.
bool TagLib::Variant::toBool | ( | bool * | ok = nullptr | ) | const |
TagLib::ByteVector TagLib::Variant::toByteVector | ( | bool * | ok = nullptr | ) | const |
TagLib::ByteVectorList TagLib::Variant::toByteVectorList | ( | bool * | ok = nullptr | ) | const |
double TagLib::Variant::toDouble | ( | bool * | ok = nullptr | ) | const |
int TagLib::Variant::toInt | ( | bool * | ok = nullptr | ) | const |
TagLib::List< TagLib::Variant > TagLib::Variant::toList | ( | bool * | ok = nullptr | ) | const |
long long TagLib::Variant::toLongLong | ( | bool * | ok = nullptr | ) | const |
TagLib::Map< TagLib::String, TagLib::Variant > TagLib::Variant::toMap | ( | bool * | ok = nullptr | ) | const |
TagLib::String TagLib::Variant::toString | ( | bool * | ok = nullptr | ) | const |
TagLib::StringList TagLib::Variant::toStringList | ( | bool * | ok = nullptr | ) | const |
unsigned int TagLib::Variant::toUInt | ( | bool * | ok = nullptr | ) | const |
unsigned long long TagLib::Variant::toULongLong | ( | bool * | ok = nullptr | ) | const |
template TAGLIB_EXPORT VariantMap TagLib::Variant::value | ( | bool * | ok = nullptr | ) | const |
|
related |
Send the variant to an output stream.
|
friend |