Classes

The Error Class

class Error : public std::exception

An error thrown by the interfaces of the TOML library.

Public Types

enum class Type

The type of the error.

Values:

enumerator Generic

A generic error.

enumerator Syntax

An error with the syntax of the document.

enumerator Encoding

A low-level encoding error.

enumerator IO

A IO error while reading from a device.

Public Functions

Error() noexcept = default

Create a generic error with no message.

explicit Error(QString message) noexcept

Create a generic error.

Parameters:

message – A string containing the error message.

inline auto document() const noexcept -> QString

Get the document of the error.

For strings, the document is [string], for byte data it is [data] and for files is the path to the file as it was passed to the parser.

Returns:

The document for the error.

auto toString() const noexcept -> QString

Convert the error into a string.

Returns:

A string with all information of this error message.

Public Static Functions

static auto createIO(const QString &document, const QIODevice &ioDevice) noexcept -> Error

Creates an IO error with a specified document and IO device.

Parameters:
  • document – The document that caused the error (e.g. file path).

  • ioDevice – The QIODevice that caused the error. Error message is copied from this device.

Returns:

A new instance with the specified properties.

static auto createEncoding(const QString &document, Location location) noexcept -> Error

Creates an Encoding error with a specified document, line, and column.

Parameters:
  • document – The document that caused the error (e.g. file path).

  • location – The location of the error.

Returns:

A new instance with the specified properties.

static auto createSyntax(const QString &document, Location location, const QString &message) noexcept -> Error

Creates a Syntax error with a specified document, line, column, and message.

Parameters:
  • document – The document that caused the error (e.g. file path).

  • location – The location of the error.

  • message – The message of this error.

Returns:

A new instance with the specified properties.

The InputStream Class

class InputStream

A generic input stream to make this code more portable.

You can subclass this interface to implement a own stream source. If you subclass this interface, please use the Custom type.

Public Types

enum class Type

The type of this input stream.

Values:

enumerator String

Streaming from a string.

enumerator Data

Streaming from a block of byte data.

enumerator File

Streaming from a file.

enumerator Custom

A user implemented stream.

Public Functions

virtual ~InputStream() = default

dtor

inline auto type() noexcept -> Type

Get the type of this input stream.

virtual auto atEnd() noexcept -> bool = 0

Test if we reached the end of the stream.

Returns:

true if the end of the stream is reached.

virtual auto readOrThrow() -> Char = 0

Get the next unicode character from the stream

Throws:

Error – if there is an encoding error in the data or an IO error while reading the file.

Returns:

The unicode character.

virtual auto document() const noexcept -> QString = 0

Get a document string for an exception.

Public Static Functions

static auto createFromString(const QString &text) noexcept -> InputStreamPtr

Create a new input stream from the given text.

Parameters:

text – The text.

Returns:

The input stream.

static auto createFromData(const QByteArray &data) noexcept -> InputStreamPtr

Create a new input stream from given UTF-8 encoded binary data.

Parameters:

data – The data.

Returns:

The input stream.

static auto createFromFileOrThrow(const QString &path) -> InputStreamPtr

Create a new input stream for a file.

Parameters:

path – The path to the file.

Throws:

Error – if the file does not exist or cannot be opened.

Returns:

The input stream.

The Char Class

class Char

A 32bit unicode character.

Public Functions

inline explicit constexpr Char(char32_t value) noexcept

Create a new char from its unicode code point.

Parameters:

value – The unicode value.

Char() noexcept = default

Create a zero character.

inline constexpr auto operator==(Char other) const noexcept -> bool

Compare this character with another.

Parameters:

other – The other character for the comparison.

Returns:

The result of the comparison.

inline constexpr auto operator!=(Char other) const noexcept -> bool

Compare this character with another.

Parameters:

other – The other character for the comparison.

Returns:

The result of the comparison.

inline constexpr auto operator>(Char other) const noexcept -> bool

Compare this character with another.

Parameters:

other – The other character for the comparison.

Returns:

The result of the comparison.

inline constexpr auto operator>=(Char other) const noexcept -> bool

Compare this character with another.

Parameters:

other – The other character for the comparison.

Returns:

The result of the comparison.

inline constexpr auto operator<(Char other) const noexcept -> bool

Compare this character with another.

Parameters:

other – The other character for the comparison.

Returns:

The result of the comparison.

inline constexpr auto operator<=(Char other) const noexcept -> bool

Compare this character with another.

Parameters:

other – The other character for the comparison.

Returns:

The result of the comparison.

inline constexpr auto operator==(char asciiChar) const noexcept -> bool

Compare this character with an ascii character.

Parameters:

asciiChar – The ascii character.

Returns:

The result of the comparison.

inline constexpr auto operator!=(char asciiChar) const noexcept -> bool

Compare this character with an ascii character.

Parameters:

asciiChar – The ascii character.

Returns:

The result of the comparison.

inline constexpr auto operator<(char asciiChar) const noexcept -> bool

Compare this character with an ascii character.

Parameters:

asciiChar – The ascii character.

Returns:

The result of the comparison.

inline constexpr auto operator<=(char asciiChar) const noexcept -> bool

Compare this character with an ascii character.

Parameters:

asciiChar – The ascii character.

Returns:

The result of the comparison.

inline constexpr auto operator>(char asciiChar) const noexcept -> bool

Compare this character with an ascii character.

Parameters:

asciiChar – The ascii character.

Returns:

The result of the comparison.

inline constexpr auto operator>=(char asciiChar) const noexcept -> bool

Compare this character with an ascii character.

Parameters:

asciiChar – The ascii character.

Returns:

The result of the comparison.

template<typename Int, std::enable_if_t<std::is_integral_v<Int>, bool> = true>
inline constexpr auto operator==(Int anyInteger) const noexcept -> bool

Compare this characters code point with an integer value.

Template Parameters:

Int – The integer type.

Parameters:

anyInteger – The integer for the comparison.

Returns:

The result of the comparison.

template<typename Int, std::enable_if_t<std::is_integral_v<Int>, bool> = true>
inline constexpr auto operator!=(Int anyInteger) const noexcept -> bool

Compare this characters code point with an integer value.

Template Parameters:

Int – The integer type.

Parameters:

anyInteger – The integer for the comparison.

Returns:

The result of the comparison.

template<typename Int, std::enable_if_t<std::is_integral_v<Int>, bool> = true>
inline constexpr auto operator>(Int anyInteger) const noexcept -> bool

Compare this characters code point with an integer value.

Template Parameters:

Int – The integer type.

Parameters:

anyInteger – The integer for the comparison.

Returns:

The result of the comparison.

template<typename Int, std::enable_if_t<std::is_integral_v<Int>, bool> = true>
inline constexpr auto operator>=(Int anyInteger) const noexcept -> bool

Compare this characters code point with an integer value.

Template Parameters:

Int – The integer type.

Parameters:

anyInteger – The integer for the comparison.

Returns:

The result of the comparison.

template<typename Int, std::enable_if_t<std::is_integral_v<Int>, bool> = true>
inline constexpr auto operator<(Int anyInteger) const noexcept -> bool

Compare this characters code point with an integer value.

Template Parameters:

Int – The integer type.

Parameters:

anyInteger – The integer for the comparison.

Returns:

The result of the comparison.

template<typename Int, std::enable_if_t<std::is_integral_v<Int>, bool> = true>
inline constexpr auto operator<=(Int anyInteger) const noexcept -> bool

Compare this characters code point with an integer value.

Template Parameters:

Int – The integer type.

Parameters:

anyInteger – The integer for the comparison.

Returns:

The result of the comparison.

inline constexpr auto isNull() const noexcept -> bool

Test if this is a null character.

inline constexpr auto isValidUnicode() const noexcept -> bool

Test if this character is a valid unicode character.

inline constexpr auto toAscii() const noexcept -> char

If possible, covert the unicode character to an ascii character.

Returns:

The ascii character, or if the unicode character is >0x7f, zero is returned.

inline void appendToString(QString &str) const noexcept

Append this character to a QString.

Parameters:

str – The string to append this character.

The Location Class

class Location

The location in document.

Public Types

using Format = LocationFormat

A local name for the enum.

Public Functions

inline constexpr Location(int64_t index, int64_t line, int64_t column) noexcept

Create a new location.

Parameters:
  • index – The character index in the stream, starts from zero.

  • line – The line number in the document, starts from one.

  • column – The column number in the document, starts from one.

constexpr Location() noexcept = default

Create a location with row 1, column 1 and index 0.

inline constexpr auto index() const noexcept -> int64_t

Get the index of the location.

Note

Do not confuse this with the byte index.

Returns:

The character index in the current document, starting from zero.

inline constexpr auto line() const noexcept -> int64_t

Get the line of the location.

Returns:

The line, starting from one.

inline constexpr auto column() const noexcept -> int64_t

Get the column of the location.

Returns:

The column, starting from one.

inline constexpr auto operator==(const Location &other) const noexcept -> bool

Compare two locations.

When comparing two locations for equality, all three parts (index, line and column) are compared. When locations are compared to see if they are greater or less, the index is mainly compared and only when the index is equal, line and column are also compared too. While it makes no sense to compare locations from two different files, by comparing all elements the behaviour when used as key is well defined.

Parameters:

other – The other location to compare.

Returns:

The comparison result.

inline constexpr auto operator!=(const Location &other) const noexcept -> bool

Compare two locations.

When comparing two locations for equality, all three parts (index, line and column) are compared. When locations are compared to see if they are greater or less, the index is mainly compared and only when the index is equal, line and column are also compared too. While it makes no sense to compare locations from two different files, by comparing all elements the behaviour when used as key is well defined.

Parameters:

other – The other location to compare.

Returns:

The comparison result.

inline constexpr auto operator<(const Location &other) const noexcept -> bool

Compare two locations.

When comparing two locations for equality, all three parts (index, line and column) are compared. When locations are compared to see if they are greater or less, the index is mainly compared and only when the index is equal, line and column are also compared too. While it makes no sense to compare locations from two different files, by comparing all elements the behaviour when used as key is well defined.

Parameters:

other – The other location to compare.

Returns:

The comparison result.

inline constexpr auto operator<=(const Location &other) const noexcept -> bool

Compare two locations.

When comparing two locations for equality, all three parts (index, line and column) are compared. When locations are compared to see if they are greater or less, the index is mainly compared and only when the index is equal, line and column are also compared too. While it makes no sense to compare locations from two different files, by comparing all elements the behaviour when used as key is well defined.

Parameters:

other – The other location to compare.

Returns:

The comparison result.

inline constexpr auto operator>(const Location &other) const noexcept -> bool

Compare two locations.

When comparing two locations for equality, all three parts (index, line and column) are compared. When locations are compared to see if they are greater or less, the index is mainly compared and only when the index is equal, line and column are also compared too. While it makes no sense to compare locations from two different files, by comparing all elements the behaviour when used as key is well defined.

Parameters:

other – The other location to compare.

Returns:

The comparison result.

inline constexpr auto operator>=(const Location &other) const noexcept -> bool

Compare two locations.

When comparing two locations for equality, all three parts (index, line and column) are compared. When locations are compared to see if they are greater or less, the index is mainly compared and only when the index is equal, line and column are also compared too. While it makes no sense to compare locations from two different files, by comparing all elements the behaviour when used as key is well defined.

Parameters:

other – The other location to compare.

Returns:

The comparison result.

inline constexpr auto isNotSet() const noexcept -> bool

Test if an element of this location is negative, indicating it is not set.

Returns:

true if any of the values index, line or column is negative.

void increment(bool isNewLine) noexcept

Increment the location by one character.

Parameters:

isNewLine – If a newline was read. In this case the line is incremented and the column is set to one.

auto toString(Format format) const noexcept -> QString

Convert this location into a string.

Parameters:

format – The format of the output.

Returns:

A string with the format.

Public Static Functions

static inline constexpr auto createNotSet() noexcept -> Location

Create a location that is not set.

The LocationRange Class

class LocationRange

The range covered by two locations in a file.

Public Functions

inline constexpr LocationRange(const Location &begin, const Location &end) noexcept

Create a new location range.

Parameters:
  • begin – The beginning location.

  • end – The ending location.

constexpr LocationRange() noexcept = default

Create a location range 1:1(0)-1:1(0).

inline constexpr auto begin() const noexcept -> const Location&

Get the beginning of the location range.

Returns:

The beginning location.

inline constexpr auto end() const noexcept -> const Location&

Get the end of the location range.

Returns:

The ending location.

inline constexpr auto operator==(const LocationRange &other) const noexcept -> bool

Compare two location ranges.

Parameters:

other – The other location range for comparison.

Returns:

The result of the comparison.

inline constexpr auto operator!=(const LocationRange &other) const noexcept -> bool

Compare two location ranges.

Parameters:

other – The other location range for comparison.

Returns:

The result of the comparison.

void extend(const LocationRange &other) noexcept

Extend the current location range.

Parameters:

other – The other location range to extend with.

void extend(const Location &loc) noexcept

Extend the current location range.

Parameters:

loc – The location to extend with.

auto toString(LocationFormat format) const noexcept -> QString

Convert this location range into a string.

Parameters:

format – The format of the output.

Returns:

A string with the format.

Public Static Functions

static inline constexpr auto createNotSet() noexcept -> LocationRange

Create a location range that is not set.

The Parser Class

class Parser

The TOML parser.

Public Functions

explicit Parser(Specification specification = Specification::Version_1_0) noexcept

Create a new parser.

Parameters:

specification – The version of the specification to use for parsing. Do not specify this value, unless you have fixed requirements for the parsed file. The default value in this library will always be set to the latest official release of the TOML specification.

~Parser()

dtor

auto parseStringOrThrow(const QString &str) -> ValuePtr

Parse TOML data from a string.

Parameters:

str – The string with the TOML data to parse.

Throws:

Error – in case of any problem when parsing the data.

Returns:

A value that contains the parsed TOML data. This is always the special root table.

auto parseDataOrThrow(const QByteArray &data) -> ValuePtr

Parse TOML data from UTF-8 encoded data.

Parameters:

data – UTF-8 encoded data with TOML to parse.

Throws:

Error – in case of any problem when parsing the data.

Returns:

A value that contains the parsed TOML data. This is always the special root table.

auto parseFileOrThrow(const QString &path) -> ValuePtr

Parse TOML data from a file.

This function opens the file at path read-only, and reads the file as stream. It is the most efficient way to read TOML data from a file.

Parameters:

path – The absolute path to the file.

Throws:

Error – in case of any problem when parsing the data. If there is a problem with the file, an Error::Type::IO error is thrown, that contains a description of the issue.

Returns:

A value that contains the parsed TOML data. This is always the special root table.

auto parseStreamOrThrow(const InputStreamPtr &inputStream) -> ValuePtr

Parse TOML data from an input stream.

This function reads and parses data from the given input stream.

Parameters:

inputStream – The input stream.

Throws:

Error – from the stream implementation and on any problem with the data.

Returns:

A value that contains the parsed TOML data. This is always the special root table.

auto parseString(const QString &str) noexcept -> ValuePtr

Parse TOML data from a string.

Parameters:

str – The string with the TOML data to parse.

Returns:

A value that contains the parsed TOML data, or a nullptr if there was an error. You can access the last error using the lastError method.

auto parseData(const QByteArray &data) noexcept -> ValuePtr

Parse TOML data from UTF-8 encoded data.

Parameters:

data – UTF-8 encoded data with TOML to parse.

Returns:

A value that contains the parsed TOML data, or a nullptr if there was an error. You can access the last error using the lastError method.

auto parseFile(const QString &path) noexcept -> ValuePtr

Parse TOML data from a file.

This function opens the file at path read-only, and reads the file as stream. It is the most efficient way to read TOML data from a file.

Parameters:

path – The absolute path to the file.

Returns:

A value that contains the parsed TOML data, or a nullptr if there was an error. You can access the last error using the lastError method.

auto parseStream(const InputStreamPtr &inputStream) noexcept -> ValuePtr

Parse TOML data from an input stream.

This function reads and parses data from the given input stream.

Parameters:

inputStream – The input stream.

Returns:

A value that contains the parsed TOML data, or a nullptr if there was an error. You can access the last error using the lastError method.

auto lastError() const noexcept -> const Error&

Access the last error from a parse method call.

Returns:

The last error from one of the parse method. When called after a successful call, or before parsing was done, the behaviour is save but undefined.

The Value Class

typedef std::shared_ptr<Value> erbsland::qt::toml::ValuePtr

A shared pointer for the Value class.

class Value : public std::enable_shared_from_this<Value>

A value handled by the TOML parser or serializer.

Note

This value type is not protected against infinite recursion. The parser will always produce valid results, if a user is creating own value structure, they have to pay attention to this possibility.

Public Types

using TableValue = std::unordered_map<QString, ValuePtr>

The storage type used for table values.

using ArrayValue = std::vector<ValuePtr>

The storage type used for arrays.

using Type = ValueType

A local name for the value type enumeration.

using Source = ValueSource

A local name for the value source enumeration.

Public Functions

inline auto type() const noexcept -> Type

Get the type of this value.

inline auto source() const noexcept -> Source

Get the source of this value.

inline auto locationRange() const noexcept -> LocationRange

Get the location range.

auto size() const noexcept -> std::size_t

Get the size of a table or array.

Returns:

The size of the table or array, or the size 0 for regular values.

auto value(std::size_t index) const noexcept -> ValuePtr

Access an value of an array.

Parameters:

index – The value index, starting from zero.

Returns:

The value for the value, or a nullptr if the index is out of bounds.

auto hasValue(const QString &keyPath) const noexcept -> bool

Test if the value with a given key or key path exists in a table.

Parameters:

keyPath – The key, or a key path in the form key.key.key.

Returns:

true if a value with that key or key path exists, false otherwise.

auto value(const QString &keyPath) const noexcept -> ValuePtr

Access a value of a table using a key or key path.

Parameters:

keyPath – The key, or a key path in the form key.key.key.

Returns:

The value for the value, or a nullptr if the key does not exist.

auto hasKey(const QString &key) const noexcept -> bool

Test if this table has a given key.

This method exists, if you have to work with keys that contain a dot so you can’t use the hasValue() methods with key paths.

auto valueFromKey(const QString &key) const noexcept -> ValuePtr

Access a value of this table, using a single key.

This method exists, if you have to work with keys that contain a dot so you can’t use the value() methods with key paths.

Parameters:

key – A single key, that can contain the dot character.

Returns:

The value for the value, or a nullptr if the key does not exist.

auto stringValue(const QString &keyPath, const QString &defaultValue = {}) const noexcept -> QString

Access a string value using a key path.

Parameters:
  • keyPath – The key path to the value, each key seperated with a dot. Like key.key.key.

  • defaultValue – The default value that is used if the key does not exist or is no string.

Returns:

The string at the given key path, or the defaultValue.

auto integerValue(const QString &keyPath, int64_t defaultValue = {}) const noexcept -> int64_t

Access an integer value using a key path.

Parameters:
  • keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

  • defaultValue – The default value that is used if the key does not exist or is no integer.

Returns:

The integer at the given key path, or the defaultValue.

auto floatValue(const QString &keyPath, double defaultValue = {}) const noexcept -> double

Access a float value using a key path.

Parameters:
  • keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

  • defaultValue – The default value that is used if the key does not exist or is no float.

Returns:

The float at the given key path, or the defaultValue.

auto booleanValue(const QString &keyPath, bool defaultValue = {}) const noexcept -> bool

Access a boolean value using a key path.

Parameters:
  • keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

  • defaultValue – The default value that is used if the key does not exist or is no boolean.

Returns:

The boolean at the given key path, or the defaultValue.

auto timeValue(const QString &keyPath, QTime defaultValue = {}) const noexcept -> QTime

Access a time value using a key path.

Parameters:
  • keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

  • defaultValue – The default value that is used if the key does not exist or is no time value.

Returns:

The time value at the given key path, or the defaultValue.

auto dateValue(const QString &keyPath, QDate defaultValue = {}) const noexcept -> QDate

Access a date value using a key path.

Parameters:
  • keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

  • defaultValue – The default value that is used if the key does not exist or is no date value.

Returns:

The date value at the given key path, or the defaultValue.

auto dateTimeValue(const QString &keyPath, const QDateTime &defaultValue = {}) const noexcept -> QDateTime

Access an date/time value using a key path.

Parameters:
  • keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

  • defaultValue – The default value that is used if the key does not exist or is no date/time.

Returns:

The date/time at the given key path, or the defaultValue.

auto tableValue(const QString &keyPath) const noexcept -> ValuePtr

Access a table value using a key path.

Parameters:

keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

Returns:

The table value at the given key path, or an empty unconnected table value.

auto arrayValue(const QString &keyPath) const noexcept -> ValuePtr

Access an array value using a key path.

Parameters:

keyPath – The key path to the value, each key separated with a dot. Like key.key.key.

Returns:

The array value at the given key path, or an empty unconnected array value.

auto tableKeys() const noexcept -> QStringList

Get a list with all keys of a table.

Returns:

An unsorted list with all keys in this table, or an empty list if this table is empty or this value is no table.

auto begin() noexcept -> ValueIterator

Iterator over elements of an array.

auto end() noexcept -> ValueIterator

Iterator over elements of an array.

void setLocationRange(const LocationRange &locationRange) noexcept

Set the location range.

void setValue(const QString &key, const ValuePtr &value) noexcept

Set or overwrite the value in a table.

Parameters:
  • key – The key of the value.

  • value – The value itself.

void addValue(const ValuePtr &value) noexcept

Append a value to an array.

If this value is no array, the call is ignored.

Parameters:

value – The value to add.

void makeExplicit() noexcept

Make this table explicit defined.

auto clone() const noexcept -> ValuePtr

Deep-clone this value.

Returns:

A deep clone of this value and value structure if there is any.

inline auto isTable() const noexcept -> bool

Test if this is a table (ValueType::Table).

inline auto isArray() const noexcept -> bool

Test if this is an array (ValueType::Array).

auto toInteger() const noexcept -> int64_t

Get an integer from this value.

Returns:

The integer, if this value is of the Type::Integer, otherwise the value 0.

auto toFloat() const noexcept -> double

Get an float from this value.

Returns:

The float, if this value is of the Type::Float, otherwise the value 0.0.

auto toBoolean() const noexcept -> bool

Get a boolean from this value.

Returns:

The boolean, if this value is of the Type::Boolean, otherwise the value false.

auto toString() const noexcept -> QString

Get an string from this value.

Returns:

The string, if this value is of the Type::String, otherwise an empty string.

auto toTime() const noexcept -> QTime

Get a time from this value.

Returns:

The time, if this value is of the Type::Time, otherwise QTime{}.

auto toDate() const noexcept -> QDate

Get a date from this value.

Returns:

The date, if this value is of the Type::Date, otherwise QDate{}.

auto toDateTime() const noexcept -> QDateTime

Get a date/time from this value.

Returns:

The date/time, if this value is of the Type::DateTime, otherwise QDateTime{}.

auto toTable() const noexcept -> TableValue

Get an unordered map from this value.

Returns:

An unordered map if this value is Type::Table, otherwise an empty map.

auto toArray() const noexcept -> ArrayValue

Get an vector from this value.

Returns:

A vector if this value is Type::Array, otherwise an empty vector.

auto toJson() const noexcept -> QJsonValue

Convert this value to a matching QJsonValue

All structures are converted as expected by the TOML specification. Values that cannot be represented in JSON are converted into a string (time, date, date/time) that could be parsed by a TOML parser.

Returns:

This value as QJsonValue.

auto toVariant() const noexcept -> QVariant

Convert this value to a QVariant

Tables are converted into QVariantHash, arrays into QVariantList, all other values are converted into the best matching QVariant value.

Returns:

This value as QVariant.

auto toUnitTestJson() const noexcept -> QJsonValue

Convert this value to a QJsonValue for toml-test.

This is a very specialized method to convert this value into the format expected by toml-test. It is part of the interface, as it can be useful to verify a TOML document. Structures with tables and arrays are converted like toJson(), but every other value creates an extra object with two entries type and value. The type is one of string, integer, float, bool, datetime, datetime-local date-local and time-local and the value is the TOML value as string. Please note that the string is recreated from the stored value. It is not the exact string as read from the document.

Returns:

The value in the special toml-test format as QJsonValue.

Public Static Functions

static auto createInteger(int64_t value) noexcept -> ValuePtr

Create a new integer value.

Parameters:

value – The value of the new integer.

Returns:

A shared pointer to the new integer value.

static auto createFloat(double value) noexcept -> ValuePtr

Create a new floating-point value.

Parameters:

value – The value of the new floating-point number.

Returns:

A shared pointer to the new floating-point value.

static auto createBoolean(bool value) noexcept -> ValuePtr

Create a new boolean value.

Parameters:

value – The value of the new boolean.

Returns:

A shared pointer to the new boolean value.

static auto createString(QString value) noexcept -> ValuePtr

Create a new string value.

Parameters:

value – The value of the new string.

Returns:

A shared pointer to the new string value.

static auto createTime(QTime value) noexcept -> ValuePtr

Create a new time value.

Parameters:

value – The value of the new time.

Returns:

A shared pointer to the new time value.

static auto createDate(QDate value) noexcept -> ValuePtr

Create a new date value.

Parameters:

value – The value of the new date.

Returns:

A shared pointer to the new date value.

static auto createDateTime(QDateTime value) noexcept -> ValuePtr

Create a new date and time value.

Parameters:

value – The value of the new date and time.

Returns:

A shared pointer to the new date and time value.

static auto createTable(Source source) noexcept -> ValuePtr

Create a new empty table value.

Parameters:

source – The source of this table.

Returns:

A shared pointer to the new table value.

static auto createArray(Source source) noexcept -> ValuePtr

Create a new empty array value.

Parameters:

source – The source of this array.

Returns:

A shared pointer to the new array value.