Lynar Studios - Standard Library (Homepage)

ls-std 2021.1.0 - Documentation

Lynar Studios - Standard Library (ls-std) is a free open source and cross-platform C++ library for basic operations like boxing, json, xml, (minimal) reflection, serialization, logging, event handling, state machine handling and file operations. This software is the base for all Lynar Studios games and also the base of the new implementation of the Lynar Engine. It has been tested on several platforms, including macOS, Windows and Linux.


This page contains the whole code documentation for this most recent version of this library.


Changelog

You can find the version related changes in the following list:

Code Documentation

Find the library functionalities in the following link list. You can follow a specific link for class documentation.

Base

This package provides generic functionalities for all other ls-std packages.

Class
Description:
This class is the base class of most library classes and provides minimal reflection functionality.
Header:
ls_std.hpp
Parents:
---

Types
Description:
This header provides some basic datatypes, like
ls_std::byte (char),
ls_std::byte_field (std::string),
ls_std::long_type (long long int),
ls_std::version_type (uint16_t).
Header:
ls_std.hpp

Version
Description:
This class respresents a version with the layout MAJOR.MINOR.PATCH.
Header:
ls_std.hpp

Boxing

This package provides functionalities for boxing primitive datatypes like, bool, double, float, int, long and std::string.

Boolean
Description:
This class boxes a variable of type bool and provides operators and logic methods.
Header:
ls_std.hpp

Double
Description:
This class boxes a variable of type double and provides arithmetic operations.
Header:
ls_std.hpp

Float
Description:
This class boxes a variable of type float and provides arithmetic operations.
Header:
ls_std.hpp

Integer
Description:
This class boxes a variable of type int and provides arithmetic operations.
Header:
ls_std.hpp

Long
Description:
This class boxes a variable of type ls_std::long_type and provides arithmetic operations.
Header:
ls_std.hpp

String
Description:
This class boxes a variable of type std::string and provides some basic functionalities.
Header:
ls_std.hpp

Event Handling

This package provides event functionalities like throwing an event and listening to events.

Event
Description:
This class represents an event, which can be thrown. It contains an unique identifier and parameters.
Header:
ls_std.hpp

EventHandler
Description:
This class will take care of a single event by taking care of all classes that are listening to this specific event.
Header:
ls_std.hpp

EventManager
Description:
This class will hold all event handlers and is responsible for subscribing and unsubscribing classes (listeners) to a specific event.
Header:
ls_std.hpp
Parents:
ls_std::Class, ls_std::IEventSubscriber

EventTypes
Description:
This header file contains data types for event classes, like
ls_std::event_id (std::string),
ls_std::event_parameter_id (std::string),
ls_std::event_parameter_value (std::string),
ls_std::event_parameter (std::pair<std::string, std::string>),
ls_std::event_parameter_list std::map<event_parameter_id, event_parameter_value>.
Header:
ls_std.hpp
Parents:
---

Exception

This package provides additional exception classes that are more human readable.

FileNotFoundException
Description:
This exception can be thrown when a file is not available.
Header:
ls_std.hpp
Parents:
std::exception

FileOperationException
Description:
This exception can be thrown when a certain operation on a file is not valid or failed.
Header:
ls_std.hpp
Parents:
std::exception

IllegalArgumentException
Description:
This exception can be thrown when a passed parameter of a function is not valid.
Header:
ls_std.hpp
Parents:
std::exception

IllegalArithmeticOperationException
Description:
This exception can be thrown when an arithmetic operation is invalid, like division by 0.
Header:
ls_std.hpp
Parents:
std::exception

NullPointerException
Description:
This exception can be thrown when a reference is null (nullptr).
Header:
ls_std.hpp
Parents:
std::exception

File Handling

This package provides functionalities for file operations.

File
Description:
This class represents a file or a directory and provides certain basic operations.
Header:
ls_std.hpp

FileOutputStream
Description:
This class takes a ls_std::File and opens a stream to write to it.
Header:
ls_std.hpp

FileReader
Description:
This class takes a ls_std::File and reads it.
Header:
ls_std.hpp

FileWriter
Description:
This class takes a ls_std::File and writes to it.
Header:
ls_std.hpp

IReader
Description:
This interface contains the read method prototype.
Header:
ls_std.hpp
Parents:
---

IStorable
Description:
This interface contains the load and save method prototypes to provide these functionalities to a class, which would implement this interface.
Header:
ls_std.hpp
Parents:
---

IWriter
Description:
This interface contains the write method prototype.
Header:
ls_std.hpp
Parents:
---

StandardOutputWriter
Description:
This class writes any data to stdout.
Header:
ls_std.hpp

StorableFile
Description:
This class takes a file path and implements the ls_std::IStorable interface.
Header:
ls_std.hpp

JSON

This package provides JSON functionalities by using the third party library nlohmann/json.

For a more detailed documentation for this library follow this link:

nlohmann JSON Library


Key Value (KV) File

This package provides KV file functionality.

KVDocument
Description:
This class represents a key value document containing the actual key value pairs.
Header:
ls_std.hpp

KVPair
Description:
This class represents a key value pair.
Header:
ls_std.hpp

KVParseData
Description:
This class contains data for the parsing process.
Header:
ls_std.hpp
Parents:
---

KVParser
Description:
This class takes a ls_std::byte_field and parses it to apply it to a ls_std::KVDocument.
Header:
ls_std.hpp

KVReader
Description:
This class takes a ls_std::KVDocument and a file path to read, parse and apply the data to the document.
Header:
ls_std.hpp

KVTypes
Description:
This file contains key value data types, like
ls_std::kv_key (std::string),
ls_std::kv_value (std::string).
Header:
ls_std.hpp
Parents:
---

Logic

This package provides some logic components like StateMachine, Narrator and Listener.

IListener
Description:
This interface provides the listen method prototype, which can be implemented by listener classes.
Header:
ls_std.hpp
Parents:
---

Narrator
Description:
This class represents a "Narrator", which contains a list of listeners. The narrator is able to call "tell" to all known listeners.
Header:
ls_std.hpp

State
Description:
This class represents a state of a state machine. It can contain state connections.
Header:
ls_std.hpp

StateConnection
Description:
This class represents a connection between two states. It contains a condition, which needs to be fulfilled to reach a connected state.
Header:
ls_std.hpp

StateMachine
Description:
This class represents a state machine and contains a list of states.
Header:
ls_std.hpp

StateMachineTypes
Description:
This file contains state machine data types, like
StateConnectionId (std::string) and StateId (std::string).
Header:
ls_std.hpp
Parents:
---

Logger

This package provides a logger with log level functionality.

Logger
Description:
This class respresents a logger, which can either be a file logger or a stdout logger. By passing a log level it is possible to prioritize messages.
Header:
ls_std.hpp

LogLevel
Description:
This class represents a log level and offers the possibility to prioritize a message for a log.
Header:
ls_std.hpp

LogLevelValue
Description:
This enum contains all available log levels, like FATAL, ERR, WARN, INFO, DEBUG, TRACE, OFF.
Header:
ls_std.hpp
Parents:
---

Serialization

This package provides serializable classes for existing library classes.

ISerializable
Description:
This interface provides the marshal and unmarshal method prototypes, which can be implemented by any class that needs serialization and de-serialization functionality.
Header:
ls_std.hpp
Parents:
---

SerializableJSONBoolean
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::Boolean class.
Header:
ls_std.hpp

SerializableJSONDouble
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::Double class.
Header:
ls_std.hpp

SerializableJSONFloat
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::Float class.
Header:
ls_std.hpp

SerializableJSONEvent
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::Event class.
Header:
ls_std.hpp

SerializableJSONInteger
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::Integer class.
Header:
ls_std.hpp

SerializableJSONLong
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::Long class.
Header:
ls_std.hpp

SerializableJSONState
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::State class.
Header:
ls_std.hpp

SerializableJSONStateConnection
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::StateConnection class.
Header:
ls_std.hpp

SerializableJSONStateMachine
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::StateMachine class.
Header:
ls_std.hpp

SerializableJSONString
Description:
This class implements the ls_std::ISerializable interface to provide JSON serialization for ls_std::String class.
Header:
ls_std.hpp

Time

This package provides generic time functionality.

Date
Description:
This class represents a date containing a timestamp. It provides operations like string conversion and arithmetic operations.
Header:
ls_std.hpp

XML

This package provides XML functionality for parsing and reading XML.

XMLAttribute
Description:
This class represents a xml attribute, which usually contains an attribute name and a value.
Header:
ls_std.hpp

XMLDeclaration
Description:
This class represents a xml declaration, which usually can be found at the top of a xml file. It contains information like version, charset and standalone flag.
Header:
ls_std.hpp

XMLDocument
Description:
This class represents an actual xml document. It contains a xml declaration and a reference to the root xml node.
Header:
ls_std.hpp

XMLNode
Description:
This class represents a xml node, which also can contain references to children.
Header:
ls_std.hpp

XMLParseData
Description:
This class contains data, which is needed during xml parse process.
Header:
ls_std.hpp
Parents:
---

XMLParseMode
Description:
This enum represents the current parse state during parse process.
Header:
ls_std.hpp
Parents:
---

XMLParser
Description:
This class takes a complete xml string and parses it. The result will then be mapped to a ls_std::XMLDocument reference.
Header:
ls_std.hpp

XMLReader
Description:
This class takes an absolute file path and a ls_std::XMLDocument reference to read a xml file to map it to the document.
Header:
ls_std.hpp