group lvbase

Contains the core components for Livekeys.

Summary

Members Descriptions
classlv::ApplicationContext Contains the application running context data.
classlv::CommandLineParser Command line parser class.
classlv::CommandLineParserException A simple exception class for the command line parser, with message and code params.
classlv::Exception Standard Exception used throughout Livekeys.
classlv::LibraryLoadPath Class that provides an ability to load libraries given a path (both recursively and non-recursively)
classlv::LockedFileIOSession Handles IO from files in a thread-safe manner.
classlv::MLNode::BytesType Internal type strongly related to MLNode, as one of the types.
classlv::MLNode::Iterator Iterator to be used when the structure of MLNode supports iteration (i.e. arrays or objects)
classlv::MLNode::ConstIterator Constant version of the regular MLNode iterator.
classlv::MLNode::IteratorValue Structure of the result returned by the iterator.
classlv::MLNode::ConstIteratorValue Structure of the result returned by the const iterator.
classlv::MLNode Provides an intermediate representation of objects that can later be converted to a markup language.
classlv::MLOutOfRanceException Out-of-range exception.
classlv::InvalidMLTypeException Invalid ML type exception.
classlv::TypeNotSerializableException Type not serializible exception.
classlv::Package::Reference Stores a reference to another package.
classlv::Package::Library A structure representing a package library.
classlv::Package::Context Presents a context for the given package in relation to the package graph.
classlv::Package Manages a Livekeys package.
classlv::PackageGraph::LibraryNode Struct to represent a library node.
classlv::PackageGraph Structure to represent packages and their dependencies.
classlv::Plugin::Context Presents a context for the given plugin in relation to the package graph.
classlv::Plugin Manages a Livekeys plugin.
classlv::StackTrace Captures and holds a stacktrace.
classlv::StackFrame A frame of debug-related data that gets pushed to the stack trace.
classlv::Version Semantic version container.
classlv::VisualLog::MessageInfo Simple wrapper class for log messages, including the level, timestamp and location info.
classlv::VisualLog::SourceLocation Simple structure containing relevant data about a location of the source.
classlv::VisualLog::Transport Abstraction of the transport used to pass non-visual/object messages.
classlv::VisualLog::ViewTransport Abstraction of the transport used to pass visual (view) messages.
classlv::VisualLog Main logging class.

class lv::ApplicationContext

Contains the application running context data.

Summary

Members Descriptions
public~ApplicationContext() Default destructor
public const std::string &applicationPath() Application path getter
public const std::string &executablePath() Executable path getter
public const std::string &releasePath() Release path getter
public const std::string &applicationFilePath() Application file path getter
public const std::string &linkPath() Link path getter
public const std::string &pluginPath() Plugin path getter
public const std::string &externalPath() External path getter
public const std::string &librariesPath() Libraries path getter
public const std::string &developmentPath() Development path getter
public const std::string &configPath() Config path getter
public const std::string &appDataPath() Returns the AppData path

Members

public~ApplicationContext()

Default destructor

public const std::string &applicationPath()

Application path getter

public const std::string &executablePath()

Executable path getter

public const std::string &releasePath()

Release path getter

public const std::string &applicationFilePath()

Application file path getter

public const std::string &linkPath()

Link path getter

public const std::string &pluginPath()

Plugin path getter

public const std::string &externalPath()

External path getter

public const std::string &librariesPath()

Libraries path getter

public const std::string &developmentPath()

Development path getter

public const std::string &configPath()

Config path getter

public const std::string &appDataPath()

Returns the AppData path

Depending on the platform, this can be:

  • Windows APPDATA%/LiveKeys

  • macOS $HOME/Library/Application Support/LiveKeys

  • Linux $HOME/.config/LiveKeys

class lv::CommandLineParser

Command line parser class.

Summary

Members Descriptions
publicCommandLineParser(const std::string & header) Simple constructor with a single header parameter.
public~CommandLineParser() Destructor of CommandLineParser.
public voidparse(int argc,const char *const argv) Main function of this class, parses the given number of strings.
public inline Option *helpOption() Returns the help option object containing flag names and description.
public inline Option *versionOption() Returns the version option object, containing flag names and description.
public Option *addFlag(const std::vector< std::string > & names,const std::string & description) Adds a flag with given name(s) and description.
public Option *addOption(const std::vector< std::string > & names,const std::string & description,const std::string & type) Adds an option with given name(s), description and type.
public const std::string &script() const Returns a script argument, if it exists.
public const std::vector< std::string > &scriptArguments() const Returns the arguments listed after a script name.
public std::stringhelpString() const Represents a string containing all of the pre-set options, their names, descriptions, types etc.
public std::vector< std::string >optionNames(Option * option) const Returns the name(s) of a given option.
public boolisSet(Option * option) const Returns an indicator that the option is set in the parsed batch of arguments.
public const std::string &value(Option * option) const Returns the parsed value for the given option.
public voidassertIsSet(Option * option) const Asserts that the provided option is set in the parsed arguments.

Members

publicCommandLineParser(const std::string & header)

Simple constructor with a single header parameter.

Header serves as a sort of title when displaying usage instructions. This constructor also adds the two most common command line flags, "help" and "version".

public~CommandLineParser()

Destructor of CommandLineParser.

Erases all the pre-set options.

public voidparse(int argc,const char *const argv)

Main function of this class, parses the given number of strings.

The arguments are identical to the standard C++ main(argc, argv) params. Each option is given by either its short or long name, preceeded by one or two dashes respectively. If it's a flag, we simply set it to true. If not, we expect another string to follow as a parameter. The first argument is, expectedly, the main program name.

public inline Option *helpOption()

Returns the help option object containing flag names and description.

public inline Option *versionOption()

Returns the version option object, containing flag names and description.

public Option *addFlag(const std::vector< std::string > & names,const std::string & description)

Adds a flag with given name(s) and description.

A flag is a special, bool-like kind of option where just stating it sets it to true. A flag can have a short and/or long name(s), which has to be unique. If not, an exception is thrown.

public Option *addOption(const std::vector< std::string > & names,const std::string & description,const std::string & type)

Adds an option with given name(s), description and type.

An option can have a short and/or long name(s), indicated by one or two dashes respectively. The name(s) must be unique - if not, an exception is thrown. The third parameter serves as a type descriptor. Flags are inherently bools, while options in general can be anything like strings, paths, lists...

public const std::string &script() const

Returns a script argument, if it exists.

This field is set only in case if there's a script to run in the arguments. Every argument after it relates directly to the script itself.

public const std::vector< std::string > &scriptArguments() const

Returns the arguments listed after a script name.

If there's a script name among the command line args, all the following arguments are treated as script arguments and stored in this vector.

public std::stringhelpString() const

Represents a string containing all of the pre-set options, their names, descriptions, types etc.

A simple user instruction on how to pass arguments through the command line.

public std::vector< std::string >optionNames(Option * option) const

Returns the name(s) of a given option.

Each option/flag must have at least one name, be it long or short. This function returns all of them.

public boolisSet(Option * option) const

Returns an indicator that the option is set in the parsed batch of arguments.

i.e. if we include "--version" as an argument, the isSet value of that flag is going to be true.

public const std::string &value(Option * option) const

Returns the parsed value for the given option.

Each non-flag option has another argument following it. This is stored as the option's value, and returned by this function.

public voidassertIsSet(Option * option) const

Asserts that the provided option is set in the parsed arguments.

If not, CommandLineParserException is thrown.

class lv::CommandLineParserException

class lv::CommandLineParserException
  : public lv::Exception

A simple exception class for the command line parser, with message and code params.

Summary

Members Descriptions
public inlineCommandLineParserException(const std::string & message,int code) Default constructor for this exception.

Members

public inlineCommandLineParserException(const std::string & message,int code)

Default constructor for this exception.

class lv::Exception

class lv::Exception
  : public exception

Standard Exception used throughout Livekeys.

Contains an internal private object in accordance with the D-pointer design pattern. Currently the structure contains typical Exception parameters such as message, line number, function name, stack trace etc.

Summary

Members Descriptions
publicException(const std::string & message,Codecode) Standard exception constructor with message and code parameters.
publicException(constException& other) Copy constructor of the Exception class.
publicException&operator=(constException& other) Assignment operator of Exception, works in a similar way to a copy constructor.
public virtual~Exception() Simple destructor of Exception object.
public boolhasLocation() const Returns an indicator if the exception contains a line number where the exception happened.
public boolhasStackTrace() const Indicates if the stack trace was included in the Exception.
public const std::string &message() const Returns the Exception message.
publicCodecode() const Returns the Exception code.
public intline() const Returns the line where the exception was thrown.
public const std::string &file() const Returns the filepath of the file where the exception was thrown.
public std::stringfileName() const Extracts filename from given filepath and returns it.
public const std::string &functionName() const Returns the function name where the exception was thrown.
public constStackTrace::Ptr&stackTrace() const Returns the full stack trace of the thrown exception.
public std::stringlocation() const Returns string representation of the place where the exception is thrown.
typedefCode unsigned long long

Members

publicException(const std::string & message,Codecode)

Standard exception constructor with message and code parameters.

publicException(constException& other)

Copy constructor of the Exception class.

publicException&operator=(constException& other)

Assignment operator of Exception, works in a similar way to a copy constructor.

public virtual~Exception()

Simple destructor of Exception object.

Deletes the private object given by the D-pointer.

public boolhasLocation() const

Returns an indicator if the exception contains a line number where the exception happened.

public boolhasStackTrace() const

Indicates if the stack trace was included in the Exception.

public const std::string &message() const

Returns the Exception message.

publicCodecode() const

Returns the Exception code.

public intline() const

Returns the line where the exception was thrown.

Should be used together with hasLocation() See also: hasLocation()

public const std::string &file() const

Returns the filepath of the file where the exception was thrown.

public std::stringfileName() const

Extracts filename from given filepath and returns it.

public const std::string &functionName() const

Returns the function name where the exception was thrown.

public constStackTrace::Ptr&stackTrace() const

Returns the full stack trace of the thrown exception.

Note that this is using our internal StackTrace object!

public std::stringlocation() const

Returns string representation of the place where the exception is thrown.

Includes function name, file name, line number.

typedefCode

unsigned long long

class lv::LibraryLoadPath

Class that provides an ability to load libraries given a path (both recursively and non-recursively)

The implementation in the background is reliant on the platform on which we're running Livekeys.

Summary

Members Descriptions

Members

class lv::LockedFileIOSession

Handles IO from files in a thread-safe manner.

This class contains a flexible internal representation, in accordance with the D-pointer design pattern. Each file (given by its path) gets a unique file lock (the acquisition and release of locks themselves is guaranteed to be in critical sections as well), and depending on the context, we get either read or write access. There can be multiple readers, but only one writer, at a time.

Summary

Members Descriptions
public~LockedFileIOSession() LockedFileIOSession destructor.
public std::stringreadFromFile(const std::string & path) Locks the file (given by its path) for reading and loads up a buffer with its content.
public boolwriteToFile(const std::string & path,const std::string & data) Locks the file (given by its path) for writing and writes the given data into it.
typedefPtr Shared pointer to this class

Members

public~LockedFileIOSession()

LockedFileIOSession destructor.

Deletes the internal mutex and the D-pointer itself.

public std::stringreadFromFile(const std::string & path)

Locks the file (given by its path) for reading and loads up a buffer with its content.

If the file can be opened, the buffer is returned with the entirety of the file's content. If not, an empty string is returned.

public boolwriteToFile(const std::string & path,const std::string & data)

Locks the file (given by its path) for writing and writes the given data into it.

Write lock means that only the singular writer can access it. If the file exists and it's possible to write in it, the given data is writen in, and a true flag is returned. If not, we return false. The return value is an indicator of a successful write.

typedefPtr

Shared pointer to this class

class lv::MLNode::BytesType

Internal type strongly related to MLNode, as one of the types.

Summary

Members Descriptions
publicBytesType(unsigned char * data,size_t size) Constructor from data.
publicBytesType(constBytesType& other) Copy constructor of BytesType.
publicBytesType() Default constructor of BytesType.
public~BytesType() Destructor of BytesType.
publicBytesType&operator=(constBytesType& other) Assignment operator for BytesType.
public booloperator==(constBytesType& other) const Equals relational operator for BytesType.
public QByteArraytoBase64() Returns a byte array base64 representation of BytesType object.
publicStringTypetoBase64String() Returns a base64 string representation of the BytesType.
publicByteType*data() Returns the actual data array.
public size_tsize() const Returns the size of the BytesType array.

Members

publicBytesType(unsigned char * data,size_t size)

Constructor from data.

Params are an array of unsigned chars and its size, both copied. A reference counter is included in order to implement shallow copies of this object.

publicBytesType(constBytesType& other)

Copy constructor of BytesType.

Creates only a shallow copy by copying pointers and incrementing the reference counter.

publicBytesType()

Default constructor of BytesType.

Initializes the object with zeroes.

public~BytesType()

Destructor of BytesType.

We decrement the ref counter. If the ref counter is zero, we delete the pointers.

publicBytesType&operator=(constBytesType& other)

Assignment operator for BytesType.

Reference counters are updated, and the pointers are copied from one to the other object.

public booloperator==(constBytesType& other) const

Equals relational operator for BytesType.

Compares the respective pointers of two objects to check if they're identical. Shallow comparison only.

public QByteArraytoBase64()

Returns a byte array base64 representation of BytesType object.

publicStringTypetoBase64String()

Returns a base64 string representation of the BytesType.

publicByteType*data()

Returns the actual data array.

This data array contains unsigned chars.

public size_tsize() const

Returns the size of the BytesType array.

class lv::MLNode::Iterator

Iterator to be used when the structure of MLNode supports iteration (i.e. arrays or objects)

Summary

Members Descriptions
publicIterator(Pointerobject) Simple Iterator constructor with allocator traits pointer parameter.
publicIterator(constIterator& other) Copy constructor of Iterator.
public inline~Iterator() Default (empty) destructor.
publicIterator&operator=(constIterator& other) Simple assignment operator, similar to a copy constructor.
public boolcanCompareTo(constIterator& other) const Shows if two iterators can be compared i.e. if they are used on the same MLNode.
public booloperator==(constIterator& other) const Equals relational operator, checking if two iterators point to the same thing.
public booloperator!=(constIterator& other) const Not-equals relational operator, a simple negation of the equals operator.
public booloperator<(constIterator& other) const Less-than relational operator, can only be used with non-object iterators.
public booloperator<=(constIterator& other) const Less-or-equal relational operator, uses the previously defined less operator.
public booloperator>(constIterator& other) const Greater-than relational operator, uses the previously defined less-or-equal operator.
public booloperator>=(constIterator& other) const Greater-or-equal relational operator, uses the previously defined less operator.
publicIterator&operator++() Increment operator, moves the operator forward by one.
publicIterator&operator--() Decrement operator, moves the operator backwards by one.
publicIterator&operator+=(DifferenceTypei) Forward offset move operator, moves the iterator forward by the given number of steps.
publicIterator&operator-=(DifferenceTypei) Negative offset move operator, moves the operator backwards by the given number of steps.
publicIteratoroperator+(DifferenceTypei) Offset addition operator, using the previously defined forward offset move operator.
publicIteratoroperator-(DifferenceTypei) Offset subtraction operator, using the previously defined backwards offset move operator.
publicDifferenceTypeoperator-(constIterator& other) const Returns difference between two Array iterators.
publicReferenceoperator*() const Dereference operator, returns the MLNode the iterator's positioned at.
publicPointeroperator->() const Arrow operator, returns the address of the MLNode the iterator's positioned at.
publicReferenceoperator[](DifferenceTypei) const Index operator, can only be used for Array MLNodes.
public ObjectType::key_typekey() const Returns the key of the MLNode in an Object that the iterator's currently positioned at.
publicReferencevalue() const See the dereference operator above.
typedefDifferenceType Identical to MLNode::DifferenceType.
typedefValueType Identical to MLNode::ValueType.
typedefReference Identical to MLNode::Reference.
typedefPointer Identical to MLNode::Pointer.
typedefConstPointer Identical to MLNode::ConstPointer.
typedefIteratorCategory The standard random access iterator tag.

Members

publicIterator(Pointerobject)

Simple Iterator constructor with allocator traits pointer parameter.

publicIterator(constIterator& other)

Copy constructor of Iterator.

public inline~Iterator()

Default (empty) destructor.

publicIterator&operator=(constIterator& other)

Simple assignment operator, similar to a copy constructor.

public boolcanCompareTo(constIterator& other) const

Shows if two iterators can be compared i.e. if they are used on the same MLNode.

public booloperator==(constIterator& other) const

Equals relational operator, checking if two iterators point to the same thing.

public booloperator!=(constIterator& other) const

Not-equals relational operator, a simple negation of the equals operator.

public booloperator<(constIterator& other) const

Less-than relational operator, can only be used with non-object iterators.

Objects iterators cannot be compared!

public booloperator<=(constIterator& other) const

Less-or-equal relational operator, uses the previously defined less operator.

public booloperator>(constIterator& other) const

Greater-than relational operator, uses the previously defined less-or-equal operator.

public booloperator>=(constIterator& other) const

Greater-or-equal relational operator, uses the previously defined less operator.

publicIterator&operator++()

Increment operator, moves the operator forward by one.

publicIterator&operator--()

Decrement operator, moves the operator backwards by one.

publicIterator&operator+=(DifferenceTypei)

Forward offset move operator, moves the iterator forward by the given number of steps.

Cannot be used with objects!

publicIterator&operator-=(DifferenceTypei)

Negative offset move operator, moves the operator backwards by the given number of steps.

Uses the already implemented forward offset move. Cannot be used with objects!

publicIteratoroperator+(DifferenceTypei)

Offset addition operator, using the previously defined forward offset move operator.

publicIteratoroperator-(DifferenceTypei)

Offset subtraction operator, using the previously defined backwards offset move operator.

publicDifferenceTypeoperator-(constIterator& other) const

Returns difference between two Array iterators.

Can't be used with any other MLNode type!

publicReferenceoperator*() const

Dereference operator, returns the MLNode the iterator's positioned at.

publicPointeroperator->() const

Arrow operator, returns the address of the MLNode the iterator's positioned at.

publicReferenceoperator[](DifferenceTypei) const

Index operator, can only be used for Array MLNodes.

public ObjectType::key_typekey() const

Returns the key of the MLNode in an Object that the iterator's currently positioned at.

publicReferencevalue() const

See the dereference operator above.

typedefDifferenceType

Identical to MLNode::DifferenceType.

typedefValueType

Identical to MLNode::ValueType.

typedefReference

Identical to MLNode::Reference.

typedefPointer

Identical to MLNode::Pointer.

typedefConstPointer

Identical to MLNode::ConstPointer.

typedefIteratorCategory

The standard random access iterator tag.

class lv::MLNode::ConstIterator

Constant version of the regular MLNode iterator.

Summary

Members Descriptions
publicConstIterator(ConstPointerobject) Const version of MLNode::Iterator default constructor.
publicConstIterator(constIterator& other) Constructor of ConstIterator from regular Iterator.
publicConstIterator(constConstIterator& other) Const version of MLNode::Iterator copy constructor.
public inline~ConstIterator() Default (empty) destructor.
publicConstIterator&operator=(constConstIterator& other) Const version of MLNode::Iterator default constructor.
public boolcanCompareTo(constConstIterator& other) const Shows if two ConstIterators can be compared i.e. they iterate through the same object.
public booloperator==(constConstIterator& other) const Equals relational operator that checks if two iterators points at the same pos.
public booloperator!=(constConstIterator& other) const Not-equals relational operator for ConstIterator.
public booloperator<(constConstIterator& other) const Const version of the MLNode::Iterator::operator<.
public booloperator<=(constConstIterator& other) const Const version of the MLNode::Iterator::operator<=.
public booloperator>(constConstIterator& other) const Const version of the MLNode::Iterator::operator>
public booloperator>=(constConstIterator& other) const Const version of the MLNode::Iterator::operator>=.
publicConstIterator&operator++() Const version of the MLNode::Iterator::operator++.
publicConstIterator&operator--() Const version of the MLNode::Iterator::operator--.
publicConstIterator&operator+=(DifferenceTypei) Const version of the MLNode::Iterator::operator+=.
publicConstIterator&operator-=(DifferenceTypei) Const version of the MLNode::Iterator::operator-=.
publicConstIteratoroperator+(DifferenceTypei) Const version of the MLNode::Iterator::operator+.
publicConstIteratoroperator-(DifferenceTypei) Const version of the MLNode::Iterator::operator- for subtracting an offset from the iterator.
publicDifferenceTypeoperator-(constConstIterator& other) const Const version of the MLNode::Iterator::operator- for two ConstIterators.
publicConstReferenceoperator*() const Const version of the MLNode::Iterator::operator*.
publicConstPointeroperator->() const Const version of the MLNode::Iterator::operator->
publicConstReferenceoperator[](DifferenceTypei) const Const version of the MLNode::Iterator::operator[].
public ObjectType::key_typekey() const Const version of the key fetching function for MLNode::Iterator.
publicConstReferencevalue() const Const version of the value fetching function for MLNode::Iterator.
typedefDifferenceType Identical to MLNode::DifferenceType.
typedefValueType Identical to MLNode::ValueType.
typedefReference Identical to MLNode::Reference.
typedefConstReference Identical to MLNode::ConstReference.
typedefPointer Identical to MLNode::Pointer.
typedefConstPointer Identical to MLNode::ConstPointer.
typedefIteratorCategory Standard random access iterator tag.

Members

publicConstIterator(ConstPointerobject)

Const version of MLNode::Iterator default constructor.

publicConstIterator(constIterator& other)

Constructor of ConstIterator from regular Iterator.

publicConstIterator(constConstIterator& other)

Const version of MLNode::Iterator copy constructor.

public inline~ConstIterator()

Default (empty) destructor.

publicConstIterator&operator=(constConstIterator& other)

Const version of MLNode::Iterator default constructor.

public boolcanCompareTo(constConstIterator& other) const

Shows if two ConstIterators can be compared i.e. they iterate through the same object.

public booloperator==(constConstIterator& other) const

Equals relational operator that checks if two iterators points at the same pos.

public booloperator!=(constConstIterator& other) const

Not-equals relational operator for ConstIterator.

public booloperator<(constConstIterator& other) const

Const version of the MLNode::Iterator::operator<.

public booloperator<=(constConstIterator& other) const

Const version of the MLNode::Iterator::operator<=.

public booloperator>(constConstIterator& other) const

Const version of the MLNode::Iterator::operator>

public booloperator>=(constConstIterator& other) const

Const version of the MLNode::Iterator::operator>=.

publicConstIterator&operator++()

Const version of the MLNode::Iterator::operator++.

publicConstIterator&operator--()

Const version of the MLNode::Iterator::operator--.

publicConstIterator&operator+=(DifferenceTypei)

Const version of the MLNode::Iterator::operator+=.

publicConstIterator&operator-=(DifferenceTypei)

Const version of the MLNode::Iterator::operator-=.

publicConstIteratoroperator+(DifferenceTypei)

Const version of the MLNode::Iterator::operator+.

publicConstIteratoroperator-(DifferenceTypei)

Const version of the MLNode::Iterator::operator- for subtracting an offset from the iterator.

publicDifferenceTypeoperator-(constConstIterator& other) const

Const version of the MLNode::Iterator::operator- for two ConstIterators.

publicConstReferenceoperator*() const

Const version of the MLNode::Iterator::operator*.

publicConstPointeroperator->() const

Const version of the MLNode::Iterator::operator->

publicConstReferenceoperator[](DifferenceTypei) const

Const version of the MLNode::Iterator::operator[].

public ObjectType::key_typekey() const

Const version of the key fetching function for MLNode::Iterator.

publicConstReferencevalue() const

Const version of the value fetching function for MLNode::Iterator.

typedefDifferenceType

Identical to MLNode::DifferenceType.

typedefValueType

Identical to MLNode::ValueType.

typedefReference

Identical to MLNode::Reference.

typedefConstReference

Identical to MLNode::ConstReference.

typedefPointer

Identical to MLNode::Pointer.

typedefConstPointer

Identical to MLNode::ConstPointer.

typedefIteratorCategory

Standard random access iterator tag.

class lv::MLNode::IteratorValue

Structure of the result returned by the iterator.

Summary

Members Descriptions
public ObjectType::iteratorobjectIterator Iterator in case of an object
public ArrayType::iteratorarrayIterator Iterator in case of an array
public boolprimitiveIterator Non-iterator for other types of nodes

Members

public ObjectType::iteratorobjectIterator

Iterator in case of an object

public ArrayType::iteratorarrayIterator

Iterator in case of an array

public boolprimitiveIterator

Non-iterator for other types of nodes

class lv::MLNode::ConstIteratorValue

Structure of the result returned by the const iterator.

Summary

Members Descriptions
public ObjectType::const_iteratorobjectIterator Iterator in case of an object
public ArrayType::const_iteratorarrayIterator Iterator in case of an array
public boolprimitiveIterator Non-iterator for other types of nodes

Members

public ObjectType::const_iteratorobjectIterator

Iterator in case of an object

public ArrayType::const_iteratorarrayIterator

Iterator in case of an array

public boolprimitiveIterator

Non-iterator for other types of nodes

class lv::MLNode

Provides an intermediate representation of objects that can later be converted to a markup language.

MLNode provides a wrapper node representation of generally used types, such as ints, floats, bools, strings, arrays and objects, as well as a special type of bytes, which represents an array of unsigned chars to be used as a form of data stream. Object and Array MLNodes can contain other MLNodes inside of them, which provides nesting capabilites e.g. you could have an Array of Objects which map other Arrays. In a way, it's a simple, generic type of node to represent a variety of data objects. The ML abbreviation hints at its purpose, to be used for conversion to markup languages.

MLNodes can be created through numerous constructors

MLNode()                        // MLNode::Null
MLNode("str")                   // MLNode::String
MLNode(MLNode::StringType()     // MLNode::String
MLNode(200)                     // MLNode::Integer
MLNode(200.2)                   // MLNode::Float
MLNode(true)                    // MLNode::Boolean
MLNode(MLNode::BytesType())     // MLNode::Bytes
MLNode(MLNode::ObjectType))     // MLNode::Object
MLNode(MLNode::ArrayType())     // MLNode::Array
MLNode n({100, 200, 300});      // MLNode::Array
MLNode nObject({
    {"object", "value"}
});                             // MLNode::Object

They can be initialized during assignment in simple and intuitive ways

MLNode n = 100;                 // MLNode::Integer
MLNode n = 100.20;              // MLNode::Float
MLNode n = {100, 200, 300};     // MLNode::Array
MLNode n = {
    {"object", {
         {"key1", "value1"},
         {"key2", 100}
    }},
    {"array", { 100, "200", false}},
    {"bool", true},
    {"int", 100},
    {"float", 100.1}
};                              // MLNode::Object

The simplest depiction of the inner structure of MLNode would be a simple type variable, indicating which MLNode we have ( See also: enum MLNode::Type), as well as a flexible union type as its value. This union is as small as possible, containing primitive types as is, and using appropriate pointers for larger objects. Knowing the type, we can always use the value by simply accessing the appropriate union field e.g. asObject, asInt. Simplified version of that union is displayed below.

union MLValue{
    ObjectType*  asObject;
    ArrayType*   asArray;
    BytesType*   asBytes;
    StringType*  asString;
    BoolType     asBool;
    IntType      asInt;
    FloatType    asFloat;

// ... constructors for each type ...

};

For each of these types, there exists an appropriate getter function which casts the value to a correct type. In case of a mismatch, an exception is thrown.

Arrays are a linear type of MLNode containing other MLNodes, which allows combinations of data types which usually can't be contained in a standard container. As seen above, they can easily be constructed via a simple initializer list. Othe array-like behaviours are supported as well, such as iterating, indexing, appending etc.

Objects are simply collections (maps) of string-MLNode pairs, where each MLNode can be accessed by its key i.e. its name. There are several examples above on how to construct a simple object. Object type supports a map-like indexing access, as well as iteration.

MLNode to JSON

We provide several functions to convert our MLNode representation to JSON.

void toJson(const MLNode& n, std::string& result);
void fromJson(const std::string& data, MLNode& n);
void fromJson(const char* data, MLNode& n);

We are able to convert in both directions, from an MLNode to a JSON string, and vice versa (noting that the JSON string can be either a standard string or a char array.

Converting the following object

MLNode n = {
    {"object", {
         {"string", "value1"},
         {"key2", 100}
    }},
    {"array", { 100, "200", false}},
    {"bool", true},
    {"int", 100},
    {"float", 100.1},
    {"null", nullptr}
};

to JSON would return the following JSON string (formatted for clarity)

{
    "array": [100,"200",false],
    "bool": true,
    "float": 100.1,
    "int": 100,
    "null": null,
    "object": {
        "key2": 100,
        "string": "value1"
    }
}

Summary

Members Descriptions
publicMLNode() The default constructor of MLNode.
publicMLNode(const std::initializer_list<MLNode> & init) MLNode constructor with a parameter of initializer list.
publicMLNode(std::nullptr_t) nullptr constructor
publicMLNode(const char * value) Constructor of String MLNode given a C-type string i.e. an array of chars.
publicMLNode(constStringType& value) Constructor of String MLNode given a StringType-string (currently std::string).
publicMLNode(MLNode::Typevalue) Constructor of a generic MLNode of a given type.
publicMLNode(int value) Constructor of Integer MLNode given an int.
publicMLNode(IntTypevalue) Constructor of Integer MLNode given an IntType (currently long long).
publicMLNode(float value) Constructor of a Float MLNode given a float value.
publicMLNode(FloatTypevalue) Constructor of Float MLNode given a FloatType (currently double).
publicMLNode(BoolTypevalue) Constructor of Boolean MLNode given a BoolType (i.e. the one and only bool).
publicMLNode(constBytesType& value) Contructor of Bytes MLNode given a BytesType value.
publicMLNode(MLNode::ByteType* value,size_t size) Constructor of Bytes MLNode given an array of unsigned chars and the number of them.
publicMLNode(constArrayType& value) Constructor of Array MLNode given a vector of MLNodes.
publicMLNode(constObjectType& value) Constructor of Object MLNode given a map of string-MLNode pairs.
publicMLNode(constMLNode& other) Copy constructor of the MLNode type.
publicMLNode(MLNode&& other) Move constructor of the MLNode type.
public~MLNode() Destructor of MLNode type.
public constMLNode&operator[](constStringType& reference) const Index operator of Object MLNode that returns a const reference.
publicMLNode&operator[](constStringType& reference) Index operator of Object MLNode, uses a key as reference.
public constMLNode&operator[](int index) const Index operator of Array MLNode that returns a const reference.
publicMLNode&operator[](int index) Index operator of Array MLNode.
public inlineMLNode&operator=(MLNodeother) Assignment operator of MLNode implementing move semantics.
public voidappend(constMLNode& value) Appends to an Array MLNode.
public inlineTypetype() const Returns the type of MLNode.
public boolisNull() const Indicates if the MLNode is of Null type.
public intasInt() const Returns the MLNode value as int.
public boolasBool() const Returns the MLNode value as bool.
publicFloatTypeasFloat() const Returns the MLNode value as float.
public constStringType&asString() const Returns the MLNode value as string.
publicBytesTypeasBytes() const Returns the MLNode value as bytes.
public constArrayType&asArray() const Returns the MLNode value as an array.
publicArrayType&asArray() Returns the MLNode value as an array.
public constObjectType&asObject() const Returns the MLNode value as an object.
public intsize() const Returns the size of MLNode, if it's an Object or Array.
public boolhasKey(constStringType& key) const Returns an indicator that the given key is found in our Object MLNode.
public voidremove(constStringType& key) Removes a key-value pair from an Object MLNode with the given key.
public voidremove(int key) Removes a key from an Array MLNode with the given key.
public std::stringtypeString() const Returns a string representation of each MLNode type.
public std::stringtoString(int indent,int indentStep) const Returns a string representation of an MLNode, indented with a given number of blank spaces.
publicIteratorbegin() Returns the appropriate begin-iterator depending on the underlying MLNode type.
publicIteratorend() Returns the appropriate end-iterator depending on the underlying MLNode type.
publicConstIteratorbegin() const See cbegin()
publicConstIteratorend() const See cend()
publicConstIteratorcbegin() const Returns the appropriate const begin-iterator depending on the underlying MLNode type.
publicConstIteratorcend() const Returns the appropriate const end-iterator depending on the underlying MLNode type.
enumType Collection of all possible MLNode types.
typedefValueType MLNode
typedefReference Reference to MLNode
typedefConstReference Const reference to MLNode
typedefAllocatorType Allocator for MLNode
typedefDifferenceType Pointer arithmetic difference type
typedefSizeType Standard size type
typedefPointer Allocator pointer to MLNode
typedefConstPointer Const allocator pointer to MLNode
typedefIntType Generic int type (specifically long long)
typedefFloatType Generic float type (specifically double
typedefBoolType bool
typedefStringType Standard string type
typedefArrayType Vector of MLNodes
typedefObjectType Map of string-MLNode pairs
typedefByteType Byte type i.e. unsigned char

Members

publicMLNode()

The default constructor of MLNode.

Assigns the Null type and blank value.

publicMLNode(const std::initializer_list<MLNode> & init)

MLNode constructor with a parameter of initializer list.

Can be used to initialize both arrays and objects, given as key-value pairs in the form of two-member arrays. For example, {1, 2, 3} would initialize a simple Int array, and {{"one", 1},{"two", 2},{"three", 3}} would initialize an object.

publicMLNode(std::nullptr_t)

nullptr constructor

Used to create a Null-type MLNode. Equivalent to the default constructor.

publicMLNode(const char * value)

Constructor of String MLNode given a C-type string i.e. an array of chars.

publicMLNode(constStringType& value)

Constructor of String MLNode given a StringType-string (currently std::string).

publicMLNode(MLNode::Typevalue)

Constructor of a generic MLNode of a given type.

publicMLNode(int value)

Constructor of Integer MLNode given an int.

publicMLNode(IntTypevalue)

Constructor of Integer MLNode given an IntType (currently long long).

publicMLNode(float value)

Constructor of a Float MLNode given a float value.

publicMLNode(FloatTypevalue)

Constructor of Float MLNode given a FloatType (currently double).

publicMLNode(BoolTypevalue)

Constructor of Boolean MLNode given a BoolType (i.e. the one and only bool).

publicMLNode(constBytesType& value)

Contructor of Bytes MLNode given a BytesType value.

publicMLNode(MLNode::ByteType* value,size_t size)

Constructor of Bytes MLNode given an array of unsigned chars and the number of them.

publicMLNode(constArrayType& value)

Constructor of Array MLNode given a vector of MLNodes.

publicMLNode(constObjectType& value)

Constructor of Object MLNode given a map of string-MLNode pairs.

The strings represent the keys, while the other pair component is any type of MLNode.

publicMLNode(constMLNode& other)

Copy constructor of the MLNode type.

publicMLNode(MLNode&& other)

Move constructor of the MLNode type.

public~MLNode()

Destructor of MLNode type.

Depending on the underlying type, we invoke the destructor on the appropriate pointer.

public constMLNode&operator[](constStringType& reference) const

Index operator of Object MLNode that returns a const reference.

Throws an exception in case of non-Object type, and unlike a similar index operator, returns an immutable reference.

publicMLNode&operator[](constStringType& reference)

Index operator of Object MLNode, uses a key as reference.

If used on a non-Object type, throws an exception.

public constMLNode&operator[](int index) const

Index operator of Array MLNode that returns a const reference.

Difference from the other index operator is that this returns an immutable reference.

publicMLNode&operator[](int index)

Index operator of Array MLNode.

The underlying type has to be an array, otherwise an exception is thrown.

public inlineMLNode&operator=(MLNodeother)

Assignment operator of MLNode implementing move semantics.

public voidappend(constMLNode& value)

Appends to an Array MLNode.

In case of using it on a non-Array MLNode, an exception is thrown.

public inlineTypetype() const

Returns the type of MLNode.

public boolisNull() const

Indicates if the MLNode is of Null type.

public intasInt() const

Returns the MLNode value as int.

If not the appropriate type, an exception is thrown.

public boolasBool() const

Returns the MLNode value as bool.

Throws exception if node is not of bool type.

publicFloatTypeasFloat() const

Returns the MLNode value as float.

Throws exception if node is not of float type.

public constStringType&asString() const

Returns the MLNode value as string.

Throws exception if node is not of string type.

publicBytesTypeasBytes() const

Returns the MLNode value as bytes.

This can be done with both byte and string types. In case of the string type, it's converted to base 64 and then assigned to bytes. If not Bytes or String type, an exception is thrown.

public constArrayType&asArray() const

Returns the MLNode value as an array.

The array is actually a vector of MLNodes. If not the appropriate type, an exception is thrown.

publicArrayType&asArray()

Returns the MLNode value as an array.

The array is actually a vector of MLNodes. If not the appropriate type, an exception is thrown.

public constObjectType&asObject() const

Returns the MLNode value as an object.

If not the appropriate type, an exception is thrown.

public intsize() const

Returns the size of MLNode, if it's an Object or Array.

When an Array, the appropriate vector size is returned. When an Object, the number of mapped pairs is returned. If not one of those types, zero is returned.

public boolhasKey(constStringType& key) const

Returns an indicator that the given key is found in our Object MLNode.

If the node is not an Object, an exception is thrown.

public voidremove(constStringType& key)

Removes a key-value pair from an Object MLNode with the given key.

If the node is not an Object, an exception is thrown.

public voidremove(int key)

Removes a key from an Array MLNode with the given key.

If the node is not an Array, an exception is thrown

public std::stringtypeString() const

Returns a string representation of each MLNode type.

public std::stringtoString(int indent,int indentStep) const

Returns a string representation of an MLNode, indented with a given number of blank spaces.

This uses the previously defined toStringImpl(), which prints out the given MLNode to the given stream, whilepassing a stringstream.

publicIteratorbegin()

Returns the appropriate begin-iterator depending on the underlying MLNode type.

Types that allow iteration are Object and Array only.

publicIteratorend()

Returns the appropriate end-iterator depending on the underlying MLNode type.

Types that allow iteration are Object and Array only.

publicConstIteratorbegin() const

See cbegin()

publicConstIteratorend() const

See cend()

publicConstIteratorcbegin() const

Returns the appropriate const begin-iterator depending on the underlying MLNode type.

Types that allow iteration are Object and Array only.

publicConstIteratorcend() const

Returns the appropriate const end-iterator depending on the underlying MLNode type.

Types that allow iteration are Object and Array only.

enumType

Values Descriptions
Null Null type
Object Object type - map of string-MLNode pairs
Array Array type - vector of MLNodes
Bytes Bytes type - vector of unsigned chars (1B each!)
String String type - encapsulation of the standard string
Boolean Boolean type - encapsulation of bool
Integer Integer type - whole numbers
Float Float type - decimal numbers

Collection of all possible MLNode types.

typedefValueType

MLNode

typedefReference

Reference to MLNode

typedefConstReference

Const reference to MLNode

typedefAllocatorType

Allocator for MLNode

typedefDifferenceType

Pointer arithmetic difference type

typedefSizeType

Standard size type

typedefPointer

Allocator pointer to MLNode

typedefConstPointer

Const allocator pointer to MLNode

typedefIntType

Generic int type (specifically long long)

typedefFloatType

Generic float type (specifically double

typedefBoolType

bool

typedefStringType

Standard string type

typedefArrayType

Vector of MLNodes

typedefObjectType

Map of string-MLNode pairs

typedefByteType

Byte type i.e. unsigned char

class lv::MLOutOfRanceException

class lv::MLOutOfRanceException
  : public lv::Exception

Out-of-range exception.

Summary

Members Descriptions
public inlineMLOutOfRanceException(const std::string & message,int code) Default contructor

Members

public inlineMLOutOfRanceException(const std::string & message,int code)

Default contructor

class lv::InvalidMLTypeException

class lv::InvalidMLTypeException
  : public lv::Exception

Invalid ML type exception.

Summary

Members Descriptions
public inlineInvalidMLTypeException(const std::string & message,int code) Default contructor

Members

public inlineInvalidMLTypeException(const std::string & message,int code)

Default contructor

class lv::TypeNotSerializableException

class lv::TypeNotSerializableException
  : public lv::Exception

Type not serializible exception.

Summary

Members Descriptions
public inlineTypeNotSerializableException(const std::string & message,int code) Default constructor

Members

public inlineTypeNotSerializableException(const std::string & message,int code)

Default constructor

class lv::Package::Reference

Stores a reference to another package.

Contains just a name and version

Summary

Members Descriptions
public std::stringname Reference name
publicVersionversion Reference version
public inlineReference(const std::string & n,Versionv) Default constructor

Members

public std::stringname

Reference name

publicVersionversion

Reference version

public inlineReference(const std::string & n,Versionv)

Default constructor

class lv::Package::Library

A structure representing a package library.

When we import the package, LiveKeys will also load the library We can have issues with different versions of the same library. This is manager through flags, strings which indicate support of particular features. We compare flag sets or two libraries in order to provide maximum support of features.

Summary

Members Descriptions
public std::stringname Package name
public std::stringpath Package path
publicVersionversion Package version
public std::list< std::string >flags Package flags
public inlineLibrary(const std::string & n,Versionv) Default constructor
publicFlagResultcompareFlags(constLibrary& other) Function that compares two sets of flags in order for us to select a better library
enumFlagResult Flag comparation results

Members

public std::stringname

Package name

public std::stringpath

Package path

publicVersionversion

Package version

public std::list< std::string >flags

Package flags

public inlineLibrary(const std::string & n,Versionv)

Default constructor

publicFlagResultcompareFlags(constLibrary& other)

Function that compares two sets of flags in order for us to select a better library

enumFlagResult

Values Descriptions
Equal Two libraries have same flags
HasLess The first library has less flags than the other one (it's a subset)
HasMore The first library has more flags than the other one (it's a superset)
Different Two sets of flags are not comparable

Flag comparation results

class lv::Package::Context

Presents a context for the given package in relation to the package graph.

Summary

Members Descriptions

Members

class lv::Package

class lv::Package
  : private lv::Package::Context

Manages a Livekeys package.

Summary

Members Descriptions
publicPackageGraph*packageGraph Package graph
public std::list<Package::Ptr>dependents Packages dependent on the current one
public std::list<Package::Ptr>dependencies Dependencies of the package
public std::map< std::string,Plugin::Ptr>plugins Plugins
public~Package() Destructor of Package.
public const std::string &name() const Returns the package name.
public const std::string &path() const Returns the package path.
public const std::string &filePath() const Returns the filepath of the package.
public constVersion&version() const Returns the package version.
public const std::string &extension() const Returns the package extension.
public std::stringextensionAbsolutePath() const Returns the absolute path concatenation of the path and extension.
public boolhasExtension() const Returns an indicator that the extension exists.
public const std::map< std::string,Package::Reference* > &dependencies() const Returns a map of dependencies with string keys
public const std::map< std::string,Package::Library* > &libraries() const Returns a map of libraries with string keys.
public voidassignContext(PackageGraph* graph) Assigns a new context to this package.
publicPackageGraph*contextOwner() Package graph.
publicContext*context() Returns the current context if any has been assigned, nullptr otherwise.
public inlineContext() Blank constructor
typedefPtr Shared pointer to Package

Members

publicPackageGraph*packageGraph

Package graph

public std::list<Package::Ptr>dependents

Packages dependent on the current one

public std::list<Package::Ptr>dependencies

Dependencies of the package

public std::map< std::string,Plugin::Ptr>plugins

Plugins

public~Package()

Destructor of Package.

public const std::string &name() const

Returns the package name.

public const std::string &path() const

Returns the package path.

public const std::string &filePath() const

Returns the filepath of the package.

public constVersion&version() const

Returns the package version.

public const std::string &extension() const

Returns the package extension.

public std::stringextensionAbsolutePath() const

Returns the absolute path concatenation of the path and extension.

public boolhasExtension() const

Returns an indicator that the extension exists.

public const std::map< std::string,Package::Reference* > &dependencies() const

Returns a map of dependencies with string keys

public const std::map< std::string,Package::Library* > &libraries() const

Returns a map of libraries with string keys.

public voidassignContext(PackageGraph* graph)

Assigns a new context to this package.

publicPackageGraph*contextOwner()

Package graph.

publicContext*context()

Returns the current context if any has been assigned, nullptr otherwise.

public inlineContext()

Blank constructor

typedefPtr

Shared pointer to Package

class lv::PackageGraph::LibraryNode

Struct to represent a library node.

Summary

Members Descriptions
publicPackage::Librarylibrary Library within the node
public boolloaded Shows if it's loaded
public inlineLibraryNode(constPackage::Library& l) Default constructor

Members

publicPackage::Librarylibrary

Library within the node

public boolloaded

Shows if it's loaded

public inlineLibraryNode(constPackage::Library& l)

Default constructor

class lv::PackageGraph

Structure to represent packages and their dependencies.

It also stores all the libraries, stores in the LibraryNode structure. We also check for dependency cycles on multiple levels: plugins, packages, Elements files

Summary

Members Descriptions
publicPackageGraph() Default constructor
public virtual~PackageGraph() Default destructor
public voidloadPackage(constPackage::Ptr& p,bool addLibraries) Loads package in the graph and makes necessary checks
public voidloadPackageWithDependencies(constPackage::Ptr& p,std::list<Package::Reference> & missing,bool addLibraries) Recursive loader that also loads the necessarys dependencies
public voidaddDependency(constPackage::Ptr& package,constPackage::Ptr& dependsOn) Adds the dependency needed for this plugin. If not within the same package, we load an entire package instead.
public CyclesResult<Package::Ptr>checkCycles(constPackage::Ptr& p) Check if there are cycles between packages, starting from the given packages
public CyclesResult<Plugin::Ptr>checkCycles(constPlugin::Ptr& p) Check if there are cycles between plugins, starting from the given plugin
public voidclearPackages() Clears all packages from the graph.
public voidclearLibraries() Clears all libraries from the graph.
public voidaddLibrary(constPackage::Library& lib) Adds a library for loading.
public voidloadLibraries() Function that loads all the libraries from our internal libraries structure
public std::stringtoString() const Nice string representation of the PackageGraph.
publicPackage::PtrfindPackage(Package::Referenceref) Finds the package according to the given reference.
publicPackage::PtrfindPackage(const std::string & packageName) Finds the package with the given name and the highest version in the package import paths.
publicPackage::Ptrpackage(const std::string & name) Returns the package with the given name internally
public const std::vector< std::string > &packageImportPaths() const Returns the package import paths
public voidsetPackageImportPaths(const std::vector< std::string > & paths) Package import paths setter
publicPlugin::PtrcreateRunningPlugin(const std::string & path)
public voidloadRunningPackageAndPlugin(constPackage::Ptr& package,constPlugin::Ptr& plugin)
publicPlugin::PtrloadPlugin(const std::string & importSegment,Plugin::PtrrequestingPlugin) Load plugin given the import segment.
publicPlugin::PtrloadPlugin(const std::vector< std::string > & importSegment,Plugin::PtrrequestingPlugin) Loads plugin given split-up import segments.
public voidaddDependency(constPlugin::Ptr& plugin,const std::string & pluginDependency) Adds plugin dependency.
public voidaddDependency(constPlugin::Ptr& plugin,constPlugin::Ptr& dependsOn) Add dependency between two given plugins.

Members

publicPackageGraph()

Default constructor

public virtual~PackageGraph()

Default destructor

public voidloadPackage(constPackage::Ptr& p,bool addLibraries)

Loads package in the graph and makes necessary checks

public voidloadPackageWithDependencies(constPackage::Ptr& p,std::list<Package::Reference> & missing,bool addLibraries)

Recursive loader that also loads the necessarys dependencies

public voidaddDependency(constPackage::Ptr& package,constPackage::Ptr& dependsOn)

Adds the dependency needed for this plugin. If not within the same package, we load an entire package instead.

public CyclesResult<Package::Ptr>checkCycles(constPackage::Ptr& p)

Check if there are cycles between packages, starting from the given packages

public CyclesResult<Plugin::Ptr>checkCycles(constPlugin::Ptr& p)

Check if there are cycles between plugins, starting from the given plugin

public voidclearPackages()

Clears all packages from the graph.

public voidclearLibraries()

Clears all libraries from the graph.

public voidaddLibrary(constPackage::Library& lib)

Adds a library for loading.

The library is loaded if:

  • the library hasn't been loaded yet

  • the library currently provided is a newer version than the existing one, or has more compilation flags that include the existing one and the older one hasn't been cached (loaded into memory) yet

A few conditions must be respected, otherwise an exception will be triggered:

  • If another library already has been loaded, then the major version must be the same as the one that was loaded

  • If another library already has been loaded, then the added library must have either more or less compilation flags than the one added

  • If it has less compilation flags, than the minor version must be smaller or equal to the the added library

  • If it has more compliation flags, than the minor version must be higher or equal to the added library

public voidloadLibraries()

Function that loads all the libraries from our internal libraries structure

public std::stringtoString() const

Nice string representation of the PackageGraph.

publicPackage::PtrfindPackage(Package::Referenceref)

Finds the package according to the given reference.

publicPackage::PtrfindPackage(const std::string & packageName)

Finds the package with the given name and the highest version in the package import paths.

publicPackage::Ptrpackage(const std::string & name)

Returns the package with the given name internally

public const std::vector< std::string > &packageImportPaths() const

Returns the package import paths

public voidsetPackageImportPaths(const std::vector< std::string > & paths)

Package import paths setter

publicPlugin::PtrcreateRunningPlugin(const std::string & path)

public voidloadRunningPackageAndPlugin(constPackage::Ptr& package,constPlugin::Ptr& plugin)

publicPlugin::PtrloadPlugin(const std::string & importSegment,Plugin::PtrrequestingPlugin)

Load plugin given the import segment.

publicPlugin::PtrloadPlugin(const std::vector< std::string > & importSegment,Plugin::PtrrequestingPlugin)

Loads plugin given split-up import segments.

public voidaddDependency(constPlugin::Ptr& plugin,const std::string & pluginDependency)

Adds plugin dependency.

public voidaddDependency(constPlugin::Ptr& plugin,constPlugin::Ptr& dependsOn)

Add dependency between two given plugins.

class lv::Plugin::Context

Presents a context for the given plugin in relation to the package graph.

Summary

Members Descriptions

Members

class lv::Plugin

class lv::Plugin
  : private lv::Plugin::Context

Manages a Livekeys plugin.

Summary

Members Descriptions
publicPackageGraph*packageGraph Package graph
publicPackage::Ptrpackage Package
public std::stringimportId Import id
public std::list<Plugin::Ptr>localDependencies Local dependencies
public std::list<Plugin::Ptr>localDependents Local dependents
public~Plugin() Default destructor
public const std::string &name() const Name getter
public const std::string &path() const Path getter
public const std::string &filePath() const File path getter
public const std::string &package() const Package getter
public const std::list< std::string > &dependencies() const Dependencies getter
public const std::list< std::string > &modules() const Modules getter
public const std::list< std::string > &libraryModules() const Library modules getter
public const std::map< std::string, std::string > &palettes() const Palettes getter
public voidassignContext(PackageGraph* graph) Assign package graph context
publicContext*context() Context getter
public inlineContext() Blank constructor
typedefPtr Shared pointer to plugin

Members

publicPackageGraph*packageGraph

Package graph

publicPackage::Ptrpackage

Package

public std::stringimportId

Import id

public std::list<Plugin::Ptr>localDependencies

Local dependencies

public std::list<Plugin::Ptr>localDependents

Local dependents

public~Plugin()

Default destructor

public const std::string &name() const

Name getter

public const std::string &path() const

Path getter

public const std::string &filePath() const

File path getter

public const std::string &package() const

Package getter

public const std::list< std::string > &dependencies() const

Dependencies getter

public const std::list< std::string > &modules() const

Modules getter

public const std::list< std::string > &libraryModules() const

Library modules getter

public const std::map< std::string, std::string > &palettes() const

Palettes getter

public voidassignContext(PackageGraph* graph)

Assign package graph context

publicContext*context()

Context getter

public inlineContext()

Blank constructor

typedefPtr

Shared pointer to plugin

class lv::StackTrace

Captures and holds a stacktrace.

Summary

Members Descriptions
public inlineConstIteratorbegin() const Start iterator or the stackframes
public inlineConstIteratorend() const End iterator of the stackframes
public inline size_tsize() const Number of stackframes
public~StackTrace() Destructor of StackTrace.
typedefContainer vector of StackFrames
typedefConstIterator Const iterator for a stack frame vector
typedefPtr Shared pointer to StackTrace

Members

public inlineConstIteratorbegin() const

Start iterator or the stackframes

public inlineConstIteratorend() const

End iterator of the stackframes

public inline size_tsize() const

Number of stackframes

public~StackTrace()

Destructor of StackTrace.

Simply removes the contained StackFrames.

typedefContainer

vector of StackFrames

typedefConstIterator

Const iterator for a stack frame vector

typedefPtr

Shared pointer to StackTrace

class lv::StackFrame

A frame of debug-related data that gets pushed to the stack trace.

Very simple structure, containing only getters of its various fields.

Summary

Members Descriptions
public inlineStackFrame(const std::string & functionName,AddressPtraddress,const std::string & objectPath,const std::string & filePath,int line) Default constructor, only function name and addr. pointer are mandatory parameters.
public inline~StackFrame() Default (empty) destructor.
public inline const std::string &functionName() const Function name getter.
public inlineAddressPtraddress() const Adress pointer getter.
public inline const std::string &objectPath() const Object path getter.
public inline const std::string &filePath() const File path getter.
public inline std::stringfileName() const File name getter (extracted from file path)
public inline intline() const Line number getter.
public inline boolhasLocation() const Shows if we have a line number field.
typedefAddressPtr unsigned long long

Members

public inlineStackFrame(const std::string & functionName,AddressPtraddress,const std::string & objectPath,const std::string & filePath,int line)

Default constructor, only function name and addr. pointer are mandatory parameters.

public inline~StackFrame()

Default (empty) destructor.

public inline const std::string &functionName() const

Function name getter.

public inlineAddressPtraddress() const

Adress pointer getter.

public inline const std::string &objectPath() const

Object path getter.

public inline const std::string &filePath() const

File path getter.

public inline std::stringfileName() const

File name getter (extracted from file path)

public inline intline() const

Line number getter.

public inline boolhasLocation() const

Shows if we have a line number field.

typedefAddressPtr

unsigned long long

class lv::Version

Semantic version container.

The version is represented by four values: major version, minor version, patch number, revision number, in order of importance. Version is stored as a single long long value, and the four components can then be extracted by simple modular arithmetic modulo 10000.

Summary

Members Descriptions
publicVersion(int majorNumber,int minorNumber,int patchNumber,int revisionNumber) A simple version constructor containing four number parameters in order of importance.
publicVersion(const std::string & versionStr) A simple constructor from string in format major.minor.patch.revision.
public~Version() Version destructor (blank)
public inline intmajorNumber() const Returns major version.
public inline intminorNumber() const Returns minor version.
public inline intpatchNumber() const Returns patch number.
public inline intrevisionNumber() const Returns revision number.
public inline booloperator==(constVersion& version) const Equals relational operator between two versions.
public inline booloperator!=(constVersion& version) const Not-equals relational operator between two versions.
public inline booloperator<(constVersion& version) const Less-than relational operator between two versions.
public inline booloperator<=(constVersion& version) const Less-or-equal relational operator between two versions.
public inline booloperator>(constVersion& version) const Greater-than relational operator between two versions.
public inline booloperator>=(constVersion& version) const Greater-or-equal relational operator between two versions.
public std::stringtoString() const String representation of version, in the form of major.minor.patch[.revision].

Members

publicVersion(int majorNumber,int minorNumber,int patchNumber,int revisionNumber)

A simple version constructor containing four number parameters in order of importance.

Any number of parameters is allowed, the rest default to 0. All numbers except the major version are limited to four digits max by design.

publicVersion(const std::string & versionStr)

A simple constructor from string in format major.minor.patch.revision.

We can include 0-4 numbers in the string representation, and they will be used in order of importance i.e. if we only have three numbers, we will default the revision number to 0. See also: Version(int major, int minor, int patch, int revision)

public~Version()

Version destructor (blank)

public inline intmajorNumber() const

Returns major version.

public inline intminorNumber() const

Returns minor version.

public inline intpatchNumber() const

Returns patch number.

public inline intrevisionNumber() const

Returns revision number.

public inline booloperator==(constVersion& version) const

Equals relational operator between two versions.

Simple check between two long longs!

public inline booloperator!=(constVersion& version) const

Not-equals relational operator between two versions.

Simple check between two long longs!

public inline booloperator<(constVersion& version) const

Less-than relational operator between two versions.

Equivalent to the check between two long longs!

public inline booloperator<=(constVersion& version) const

Less-or-equal relational operator between two versions.

Simple check between two long longs!

public inline booloperator>(constVersion& version) const

Greater-than relational operator between two versions.

Simple check between two long longs!

public inline booloperator>=(constVersion& version) const

Greater-or-equal relational operator between two versions.

Equivalent to the check between two long longs!

public std::stringtoString() const

String representation of version, in the form of major.minor.patch[.revision].

Revision is only included if it's non-zero! Other components are extracted with their respective functions

class lv::VisualLog::MessageInfo

Simple wrapper class for log messages, including the level, timestamp and location info.

Location info includes a remote, function name, line number and file name. All of these are optional.

Summary

Members Descriptions
public~MessageInfo() MessageInfo desctructor.
public inline std::stringsourceRemoteLocation() const Returns a remote location, if it exists.
public inline std::stringsourceFileName() const Returns the file name of the source, if it exists.
public inline intsourceLineNumber() const Returns the line number, if it has been set.
public inline std::stringsourceFunctionName() const Returns the name of the source function, if it has been set.
public const QDateTime &stamp() const Returns the message info timestamp.
public std::stringprefix(const VisualLog::Configuration * configuration) const Returns a prefix extracted from a given configuration object.
public std::stringtag(const VisualLog::Configuration * configuration) const Returns the tag which is actually the name of the given configuration.
enumLevel Collection of all possible message levels, in decreasing order of importance.

Members

public~MessageInfo()

MessageInfo desctructor.

Deletes location and stamp pointers.

public inline std::stringsourceRemoteLocation() const

Returns a remote location, if it exists.

public inline std::stringsourceFileName() const

Returns the file name of the source, if it exists.

public inline intsourceLineNumber() const

Returns the line number, if it has been set.

public inline std::stringsourceFunctionName() const

Returns the name of the source function, if it has been set.

public const QDateTime &stamp() const

Returns the message info timestamp.

If there's none, it takes the current time and sets it as the stamp.

public std::stringprefix(const VisualLog::Configuration * configuration) const

Returns a prefix extracted from a given configuration object.

public std::stringtag(const VisualLog::Configuration * configuration) const

Returns the tag which is actually the name of the given configuration.

enumLevel

Values Descriptions
Fatal
Error
Warning
Info
Debug
Verbose

Collection of all possible message levels, in decreasing order of importance.

class lv::VisualLog::SourceLocation

Simple structure containing relevant data about a location of the source.

Location info includes a remote, function name, line number and file name. All of these are optional.

Summary

Members Descriptions
public std::stringremote Remote
public std::stringfile Source file
public intline Source line
public std::stringfunctionName Function name
public inlineSourceLocation(const std::string & file,int line,const std::string & fileName) Default contructor
public inlineSourceLocation(const std::string & remote,const std::string & file,int line,const std::string & functionName) Contructor with a remote

Members

public std::stringremote

Remote

public std::stringfile

Source file

public intline

Source line

public std::stringfunctionName

Function name

public inlineSourceLocation(const std::string & file,int line,const std::string & fileName)

Default contructor

public inlineSourceLocation(const std::string & remote,const std::string & file,int line,const std::string & functionName)

Contructor with a remote

class lv::VisualLog::Transport

Abstraction of the transport used to pass non-visual/object messages.

Summary

Members Descriptions
public inline virtual~Transport()
public voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message) Declaration of the onMessage method
public voidonObject(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & type,constMLNode& node) Declaration of the onObject method

Members

public inline virtual~Transport()

public voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message)

Declaration of the onMessage method

public voidonObject(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & type,constMLNode& node)

Declaration of the onObject method

class lv::VisualLog::ViewTransport

Abstraction of the transport used to pass visual (view) messages.

Summary

Members Descriptions
public inline virtual~ViewTransport()
public voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message) Declaration of the onMessage method
public voidonView(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & viewName,const QVariant & value) Declaration of the onView method

Members

public inline virtual~ViewTransport()

public voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message)

Declaration of the onMessage method

public voidonView(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & viewName,const QVariant & value)

Declaration of the onView method

class lv::VisualLog

Main logging class.

The way we primarily use this class is through a predefined macro vlog. It's defined in the following way

lv::VisualLog(__VA_ARGS__).at(__FILE__, __LINE__, __FUNCTION__)

This means that we can pass arguments to the vlog macro that are in accordance with the constructors of VisualLog. Those are:

VisualLog();
VisualLog(MessageInfo::Level level);
VisualLog(const std::string& configuration);
VisualLog(const std::string& configuration, MessageInfo::Level level);

Therefore, we can pass no arguments, or we can pass a configuration string (also known as tag), or a default message level, or both. The at(...) function arguments provide us with the file, line number and function name of the place we're invoking the vlog call.

Six levels of logging are available, in order of importance: Fatal, Error, Warning, Info, Debug, Verbose. There's a global configuration of the logger available, but there's also the ability to create a special configuration paired to a user-provided tag. Each user-created configuration starts as a global configuration - we can then change individual parameters as desired. vlog(extension) would create a configuration with the tag "extension". Perhaps the most important parameters of the configuration are the message levels. Each configuration has an application level and a default message level. If the level of the message we're logging is of less importance than the application level, it will not be displayed. We can set the level of the message in the following way

vlog(extension).f() << "fatal"
vlog(extension).e() << "error"
vlog(extension).w() << "warning"
vlog(extension).i() << "info"
vlog(extension).d() << "debug"
vlog(extension).v() << "verbose"

Invoking one of the shorthand functions changes the message level of the logger. The default message level is info, while the application level is debug. An example on how to configure the custom configuration is given below.

vlog().configure("test", {
     {"level", VisualLog::MessageInfo::Error},
     {"defaultLevel",     VisualLog::MessageInfo::Info}
 });

The above would change the application level of the logger to Error, and the default message level to Info. Messages would not get displayed for this particular configuration! The options are given as an Object MLNode ( See also: MLNode). All the relevant options are listed below:

  • level - application level, the least important message level that the logger's showing

  • defaultLevel - default level of messages

  • file - output log file

  • logDaily - if the log should be created on a daily basis

  • toConsole - if the log messages should be passed to the console

  • toExtensions - if the log messages should be passed to other transports

  • toView - if the log messages should be passed to view

  • logObjects - set flags for places where we should log objects

  • prefix - formatted message prefix, depends on preset values (explained below)

These settings can also be modified through the command line arguments (see help). We can output our logged messages in several ways: Console, View, File and [Extensions](#classlv_1_1Extensions). It's important to mention the concept of Transport, which we use an abstraction of a listener picking up on our log messages. We can treat the Console and File as "transports" even though they're not technically extending our abstract class. Transport can broadcast the message in a simple textform, or as an object. View Transports are used to listen to messages which can be displayed in a visual way. If the message isn't in the correct format, or visual logging isn't enabled in the config, we default to a console display. Similarly, a generic transport is used for sending the object to an external listener, be it a file or a network listener. If object logging isn't enabled, or the object isn't in the correct form, we once again default to a console display.

Summary

Members Descriptions
publicVisualLog() Default constructor of VisualLog.
publicVisualLog(MessageInfo::Levellevel) Constructor of VisualLog with level parameter.
publicVisualLog(const std::string & configuration) Constructor of VisualLog with configuration parameter.
publicVisualLog(const std::string & configuration,MessageInfo::Levellevel) Constructor of VisualLog with both configuration and level parameters.
public~VisualLog() Destructor of VisualLog.
public inlineVisualLog&at(const std::string & file,int line,const std::string & functionName) Sets the message info location.
public inlineVisualLog&at(const std::string & remote,const std::string & file,int line,const std::string & functionName) Sets the message info location with remote included.
publicVisualLog&overrideStamp(const QDateTime & stamp) Overrides the previous timestamp with the given one.
public template<>
VisualLog&operator<<(const T & x)
Stream insertion operator.
public template<>
VisualLog&operator<<(std::ostream &(*)(std::ostream &) f)
Stream insertion operator with a std::ostream& (*f)(std::ostream&) parameter.
public template<>
VisualLog&operator<<(std::ostream &(*)(std::ios &) f)
Stream insertion operator with a std::ostream& (*f)(std::ios&) parameter.
public template<>
VisualLog&operator<<(std::ostream(*)(std::ios_base &) f)
Stream insertion operator with a std::ostream (*f)(std::ios_base& ) parameter.
public inlineVisualLog&f() Sets the message level to Fatal.
public inlineVisualLog&e() Sets the message level to Error.
public inlineVisualLog&w() Sets the message level to Warning.
public inlineVisualLog&i() Sets the message level to Info.
public inlineVisualLog&d() Sets the message level to Debug.
public inlineVisualLog&v() Sets the message level to Verbose.
public template<>
voidobject(const T & value)
Log given value as object.
public template<>
voidf(const T & value)
Log given value as object with level Fatal.
public template<>
voide(const T & value)
Log given value as object with level Error.
public template<>
voidw(const T & value)
Log given value as object with level Warning.
public template<>
voidi(const T & value)
Log given value as object with level Info.
public template<>
voidd(const T & value)
Log given value as object with level Debug.
public template<>
voidv(const T & value)
Log given value as object with level Verbose.
public boolcanLog() Shows if logging is enabled.
public voidconfigure(const std::string & configuration,constMLNode& options) Configure VisualLog given a configuration tag and options.
public voidconfigure(VisualLog::Configuration * configuration,constMLNode& options) Configure VisualLog given the configuration data and options.
public voidaddTransport(const std::string & configuration,Transport* transport) Adds transport given a predefined configuration.
public voidaddTransport(VisualLog::Configuration * configuration,Transport* transport) Adds transport given configuration data.
public voidremoveTransports(const std::string & configuration) Removes transport given a predefined configuration.
public voidremoveTransports(VisualLog::Configuration * configuration) Removes transport given configuration data.
public inttotalConfigurations() Returns total number of configurations.
public voidflushLine() Flushes the entire buffer to preset outputs.
public voidcloseFile() Closes the internal log file.
public voidasView(const std::string & viewPath,const QVariant & viewData) Display viewData in the View given by the viewPath.
public voidasView(const std::string & viewPath,std::function< QVariant()> cloneFunction) Display view data returned by the given function in the View given by the viewPath.
public template<>
voidasObject(const std::string & type,const T & value)
Display value as object of given type.
public voidasObject(const std::string & type,constMLNode& value) Display MLNode as object of given type.
enumOutput Bitmasks for each type of output

Members

publicVisualLog()

Default constructor of VisualLog.

publicVisualLog(MessageInfo::Levellevel)

Constructor of VisualLog with level parameter.

publicVisualLog(const std::string & configuration)

Constructor of VisualLog with configuration parameter.

publicVisualLog(const std::string & configuration,MessageInfo::Levellevel)

Constructor of VisualLog with both configuration and level parameters.

public~VisualLog()

Destructor of VisualLog.

public inlineVisualLog&at(const std::string & file,int line,const std::string & functionName)

Sets the message info location.

public inlineVisualLog&at(const std::string & remote,const std::string & file,int line,const std::string & functionName)

Sets the message info location with remote included.

publicVisualLog&overrideStamp(const QDateTime & stamp)

Overrides the previous timestamp with the given one.

public template<>
VisualLog&operator<<(const T & x)

Stream insertion operator.

public template<>
VisualLog&operator<<(std::ostream &(*)(std::ostream &) f)

Stream insertion operator with a std::ostream& (*f)(std::ostream&) parameter.

public template<>
VisualLog&operator<<(std::ostream &(*)(std::ios &) f)

Stream insertion operator with a std::ostream& (*f)(std::ios&) parameter.

public template<>
VisualLog&operator<<(std::ostream(*)(std::ios_base &) f)

Stream insertion operator with a std::ostream (*f)(std::ios_base& ) parameter.

public inlineVisualLog&f()

Sets the message level to Fatal.

public inlineVisualLog&e()

Sets the message level to Error.

public inlineVisualLog&w()

Sets the message level to Warning.

public inlineVisualLog&i()

Sets the message level to Info.

public inlineVisualLog&d()

Sets the message level to Debug.

public inlineVisualLog&v()

Sets the message level to Verbose.

public template<>
voidobject(const T & value)

Log given value as object.

public template<>
voidf(const T & value)

Log given value as object with level Fatal.

public template<>
voide(const T & value)

Log given value as object with level Error.

public template<>
voidw(const T & value)

Log given value as object with level Warning.

public template<>
voidi(const T & value)

Log given value as object with level Info.

public template<>
voidd(const T & value)

Log given value as object with level Debug.

public template<>
voidv(const T & value)

Log given value as object with level Verbose.

public boolcanLog()

Shows if logging is enabled.

public voidconfigure(const std::string & configuration,constMLNode& options)

Configure VisualLog given a configuration tag and options.

public voidconfigure(VisualLog::Configuration * configuration,constMLNode& options)

Configure VisualLog given the configuration data and options.

public voidaddTransport(const std::string & configuration,Transport* transport)

Adds transport given a predefined configuration.

public voidaddTransport(VisualLog::Configuration * configuration,Transport* transport)

Adds transport given configuration data.

public voidremoveTransports(const std::string & configuration)

Removes transport given a predefined configuration.

public voidremoveTransports(VisualLog::Configuration * configuration)

Removes transport given configuration data.

public inttotalConfigurations()

Returns total number of configurations.

public voidflushLine()

Flushes the entire buffer to preset outputs.

public voidcloseFile()

Closes the internal log file.

public voidasView(const std::string & viewPath,const QVariant & viewData)

Display viewData in the View given by the viewPath.

public voidasView(const std::string & viewPath,std::function< QVariant()> cloneFunction)

Display view data returned by the given function in the View given by the viewPath.

public template<>
voidasObject(const std::string & type,const T & value)

Display value as object of given type.

public voidasObject(const std::string & type,constMLNode& value)

Display MLNode as object of given type.

enumOutput

Values Descriptions
Console Console output
Error Error output
File File output
View View output
Extensions Extentions output

Bitmasks for each type of output