# Lynar Studios - Standard Library 1.0.1 #

This is a cross-platform standard library written in C++ offering functionalities you would usually miss in C++'s standard library, especially if you would search for cross-platform implementations.  
This library has been tested on __Windows__, __Linux__ and __macOS__ systems.
Following a modularized approach the following independent submodules are defined in scope of this library:
 
#### Boxing ####

This library module provides boxing classes for primitive data types (e.g. string, int, long, float...), adding additional functionalities.

#### Core ####

The core module is a base module providing common functionalities being shared among other library submodules. Functionalities provided by this module include interfaces, exceptions and base classes, which provide basic reflection functionalities.

#### Encoding ####

To encode a byte field (e.g. a binary file) for network transfer the __Base64__ encoding / decoding functionality is being provided by this submodule as a first feature.

#### Event ####

This submodule comes with events in a primitive form, as well as with handlers and managers to provide an intuitive event handling for your application.

#### IO ####

To handle file operations - or to receive information of a file - this library submodule provides an own __File__ class implementation, which can also be passed to library implemented input or output stream classes.  
Additionally __XML__ and __KV__ parsing functionalities are provided.

#### Time ####

A __Date__ class comes with this submodule, which you can use to represent a date and do operations on it. 

---
### Changelog ###

#### Features ####

- GNU-like compilers are not supported anymore to focus more in depth on MSVC, Clang, Apple Clang - thus, still supporting the major platforms Linux, macOS and Windows
- ls::std:: namespace was renamed to ls::standard to avoid clashes with C++-STL.

#### Improvements ####

- CMake project is now modularized to reduce complexity of a single CMakeLists.txt file
- Overall increased security within code basis (based on Clang compiler security flags)

#### Fixes ####

- none

---
### Documentation ###

A simple HTML documentation file generated with Coline code documentation tool can be found inside the __doc__ folder of the project's root directory.

---
### License ###

This software is licensed and uses LGPL v3-license. You can find a __LICENSE.txt__ file inside the project's root directory.

---
### Building ###

Building this library would result into providing binaries for each library module and CLI tool: 

| binary              | type                       | dependency                   |
|---------------------|----------------------------|------------------------------|
| __cli-base64__      | CLI executable             | ls-std-encoding, ls-std-core |
| __ls-std-boxing__   | library (static / dynamic) | ls-std-core                  |
| __ls-std-core__     | library (static / dynamic) | ---                          |
| __ls-std-encoding__ | library (static / dynamic) | ls-std-core                  |
| __ls-std-event__    | library (static / dynamic) | ls-std-core                  |
| __ls-std-io__       | library (static / dynamic) | ls-std-core                  |
| __ls-std-time__     | library (static / dynamic) | ls-std-core                  |

#### Prerequisites ####

To build this library you'd need a supported __toolchain__ in place, consisting of a build tool and compiler. The following table is a listing of supported compilers and build tools associated with operating systems, where this library has been tested:

| Supported Compiler<br/>(mandatory) | Supported Compiler Version<br/>(mandatory) | Build Tool<br/>(mandatory) | Build Tool Version (mandatory) |
|------------------------------------|--------------------------------------------|----------------------------|--------------------------------|
| Clang                              | &gt;= 21.1.8                               | CMake                      | &gt;= 3.30.0                   |
| MSVC                               | &gt;= 19.50.35721.0                        | CMake                      | &gt;= 3.30.0                   |
| AppleClang                         | &gt;= 17.0.0                               | CMake                      | &gt;= 3.30.0                   |

Please note, that where the underlying operating system is optional in this listing, the toolchain itself is not! This means, that by default you should use one of the supported listed toolchains.  
In case you'd like to use an unsupported toolchain, you can enforce this during CMake project generation. For that have a look at the CMake flag usage section below.

#### Generate CMake Project (Unix) ####

To prepare a CMake project, create a build folder within the project's root folder (where the CMakeLists.txt file is located) via CLI and navigate to it:

```
mkdir cmake-build-release
cd cmake-build-release
```

Inside this folder generate the CMake project:

```
cmake ../
```

Alternatively, the CMake project generation can be controlled by providing library specific CMake flags. The following table is a listing of available flags:

| CMake Flag                               | Default Value | Description                                                                                                                                          |
|------------------------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| __LS_STD_BUILD_WITH_TESTS__              | OFF           | This flag can be enabled to build automated tests, like unit or integration tests.                                                                   |
| __LS_STD_BUILD_WITH_SUPPORTED_COMPILER__ | ON            | This flag enforces the usage of supported compilers, only.<br/>For usage of an unsupported toolchain, set this flag to __OFF__.                      |
| __LS_STD_BUILD_STATIC__                  | ON            | This flag indicates, that all library modules should be built as static goals.  <br/>Please note, that __LS_STD_BUILD_SHARED__ has to be turned off. |
| __LS_STD_BUILD_SHARED__                  | OFF           | This flag indicates, that all library modules should be built as shared goals.  <br/>Please note, that __LS_STD_BUILD_STATIC__ has to be turned off. |
| __LS_STD_BUILD_WITH_JNI__                | OFF           | This flag enables the build of JNI dependencies.  <br/>Please note, that __LS_STD_BUILD_SHARED__ has to be turned on.                                |

To use one or more of these flags, you'd have to adjust previous command, like:

```
cmake -DLS_STD_BUILD_WITH_TESTS=ON ../
```

#### Compile Project ####

Now, that the CMake project is generated, you should find CMake generated files inside previously created build folder. In order to compile the project run:   

```
cmake --build . --config Release
```

Once compilation is done, you should find generated binaries within __cmake-build-release__ folder.

---
### Link ls-std Libraries (CMake) ###

If you would like to add this library's modules to your own CMake project, make sure that you would add the libraries' include directory:

```
include_directories(${CMAKE_CURRENT_LIST_DIR}/path/to/this/library/include)
```

Then link the libraries' binary files, like:

```
target_link_libraries(... ls-std-core ls-std-boxing ...)
```

---

### Project Contribution ###

#### Initialization ####

To initialize this project and prepare it for local development, an OS-specific init-script must be executed. This script is located in __config/scripts__ location of the projects' root folder. Choose the OS-specific script (e.g. init.sh for Linux) and execute it via CLI.

#### Guidelines ####

Please refer to the __coding-guidelines.md__ file located in __doc/internal__ to be able to follow the library style.

### Run Automated Tests ###

When enabling test build CMake flag during CMake project generation, executable test suite binaries will be generated during project compilation.  
You would then find individual module test suites, as well as a whole project test suite, which can be run via CLI.
