CONZEPT 16 C++ API
|
Text buffer to operate on texts of a database. More...
#include "C16/Text.hpp"
Text buffer to operate on texts of a database.
Classes | |
class | Stream |
Generic stream for text buffers. More... | |
class | StreamBuffer |
Generic stream buffer for text buffers. More... | |
class | StreamBufferInput |
Input stream buffer for reading text buffers. More... | |
class | StreamBufferOutput |
Output stream buffer for writing texts. More... | |
class | StreamInput |
Input stream for reading texts. More... | |
class | StreamOutput |
Output stream for writing texts. More... | |
Public Types | |
enum | LineBreak { LineBreak::NUL, LineBreak::CR, LineBreak::LF, LineBreak::CR_LF } |
Line break. More... | |
Static Public Attributes | |
static const int | NAME_LENGTH_LIMIT = 20 |
Name length limit. More... | |
static const int | GROUP_LENGTH_LIMIT = 20 |
Group length limit. More... | |
Public Member Functions | |
Text (Database &database) | |
Constructs a text buffer. More... | |
Database & | database () const |
Gets the database of the text buffer. More... | |
bool | loaded () const |
Gets if a text is loaded into the text buffer. More... | |
const std::string & | name () const |
Gets the name of the loaded text. More... | |
long int | size () const |
Gets the size of the loaded text in units of bytes. More... | |
long int | line_count () const |
Gets the line count of the loaded text. More... | |
const Value::Date & | created_date () const |
Gets the date of the creation of the loaded text. More... | |
const Value::Time & | created_time () const |
Gets the time of the creation of the loaded text. More... | |
const std::string & | created_user () const |
Gets the user who created the loaded text. More... | |
const Value::Date & | modified_date () const |
Gets the date of the last modification of the loaded text. More... | |
const Value::Time & | modified_time () const |
Gets the time of the last modification of the loaded text. More... | |
const std::string & | modified_user () const |
Gets the user who last modified the loaded text. More... | |
const std::string & | group () const |
Gets the group of the loaded text. More... | |
void | group_set (const std::string &group) |
Sets the group of the loaded text. More... | |
int | right_read () const |
Gets the right required by a user to read the loaded text. More... | |
void | right_read_set (int right_read) |
Sets the right required by a user to read the loaded text. More... | |
int | right_write () const |
Gets the right required by a user to write the loaded text. More... | |
void | right_write_set (int right_write) |
Sets the right required by a user to write the loaded text. More... | |
bool | personal () const |
Gets if the loaded text is private. More... | |
void | personal_set (bool personal) |
Sets if the loaded text is private. More... | |
const std::string & | personal_user () const |
Gets the user who set the loaded text to private. More... | |
bool | encrypted () const |
Gets if the loaded text is encrypted. More... | |
void | encrypted_set (bool encrypted) |
Sets if the loaded text is encrypted. More... | |
std::string | content (LineBreak line_break=LineBreak::LF) const |
Gets the content of the loaded text. More... | |
Result | content_set (const std::string &content, LineBreak line_break=LineBreak::LF) |
Sets the content of the loaded text. More... | |
Result | read (const std::string &name, Place place=Place::KEY, Locking locking=Locking::NONE) |
Reads a text by means of a reference name and a place into the text buffer. More... | |
Result | read (Place place, Locking locking=Locking::NONE) |
Reads a text by means of a place into the text buffer. More... | |
Result | reload (Locking locking=Locking::NONE) |
Reloads the loaded text. More... | |
void | unload () |
Unloads the loaded text. More... | |
Result | write (Locking locking=Locking::NONE) |
Writes the loaded text. More... | |
Result | create (const std::string &name, Locking locking=Locking::NONE) |
Creates and loads a text. More... | |
Result | erase () const |
Deletes the loaded text. More... | |
Result | rename (const std::string &name) |
Renames the loaded text. More... | |
Result | copy (const std::string &name) const |
Copies the loaded text. More... | |
|
strong |
|
static |
Name length limit.
|
static |
Group length limit.
|
explicit |
Constructs a text buffer.
database | Database the text buffer relates to |
bool C16::Text::loaded | ( | ) | const |
Gets if a text is loaded into the text buffer.
const std::string& C16::Text::name | ( | ) | const |
Gets the name of the loaded text.
long int C16::Text::size | ( | ) | const |
Gets the size of the loaded text in units of bytes.
<character count> + 2 * <line count>
long int C16::Text::line_count | ( | ) | const |
Gets the line count of the loaded text.
const Value::Date& C16::Text::created_date | ( | ) | const |
Gets the date of the creation of the loaded text.
const Value::Time& C16::Text::created_time | ( | ) | const |
Gets the time of the creation of the loaded text.
const std::string& C16::Text::created_user | ( | ) | const |
Gets the user who created the loaded text.
const Value::Date& C16::Text::modified_date | ( | ) | const |
Gets the date of the last modification of the loaded text.
const Value::Time& C16::Text::modified_time | ( | ) | const |
Gets the time of the last modification of the loaded text.
const std::string& C16::Text::modified_user | ( | ) | const |
Gets the user who last modified the loaded text.
const std::string& C16::Text::group | ( | ) | const |
Gets the group of the loaded text.
void C16::Text::group_set | ( | const std::string & | group | ) |
Sets the group of the loaded text.
group | Group of text (0 to GROUP_LENGTH_LIMIT characters) |
Exception::Invalidity | Group invalid. |
int C16::Text::right_read | ( | ) | const |
Gets the right required by a user to read the loaded text.
void C16::Text::right_read_set | ( | int | right_read | ) |
Sets the right required by a user to read the loaded text.
right_read | Right required by a user to read the text |
int C16::Text::right_write | ( | ) | const |
Gets the right required by a user to write the loaded text.
void C16::Text::right_write_set | ( | int | right_write | ) |
Sets the right required by a user to write the loaded text.
bool C16::Text::personal | ( | ) | const |
Gets if the loaded text is private.
void C16::Text::personal_set | ( | bool | personal | ) |
Sets if the loaded text is private.
personal | If the text is private |
const std::string& C16::Text::personal_user | ( | ) | const |
Gets the user who set the loaded text to private.
bool C16::Text::encrypted | ( | ) | const |
Gets if the loaded text is encrypted.
void C16::Text::encrypted_set | ( | bool | encrypted | ) |
Sets if the loaded text is encrypted.
encrypted | If the text is encrypted |
std::string C16::Text::content | ( | LineBreak | line_break = LineBreak::LF | ) | const |
Gets the content of the loaded text.
line_break | Line breaks within the content |
Result C16::Text::content_set | ( | const std::string & | content, |
LineBreak | line_break = LineBreak::LF |
||
) |
Sets the content of the loaded text.
content | Content |
line_break | Line breaks within the content |
Result::OK | Content set. |
Result::NO_REC | No text loaded. |
Result::NO_LOCK | Text not exclusively locked. |
Result::NO_RIGHTS | Permissions insufficient. |
Exception::Invalidity | Line break invalid. |
Result C16::Text::read | ( | const std::string & | name, |
Place | place = Place::KEY , |
||
Locking | locking = Locking::NONE |
||
) |
Reads a text by means of a reference name and a place into the text buffer.
name | Reference name (case insensitive, 0 to NAME_LENGTH_LIMIT characters) | ||||||
place | Place of the text
| ||||||
locking | Locking to apply to the text
|
Result::OK | Text loaded and locking applied. |
Result::LOCKED | Text loaded but already locked. |
Result::NO_KEY | Text inexistent. Text with the name following the reference name loaded, if existent. |
Result::NO_RIGHTS | Permissions insufficient. Name of text loaded. |
Exception::Invalidity | Name invalid. |
Exception::Invalidity | Place invalid. |
Exception::Invalidity | Locking invalid. |
Result C16::Text::read | ( | Place | place, |
Locking | locking = Locking::NONE |
||
) |
Reads a text by means of a place into the text buffer.
place | Place of the text
| ||||||||
locking | Locking to apply to the text
|
Result::OK | Text loaded and locking applied. |
Result::LOCKED | Text loaded but already locked. |
Result::NO_KEY | Text inexistent. |
Result::NO_REC | No text loaded. |
Result::NO_RIGHTS | Permissions insufficient. Name of text loaded. |
Exception::Invalidity | Place invalid. |
Exception::Invalidity | Locking invalid. |
Result C16::Text::reload | ( | Locking | locking = Locking::NONE | ) |
Reloads the loaded text.
The text is identified by its name.
locking | Locking to apply to the text
|
Result::OK | Text loaded and locking applied. |
Result::LOCKED | Text loaded but already locked. |
Result::NO_KEY | Text inexistent but following text loaded, if existent. |
Result::NO_REC | No text loaded. |
Result::NO_RIGHTS | Permissions insufficient. Name of text loaded. |
void C16::Text::unload | ( | ) |
Unloads the loaded text.
Result C16::Text::write | ( | Locking | locking = Locking::NONE | ) |
Writes the loaded text.
locking | Locking to apply to the text
|
Result::OK | Text written and locking applied. |
Result::NO_REC | No text loaded. |
Result::NO_LOCK | Text not exclusively locked. |
Result::NO_RIGHTS | Permissions insufficient. |
Result::DEADLOCK | Deadlock occurred. |
Result C16::Text::create | ( | const std::string & | name, |
Locking | locking = Locking::NONE |
||
) |
Creates and loads a text.
name | Name of the text (1 to NAME_LENGTH_LIMIT characters) | ||||
locking | Locking to apply to the text
|
Result::OK | Text created, loaded and locking applied. |
Result::EXISTS | Text with same name (case insensitive) already existent. No text loaded. |
Result::DEADLOCK | Deadlock occurred. No text loaded. |
Exception::Invalidity | Name invalid. No text loaded. |
Exception::Invalidity | Locking invalid. No text loaded. |
Result C16::Text::erase | ( | ) | const |
Deletes the loaded text.
Result::OK | Text deleted. |
Result::LOCKED | Text locked. |
Result::NO_KEY | Text inexistent. |
Result::NO_REC | No text loaded. |
Result::NO_RIGHTS | Permissions insufficient. |
Result::DEADLOCK | Deadlock occurred. |
Result C16::Text::rename | ( | const std::string & | name | ) |
Renames the loaded text.
name | Name of the text after renaming it (1 to NAME_LENGTH_LIMIT characters) |
Result::OK | Text renamed. |
Result::LOCKED | Text locked. |
Result::NO_KEY | Text inexistent. |
Result::NO_REC | No text loaded. |
Result::EXISTS | Text with same name (case insensitive) already existent. |
Result::NO_RIGHTS | Permissions insufficient. |
Exception::Invalidity | Name invalid. |
Result C16::Text::copy | ( | const std::string & | name | ) | const |
Copies the loaded text.
name | Name of the copy of the text (1 to NAME_LENGTH_LIMIT characters) |
Result::OK | Text copied. |
Result::LOCKED | Text locked. |
Result::NO_KEY | Text inexistent. |
Result::NO_REC | No text loaded. |
Result::EXISTS | Text with same name (case insensitive) already existent. |
Result::NO_RIGHTS | Permissions insufficient. |
Result::DEADLOCK | Deadlock occurred. |
Exception::Invalidity | Name invalid. |