Introduction​

Xbase++ comes with so-called assets. You can consider an asset as a reference implementation. The idea of assets is to formalize the packaging of libraries, frameworks, etc. beyond the Xbase++ core product featureset. In practice, assets are there to clean up the project chaos and provide a unified model for add-on library/framework/code usage/binding.

The user of an asset is not allowed to change the asset or its underlying code. To do so, the original asset must be edited and repackaged.

The Xbase++ Workbench offers the possibility to add an asset to a project. Physically, assets are stored in the subdirectory ".assets" and will then become part of the project. This includes the asset meta files and the corresponding asset files. This also means the .assets directory and files must be treated just like any other directory or source file of the project. For example, they must be checked into a source repository.

Asset types​

Assets manifest themselves in different types and are integrated into the project in different ways depending on their complexity and requirements.

Files only​

An asset can only contain files. The asset "Modern flat UI alias metro" is an example of this. After installation, the sources of the asset are located in the .assets\metro-ui directory and can be referenced from a CXP page via this path, for example.

Simple​

Assets can also consist of source code files. These source code files are also stored in the .assets directory. However, they are also entered in the project file so that their object files are linked to the EXE or DLL target. As a result, all classes and functions of the asset are available to the target. The Impersonate asset is a representative of this category.

Komplex​

A similar procedure is used for assets that are implemented as a DLL. Here a reference to the DLL target is added to the project file and the EXE/DLL target to which the asset was added receives a dependency to the DLL asset. The DLL asset is linked to the target and so all exported classes and functions are available for the target. An example of this is the "OAuth2 client" asset.

Installation​

Assets are target specific and are added to an existing target accordingly. This is done via the Asset Manager which is opened with a right-click on the target within the Project Manager of the Workbench.

open-asset-manager.png


The Asset Manager opens and the desired asset can be selected.

asset-manager-dialog.png


Deinstallation​

The same interaction can be used to uninstall the asset. Open the Asset Manager and remove the asset.

Samples​

Each asset is accompanied by a readme that is opened and displayed by the Workbench as soon the asset is installed. This readme may contain examples of asset usage. These examples can be added to the project.

Add-Example-link.png


Usually, an executable target is created to which the asset has been added. The source code files may still need to be adapted. Corresponding places in the source code are marked with a "TODO" comment.

Asset projects​

One or more project files can be installed in the asset directory. If the asset is i.e. a DLL asset, then the asset target is referenced from one of these projects. If an example from the readme is included as a target in your project, then it also originates from one of these projects.

Modifying assets​

If you want to modify the behaviour of a class of the asset, we recommend creating a separate class in your source code that inherits from the asset class. Manipulating the asset's source code is dangerous and not allowed because modifications are lost when an asset is updated.

Dokumentation​

All assets are accompanied by a readme. Information about the usage of the asset can be found in this readme. Furthermore, the source code files of the assets are annotated with comments that provide further information about the details of the asset's functionality.

Project manipulation​

Adding an asset can manipulate your project file. This involves adding sample targets, adding an asset target with "INCLUDE_FROM" and referencing the asset target with "DEPENDS_ON". Details about the latter can be found in the Xbase++ documentation for pbuild.exe.