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:
- Made Event class serializable
- Added Key Value File Functionality
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.
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).
Version
Description:
This class respresents a version with the layout MAJOR.MINOR.PATCH.
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.
Double
Description:
This class boxes a variable of type double and provides arithmetic operations.
Float
Description:
This class boxes a variable of type float and provides arithmetic operations.
Integer
Description:
This class boxes a variable of type int and provides arithmetic operations.
Long
Description:
This class boxes a variable of type ls_std::long_type and provides arithmetic operations.
String
Description:
This class boxes a variable of type std::string and provides some basic functionalities.
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.
EventHandler
Description:
This class will take care of a single event by taking care of all classes that are listening to this specific event.
EventManager
Description:
This class will hold all event handlers and is responsible for subscribing and unsubscribing classes (listeners) to a specific event.
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>.
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.
FileOperationException
Description:
This exception can be thrown when a certain operation on a file is not valid or failed.
IllegalArgumentException
Description:
This exception can be thrown when a passed parameter of a function is not valid.
IllegalArithmeticOperationException
Description:
This exception can be thrown when an arithmetic operation is invalid, like division by 0.
NullPointerException
Description:
This exception can be thrown when a reference is null (nullptr).
File Handling
This package provides functionalities for file operations.
File
Description:
This class represents a file or a directory and provides certain basic operations.
FileOutputStream
Description:
This class takes a
ls_std::File and opens a stream to write to it.
FileReader
FileWriter
IReader
Description:
This interface contains the read method prototype.
IStorable
Description:
This interface contains the load and save method prototypes to provide these functionalities to a class, which would implement this interface.
IWriter
Description:
This interface contains the write method prototype.
StandardOutputWriter
Description:
This class writes any data to stdout.
StorableFile
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.
KVPair
Description:
This class represents a key value pair.
KVParseData
Description:
This class contains data for the parsing process.
KVParser
KVReader
Description:
This class takes a
ls_std::KVDocument and a file path to read, parse and apply the data to the document.
KVTypes
Description:
This file contains key value data types, like
ls_std::kv_key (std::string),
ls_std::kv_value (std::string).
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.
Narrator
Description:
This class represents a "Narrator", which contains a list of listeners. The narrator is able to call "tell" to all known listeners.
State
Description:
This class represents a state of a state machine. It can contain state connections.
StateConnection
Description:
This class represents a connection between two states. It contains a condition, which needs to be fulfilled to reach a connected state.
StateMachine
Description:
This class represents a state machine and contains a list of states.
StateMachineTypes
Description:
This file contains state machine data types, like
StateConnectionId (std::string) and StateId (std::string).
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.
LogLevel
Description:
This class represents a log level and offers the possibility to prioritize a message for a log.
LogLevelValue
Description:
This enum contains all available log levels, like FATAL, ERR, WARN, INFO, DEBUG, TRACE, OFF.
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.
SerializableJSONBoolean
SerializableJSONDouble
SerializableJSONFloat
SerializableJSONEvent
SerializableJSONInteger
SerializableJSONLong
SerializableJSONState
SerializableJSONStateConnection
SerializableJSONStateMachine
SerializableJSONString
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.
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.
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.
XMLDocument
Description:
This class represents an actual xml document. It contains a xml declaration and a reference to the root xml node.
XMLNode
Description:
This class represents a xml node, which also can contain references to children.
XMLParseData
Description:
This class contains data, which is needed during xml parse process.
XMLParseMode
Description:
This enum represents the current parse state during parse process.
XMLParser
Description:
This class takes a complete xml string and parses it. The result will then be mapped to a
ls_std::XMLDocument reference.
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.