The interface for write access to document metadata.
More...
#include <IDocumentMetadata.h>
|
virtual imgdoc2::dbIndex | UpdateOrCreateItem (std::optional< imgdoc2::dbIndex > parent, bool create_node_if_not_exists, const std::string &name, DocumentMetadataType type, const IDocumentMetadata::metadata_item_variant &value)=0 |
|
virtual imgdoc2::dbIndex | UpdateOrCreateItemForPath (bool create_path_if_not_exists, bool create_node_if_not_exists, const std::string &path, DocumentMetadataType type, const IDocumentMetadata::metadata_item_variant &value)=0 |
|
virtual std::uint64_t | DeleteItem (std::optional< imgdoc2::dbIndex > primary_key, bool recursively)=0 |
|
virtual std::uint64_t | DeleteItemForPath (const std::string &path, bool recursively)=0 |
|
| IDocumentMetadataWrite (const IDocumentMetadataWrite &)=delete |
|
IDocumentMetadataWrite & | operator= (const IDocumentMetadataWrite &)=delete |
|
| IDocumentMetadataWrite (IDocumentMetadataWrite &&)=delete |
|
IDocumentMetadataWrite & | operator= (IDocumentMetadataWrite &&)=delete |
|
| IDocumentMetadata (const IDocumentMetadata &)=delete |
|
IDocumentMetadata & | operator= (const IDocumentMetadata &)=delete |
|
| IDocumentMetadata (IDocumentMetadata &&)=delete |
|
IDocumentMetadata & | operator= (IDocumentMetadata &&)=delete |
|
|
typedef std::variant< std::string, std::int32_t, double, std::monostate > | metadata_item_variant |
| Defines an alias representing the metadata item variant. This variant can contain a string, an int32, a double or a std::monostate.
|
|
The interface for write access to document metadata.
◆ DeleteItem()
virtual std::uint64_t imgdoc2::IDocumentMetadataWrite::DeleteItem |
( |
std::optional< imgdoc2::dbIndex > |
primary_key, |
|
|
bool |
recursively |
|
) |
| |
|
pure virtual |
Deletes the item specified by 'primary_key'. If 'recursively' is true, all child nodes are also deleted. If 'recursively' is false, the node is only deleted if it has no child nodes. The method returns the number of deleted nodes - it does not throw an exception if the primary key does not exist or if the node has child nodes and 'recursively' is false. Note that the root node cannot be deleted - however, it is possible to delete all child nodes of the root node.
- Parameters
-
primary_key | Key of the node to be deleted. If this the optional has no value, this means "the root". |
recursively | True if all child nodes should be deleted, false if only the node itself should be deleted. |
- Returns
- The number of deleted nodes as a result by this call.
◆ DeleteItemForPath()
virtual std::uint64_t imgdoc2::IDocumentMetadataWrite::DeleteItemForPath |
( |
const std::string & |
path, |
|
|
bool |
recursively |
|
) |
| |
|
pure virtual |
Deletes the item specified by 'path'. If 'recursively' is true, all child nodes are also deleted. If 'recursively' is false, the node is only deleted if it has no child nodes. The method returns the number of deleted nodes - it does not throw an exception if the primary key does not exist or if the node has child nodes and 'recursively' is false. Note that the root node cannot be deleted - however, it is possible to delete all child nodes of the root node.
- Parameters
-
path | The path of the node to be deleted. If this is an empty string, it identifies the "root". |
recursively | True if all child nodes should be deleted, false if only the node itself should be deleted. |
- Returns
- The number of deleted nodes as a result by this call.
◆ UpdateOrCreateItem()
virtual imgdoc2::dbIndex imgdoc2::IDocumentMetadataWrite::UpdateOrCreateItem |
( |
std::optional< imgdoc2::dbIndex > |
parent, |
|
|
bool |
create_node_if_not_exists, |
|
|
const std::string & |
name, |
|
|
DocumentMetadataType |
type, |
|
|
const IDocumentMetadata::metadata_item_variant & |
value |
|
) |
| |
|
pure virtual |
This method updates or creates a node with the name as specified in the parameter 'name' as a child of the node specified by 'parent'. If 'create_node_if_not_exists' is true, the node with the name 'name' is created if it does not exist. If 'create_node_if_not_exists' is false, the mode is not created if it does not exist. In this case, the method throws a non_existing_item_exception.
- Parameters
-
parent | The parent node. If this is std::nullopt, it identifies the root node. |
create_node_if_not_exists | If true, the node is created if it does not exist. |
name | The name of the node to be updated or created. |
type | The type of the node. |
value | The value of the node. |
- Returns
- The primary_key of the updated or created node.
◆ UpdateOrCreateItemForPath()
virtual imgdoc2::dbIndex imgdoc2::IDocumentMetadataWrite::UpdateOrCreateItemForPath |
( |
bool |
create_path_if_not_exists, |
|
|
bool |
create_node_if_not_exists, |
|
|
const std::string & |
path, |
|
|
DocumentMetadataType |
type, |
|
|
const IDocumentMetadata::metadata_item_variant & |
value |
|
) |
| |
|
pure virtual |
Updates or creates a node specified by the path 'path'. 'create_node_if_not_exists' controls if the node is created if it does not exist. This controls the behavior if the last element of the path. If 'create_path_if_not_exists' is true, all nodes in the path are created if they do not exist.
- Parameters
-
create_path_if_not_exists | True to create nodes in the path if they do not exist. This refers to all nodes in the path except the last one. |
create_node_if_not_exists | True to create node if not exists. This refers to the last node in the path. |
path | The path of the node. |
type | The type of the node. |
value | The value of the node. |
- Returns
- The primary_key of the updated or created node.
The documentation for this class was generated from the following file: