CONZEPT 16 C++ API
|
Generic binary buffer to operate on binaries. More...
#include "C16/Binary.hpp"
Generic binary buffer to operate on binaries.
Classes | |
class | Exception |
Exception of an operation on a binary. More... | |
Public Types | |
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 | NAME_LENGTH_LIMIT = 60 |
Name length limit. More... | |
static const int | CUSTOM_LENGTH_LIMIT = 255 |
Custom property length limit. More... | |
Public Member Functions | |
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 | read (const BinaryDirectory &directory, const std::string &name, Place place=Place::KEY, Locking locking=Locking::NONE)=0 |
Reads a binary by means of a base binary directory, a reference name and a place into the binary buffer. More... | |
virtual Result | read (const BinaryDirectory &directory, Place place, Locking locking=Locking::NONE)=0 |
Reads a binary by means of a base binary directory and a place into the binary buffer. More... | |
virtual Result | read (const BinaryDirectory &directory, const std::string &path, Locking locking=Locking::LOCK_SHARED)=0 |
Reads a binary by means of a base binary directory and a path into the binary buffer. More... | |
virtual void | unload ()=0 |
Unloads the loaded binary. More... | |
virtual Result | write () const =0 |
Writes the loaded binary. More... | |
virtual Result | create (const BinaryDirectory &directory, const std::string &path, Locking locking=Locking::LOCK_SHARED, bool overwrite=false)=0 |
Creates and loads a 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 |
Error of an operation on a binary.
Enumerator | |
---|---|
CONTENT_EMPTY | Content empty. |
CIPHER_KEY_INCORRECT | Cipher key incorrect. |
OPERATION_UNAVAILABLE | Operation unavailable. |
|
static |
Name length limit.
|
static |
Custom property length limit.
bool C16::Binary::loaded | ( | ) | const |
Gets if a binary is loaded into the binary buffer.
bool C16::Binary::locked | ( | ) | const |
Gets if the loaded binary is locked by the user accessing the database.
long long int C16::Binary::id | ( | ) | const |
Gets the id of the loaded binary.
const std::string& C16::Binary::name | ( | ) | const |
Gets the name of the loaded binary.
const std::string& C16::Binary::path | ( | ) | const |
Gets the path of the loaded binary.
const std::string& C16::Binary::custom | ( | ) | const |
Gets the custom property of the loaded binary.
|
virtual |
Sets the custom property of the loaded binary.
custom | Custom property of binary (0 to CUSTOM_LENGTH_LIMIT characters) |
Exception::Invalidity | Custom invalid. |
Exception | Operation unavailable. This is a root directory. |
|
pure virtual |
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. |
Implemented in C16::BinaryObject, and C16::BinaryDirectory.
|
pure virtual |
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. |
Implemented in C16::BinaryObject, and C16::BinaryDirectory.
|
pure virtual |
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. |
Implemented in C16::BinaryObject, and C16::BinaryDirectory.
|
pure virtual |
Unloads the loaded binary.
Exception | Operation unavailable. This is a root directory. |
Implemented in C16::BinaryObject, and C16::BinaryDirectory.
|
pure virtual |
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. |
Implemented in C16::BinaryObject, and C16::BinaryDirectory.
|
pure virtual |
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:
|
Implemented in C16::BinaryObject, and C16::BinaryDirectory.
|
virtual |
Renames the loaded binary.
name | Name (1 to NAME_LENGTH_LIMIT characters) |
Result::OK | Binary renamed. |
Result::NO_REC | No binary loaded. |
Result::EXISTS | Binary with same name (case insensitive) already existent. |
Result::NO_LOCK | Binary not exclusively locked. |
Result::DEADLOCK | Deadlock occurred. |
Exception::Invalidity | Name invalid. |
Exception | Operation unavailable. This is a root directory. |
|
virtual |
Moves the loaded binary to another directory.
directory | Destination binary directory buffer |
Result::OK | Binary moved. |
Result::NO_REC | No binary loaded. |
Result::EXISTS | Binary with same name (case insensitive) already existent. |
Result::NO_LOCK | Binary not exclusively locked or destination binary directory not locked. |
Result::DEADLOCK | Deadlock occurred. |
Exception::Difference | Database different. Database of this binary is different to database of the destination directory. |
Exception | Operation unavailable. Possible reasons:
|