Skip to content

Latest commit

 

History

History
148 lines (93 loc) · 3.29 KB

Value.md

File metadata and controls

148 lines (93 loc) · 3.29 KB

Value

class Value

Required header: <Eclog/Value.h>

The Value class represents an encountered value while parsing.

Member functions

Name Description
type Gets the type of this value.
isNull Determines whether this value is a null.
isBoolean Determines whether this value is a Boolean.
isString Determines whether this value is a string.
isNumber Determines whether this value is a number.
isObject Determines whether this value is an object.
isArray Determines whether this value is an array.
asNull Casts this value to a null.
asBoolean Casts this value to a Boolean.
asString Casts this value to a string.
asNumber Casts this value to a number.
bytes Gets the UTF-8 byte sequence of this value.
numberInfo Gets the number information.
stringNotation Gets the string notation.
stringDelimiter Gets the string delimiter.

type

ValueType type() const;

Gets the type of this value.

Return value

ValueType Type of this value.


isNull, isBoolean, isString, isNumber, isObject, and isArray

bool isNull() const;
bool isBoolean() const;
bool isString() const;
bool isNumber() const;
bool isObject() const;
bool isArray() const;

Determines whether this value is of a specific type.

Return value

bool true if this value is of a specific type, false otherwise.


asNull, asBoolean, asString, and asNumber

Null asNull() const;
bool asBoolean() const;
cstring asString() const;
Number asNumber() const;

Casts this value to a specific type.

Return value

Null Null value.

bool Boolean value.

cstring String value.

Number Number value.

Errors

A BadCast fault occurs if this value is not of the specific type.


bytes

cstring bytes() const;

Gets the UTF-8 byte sequence of this value.

Return value

cstring The byte sequence.


numberInfo

int numberInfo() const;

Gets the number information (Only meaningful for number value).

Return value

int The number information, which is a bitmask value (See NumberInfo).


stringNotation

StringNotation stringNotation() const;

Gets the string notation (Only meaningful for string value).

Return value

StringNotation The string notation of the string.


stringDelimiter

cstring stringDelimiter() const;

Gets the string delimiter (Only meaningful for raw string and heredoc string).

Return value

cstring The string delimiter of the string.