CONZEPT 16 C++ API
|
Binary object buffer to operate on binary objects. More...
#include "C16/Binary.hpp"
Binary object buffer to operate on binary objects.
Public Types | |
enum | Compression { Compression::NONE, Compression::LOW, Compression::MEDIUM, Compression::HIGH, Compression::MAXIMUM } |
Compression of a binary object. More... | |
![]() | |
enum | Error { Error::CONTENT_EMPTY = 1, Error::CIPHER_KEY_INCORRECT, Error::OPERATION_UNAVAILABLE } |
Error of an operation on a binary. More... | |
Static Public Attributes | |
static const int | TYPE_LENGTH_LIMIT = 60 |
Type length limit. More... | |
static const int | USER_LENGTH_LIMIT = 20 |
User length limit. More... | |
![]() | |
static const int | NAME_LENGTH_LIMIT = 60 |
Name length limit. More... | |
static const int | CUSTOM_LENGTH_LIMIT = 255 |
Custom property length limit. More... | |
Public Member Functions | |
BinaryObject () | |
Constructs a binary object buffer. More... | |
long long int | storage_id () const |
Gets the storage id of the loaded binary object. More... | |
const std::string & | type () const |
Gets the type the loaded binary object. More... | |
void | type_set (const std::string &type) |
Sets the type of the loaded binary object. More... | |
const std::string & | type_custom () const |
Gets the custom type the loaded binary object. More... | |
void | type_custom_set (const std::string &type_custom) |
Sets the custom type of the loaded binary object. More... | |
long long int | size () const |
Gets the size of the loaded binary object in units of bytes. More... | |
long long int | storage_consumption () const |
Gets the storage consumption of the loaded binary object in units of bytes. More... | |
Value::Moment | created_moment () const |
Gets the moment of the creation of the loaded binary object. More... | |
void | created_moment_set (const Value::Moment &moment) |
Sets the moment of the creation of the loaded binary object. More... | |
const std::string & | created_user () const |
Gets the user who created the loaded binary object. More... | |
void | created_user_set (const std::string &user) |
Sets the user who created the loaded binary object. More... | |
Value::Moment | modified_moment () const |
Gets the moment of the last modification of the loaded binary object. More... | |
void | modified_moment_set (const Value::Moment &moment) |
Sets the moment of the last modification of the loaded binary object. More... | |
const std::string & | modified_user () const |
Gets the user who last modified the loaded binary object. More... | |
void | modified_user_set (const std::string &user) |
Sets the user who last modified the loaded binary object. More... | |
Value::Moment | modified_moment_file () const |
Gets the moment of the last file modification of the loaded binary object. More... | |
void | modified_moment_file_set (const Value::Moment &moment) |
Sets the moment of the last file modification of the loaded binary object. More... | |
Compression | compression () const |
Gets the compression of the loaded binary object. More... | |
Result | read (const BinaryDirectory &directory, const std::string &name, Place place=Place::KEY, Locking locking=Locking::NONE) override |
Reads a binary by means of a base binary directory, a reference name and a place into the binary buffer. More... | |
Result | read (const BinaryDirectory &directory, Place place, Locking locking=Locking::NONE) override |
Reads a binary by means of a base binary directory and a place into the binary buffer. More... | |
Result | read (const BinaryDirectory &directory, const std::string &path, Locking locking=Locking::LOCK_SHARED) override |
Reads a binary by means of a base binary directory and a path into the binary buffer. More... | |
void | unload () override |
Unloads the loaded binary. More... | |
Result | write () const override |
Writes the loaded binary. More... | |
Result | create (const BinaryDirectory &directory, const std::string &path, Locking locking=Locking::LOCK_SHARED, bool overwrite=false) override |
Creates and loads a binary. More... | |
Result | content_copy_from (const BinaryObject &other) |
Copies the contents from another binary object to the loaded binary object. More... | |
Result | content_export_to_file (const std::string &file_path, const std::string &cipher_key=std::string()) const |
Exports the content of the loaded binary object to a file. More... | |
Result | content_import_from_file (const std::string &file_path, Compression compression=Compression::NONE, const std::string &cipher_key=std::string()) |
Imports the content of the loaded binary object from a file. More... | |
![]() | |
const Database * | database () const |
Gets the database of the loaded binary. More... | |
Database * | database () |
Gets the database of the loaded binary. More... | |
bool | loaded () const |
Gets if a binary is loaded into the binary buffer. More... | |
bool | locked () const |
Gets if the loaded binary is locked by the user accessing the database. More... | |
long long int | id () const |
Gets the id of the loaded binary. More... | |
const std::string & | name () const |
Gets the name of the loaded binary. More... | |
const std::string & | path () const |
Gets the path of the loaded binary. More... | |
const std::string & | custom () const |
Gets the custom property of the loaded binary. More... | |
virtual void | custom_set (const std::string &custom) |
Sets the custom property of the loaded binary. More... | |
virtual Result | rename (const std::string &name) |
Renames the loaded binary. More... | |
virtual Result | move_to (const BinaryDirectory &directory) |
Moves the loaded binary to another directory. More... | |
|
strong |
|
static |
Type length limit.
|
static |
User length limit.
C16::BinaryObject::BinaryObject | ( | ) |
Constructs a binary object buffer.
long long int C16::BinaryObject::storage_id | ( | ) | const |
Gets the storage id of the loaded binary object.
const std::string& C16::BinaryObject::type | ( | ) | const |
Gets the type the loaded binary object.
void C16::BinaryObject::type_set | ( | const std::string & | type | ) |
Sets the type of the loaded binary object.
type | Type (0 to TYPE_LENGTH_LIMIT characters) |
Exception::Invalidity | Type invalid. |
const std::string& C16::BinaryObject::type_custom | ( | ) | const |
Gets the custom type the loaded binary object.
void C16::BinaryObject::type_custom_set | ( | const std::string & | type_custom | ) |
Sets the custom type of the loaded binary object.
type_custom | Type (0 to TYPE_LENGTH_LIMIT characters) |
Exception::Invalidity | Type invalid. |
long long int C16::BinaryObject::size | ( | ) | const |
Gets the size of the loaded binary object in units of bytes.
long long int C16::BinaryObject::storage_consumption | ( | ) | const |
Gets the storage consumption of the loaded binary object in units of bytes.
Value::Moment C16::BinaryObject::created_moment | ( | ) | const |
Gets the moment of the creation of the loaded binary object.
void C16::BinaryObject::created_moment_set | ( | const Value::Moment & | moment | ) |
const std::string& C16::BinaryObject::created_user | ( | ) | const |
Gets the user who created the loaded binary object.
void C16::BinaryObject::created_user_set | ( | const std::string & | user | ) |
Sets the user who created the loaded binary object.
user | User (0 to USER_LENGTH_LIMIT characters) |
Exception::Invalidity | User invalid. |
Value::Moment C16::BinaryObject::modified_moment | ( | ) | const |
Gets the moment of the last modification of the loaded binary object.
void C16::BinaryObject::modified_moment_set | ( | const Value::Moment & | moment | ) |
const std::string& C16::BinaryObject::modified_user | ( | ) | const |
Gets the user who last modified the loaded binary object.
void C16::BinaryObject::modified_user_set | ( | const std::string & | user | ) |
Sets the user who last modified the loaded binary object.
user | User (0 to USER_LENGTH_LIMIT characters) |
Exception::Invalidity | User invalid. |
Value::Moment C16::BinaryObject::modified_moment_file | ( | ) | const |
Gets the moment of the last file modification of the loaded binary object.
void C16::BinaryObject::modified_moment_file_set | ( | const Value::Moment & | moment | ) |
Compression C16::BinaryObject::compression | ( | ) | const |
Gets the compression of the loaded binary object.
|
overridevirtual |
Reads a binary by means of a base binary directory, a reference name and a place into the binary buffer.
directory | Base binary directory buffer | ||||||||
name | Reference name (case insensitive, 0 to NAME_LENGTH_LIMIT characters) | ||||||||
place | Place of the binary
| ||||||||
locking | Locking to apply to the binary
|
Result::OK | Binary loaded and locking applied. |
Result::LOCKED | Binary already locked. No binary loaded. |
Result::NO_REC | Binary inexistent or base binary directory buffer not loaded. |
Result::NO_LOCK | Base binary directory not locked. |
Exception::Invalidity | Name invalid. |
Exception::Invalidity | Place invalid. |
Exception::Invalidity | Locking invalid. |
Exception | Operation unavailable. This is a root directory. |
Implements C16::Binary.
|
overridevirtual |
Reads a binary by means of a base binary directory and a place into the binary buffer.
directory | Base binary directory buffer | ||||||||
place | Place of the binary
| ||||||||
locking | Lock to apply to the binary
|
Result::OK | Binary loaded and locking applied. |
Result::LOCKED | Binary already locked. No binary loaded. |
Result::NO_REC | Binary inexistent or base binary directory buffer not loaded. |
Result::NO_LOCK | Base binary directory not locked. |
Exception::Invalidity | Place invalid. |
Exception::Invalidity | Locking invalid. |
Exception | Operation unavailable. This is a root directory. |
Implements C16::Binary.
|
overridevirtual |
Reads a binary by means of a base binary directory and a path into the binary buffer.
directory | Base binary directory buffer | ||||||
path | Path to the binary relative to the base binary directory | ||||||
locking | Locking to apply to the binary
|
Result::OK | Binary loaded and locking applied. |
Result::NO_KEY | Binary inexistent but following binary existent and loaded. |
Result::LAST_REC | Binary and following binary inexistent but preceding binary existent and loaded. |
Result::NO_REC | Binary inexistent or base binary directory buffer not loaded. |
Result::NO_LOCK | Base binary directory not locked. |
Result::DEADLOCK | Deadlock occurred. |
Exception::Invalidity | Name invalid. |
Exception::Invalidity | Locking invalid. |
Exception | Operation unavailable. This is a root directory. |
Implements C16::Binary.
|
overridevirtual |
Unloads the loaded binary.
Exception | Operation unavailable. This is a root directory. |
Implements C16::Binary.
|
overridevirtual |
Writes the loaded binary.
Result::OK | Binary written. |
Result::NO_REC | No binary loaded. |
Result::NO_LOCK | Binary not exclusively locked. |
Result::DEADLOCK | Deadlock occurred. |
Exception | Operation unavailable. This is a root directory. |
Implements C16::Binary.
|
overridevirtual |
Creates and loads a binary.
directory | Base binary directory buffer | ||||||
path | Path to the binary relative to the base binary directory | ||||||
locking | Locking to apply to the binary
| ||||||
overwrite | Option to overwrite a binary with the same name (case insensitive) |
Result::OK | Binary created, loaded and locking applied. |
Result::NO_REC | No binary loaded. |
Result::EXISTS | Binary with same name (case insensitive) already existent. |
Result::NO_LOCK | Binary not exclusively locked or base binary directory not locked. |
Result::DEADLOCK | Deadlock occurred. |
Exception::Invalidity | Name invalid. |
Exception | Operation unavailable. Possible reasons:
|
Implements C16::Binary.
Result C16::BinaryObject::content_copy_from | ( | const BinaryObject & | other | ) |
Copies the contents from another binary object to the loaded binary object.
other | Another binary object |
Result::OK | Binary object content copied. |
Result::NO_REC | No binary object loaded. |
Result::NO_LOCK | Binary object not locked or other binary object not exclusively locked. |
Result::DEADLOCK | Deadlock occurred. |
Exception::Difference | Database different. Database of this binary is different to database of the other object. |
Result C16::BinaryObject::content_export_to_file | ( | const std::string & | file_path, |
const std::string & | cipher_key = std::string() |
||
) | const |
Exports the content of the loaded binary object to a file.
file_path | Path to the file |
cipher_key | Cipher key to decrypt the binary object |
Result::OK | Binary object content exported to file. |
Result::NO_REC | No binary object loaded. |
Exception | Content empty. |
Exception | Cipher key incorrect. |
Filesystem::Exception | Filesystem exception occured. |
Result C16::BinaryObject::content_import_from_file | ( | const std::string & | file_path, |
Compression | compression = Compression::NONE , |
||
const std::string & | cipher_key = std::string() |
||
) |
Imports the content of the loaded binary object from a file.
file_path | Path to the file |
compression | Compression |
cipher_key | Cipher key to encrypt the binary object |
Result::OK | Binary object content imported from file. |
Result::NO_REC | No binary object loaded. |
Result::NO_LOCK | Binary object not exclusively locked. |
Result::DEADLOCK | Deadlock occurred. |
Exception | Content empty. |
Filesystem::Exception | Filesystem exception occured. |