This documentation is installed locally under /usr/share/doc/libnmbs-dev/html/index.html. You can open this in a web browser directly, or utilise a package such as dochelp to browse for it.
The library contains the root namespace nmbs in C++. The API is primarily based around functions, minimising the use of data structures to simple structs for holding data. The structs themselves have very little, if any, functionality.
Examples
Once you have installed the development files (e.g. libnmbs-dev on Debian), you will be able to integrate libnmbs1 into your project as follows:
find_package(NMBS REQUIRED CONFIG)
target_link_libraries(Your-Target
PRIVATE
NMBS::NMBS-Library
)
Ensure that the core header is included in your code.
The intended "include all" header file for libnmbs.
The following is a minimal example for writing and reading the XMP metadata on an image. Note that the error handling for the library is using nmbs::Expected, which is simply a std::Expected<T, nmbs::Error> typedef. The majority of errors will be reported in this manner. The nmbs::Error contains a human-readable message, and a machine-readable code.
Further examples can be found in the targets/NMBS-Examples folder of the source code.
#include <iostream>
int main()
{
const std::filesystem::path file{"my-image.jpg"};
std::vector<nmbs::ConfidentialityLabel> labels(1);
labels[0].confidentiality_information.policy_identifier = "PUBLIC";
labels[0].confidentiality_information.classification = "UNMARKED";
{
std::cerr << output.error().message() << std::endl;
return output.error().code();
}
{
{
std::cout << label.confidentiality_information.policy_identifier << " " <<
label.confidentiality_information.classification << std::endl;
}
}
else if (!result)
{
std::cerr << result.error().message() << std::endl;
return result.error().code();
}
}
Expected< std::optional< binding::BindingInformation > > read_binding(const std::filesystem::path &path, std::optional< binding::ProfileSupport > binding_support=std::nullopt)
Reads the full ADatP-4778 binding from the file.
@ no_label_present
There was no label attached to the file.
Definition exit_code.h:65
@ success
No errors occurred. The operation completed successfully.
Definition exit_code.h:37
Expected< std::string > write_labels(const std::filesystem::path &path, const std::vector< ConfidentialityLabel > &confidentiality_labels, std::optional< binding::ProfileSupport > binding_support=std::nullopt)
Writes ADatP‑4778 binding information using the best possible binding profile.