libimgdoc2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
imgdoc2::IDocumentMetadataWrite Class Referenceabstract

The interface for write access to document metadata. More...

#include <IDocumentMetadata.h>

Inheritance diagram for imgdoc2::IDocumentMetadataWrite:
imgdoc2::IDocumentMetadata

Public Member Functions

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
 
IDocumentMetadataWriteoperator= (const IDocumentMetadataWrite &)=delete
 
 IDocumentMetadataWrite (IDocumentMetadataWrite &&)=delete
 
IDocumentMetadataWriteoperator= (IDocumentMetadataWrite &&)=delete
 

Additional Inherited Members

Detailed Description

The interface for write access to document metadata.

Member Function Documentation

◆ 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_keyKey of the node to be deleted. If this the optional has no value, this means "the root".
recursivelyTrue 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
pathThe path of the node to be deleted. If this is an empty string, it identifies the "root".
recursivelyTrue 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
parentThe parent node. If this is std::nullopt, it identifies the root node.
create_node_if_not_existsIf true, the node is created if it does not exist.
nameThe name of the node to be updated or created.
typeThe type of the node.
valueThe 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_existsTrue 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_existsTrue to create node if not exists. This refers to the last node in the path.
pathThe path of the node.
typeThe type of the node.
valueThe 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: