MarkLogic Connect
MarkLogic Connect Client API Collection
Public Member Functions | List of all members
mlclient::Document Class Reference

Provides a representation of a MarkLogic Document. More...

#include <Document.hpp>

Public Member Functions

MLCLIENT_API Document ()
 Creates an empty Document object.
 
MLCLIENT_API Document (const std::string &uri)
 Creates a Document that holds only a URI reference. More...
 
MLCLIENT_API Document (const std::string &uri, IDocumentContent *own_content)
 Creates a document with a URI and document content fragment. More...
 
MLCLIENT_API Document (const std::string &uri, IDocumentContent *own_content, IDocumentContent *own_properties)
 Creates a Document with a URI, document content fragment, and a document properties document fragment. More...
 
MLCLIENT_API Document (const std::string &uri, IDocumentContent *own_content, IDocumentContent *own_properties, PermissionSet own_permissions)
 Creates a Document with a URI, document content fragment, and a document properties document fragment, and a set of permissions. More...
 
virtual MLCLIENT_API ~Document ()=default
 Default Destructor.
 
MLCLIENT_API const std::string & getUri () const
 Returns the URI of this document. More...
 
MLCLIENT_API void setUri (const std::string &uri)
 Sets the Document URI. More...
 
MLCLIENT_API const bool hasUri () const
 Returns true if the Document's URI has been set. More...
 
MLCLIENT_API const CollectionSet getCollections () const
 Returns the set of collections this document belongs to. More...
 
MLCLIENT_API void setCollections (const CollectionSet &collections)
 Sets the collections this Document is a member of. More...
 
MLCLIENT_API const bool hasCollections () const
 Whether this document has any collections set. More...
 
MLCLIENT_API const IDocumentContentgetContent () const
 Returns the content fragment of this document. More...
 
MLCLIENT_API const bool hasContent () const
 Whether this document has it's content fragment set. More...
 
MLCLIENT_API void setContent (IDocumentContent *own_content)
 Sets the content fragment of this document instance. More...
 
MLCLIENT_API const IDocumentContentgetProperties () const
 Retrieves the property fragment of this document instance. More...
 
MLCLIENT_API const bool hasProperties () const
 Whether this document instance has its properties fragment set. More...
 
MLCLIENT_API void setProperties (IDocumentContent *own_properties)
 Sets this document's properties fragment. More...
 
MLCLIENT_API const PermissionSet getPermissions () const
 Returns the permissions set on this document instance. More...
 
MLCLIENT_API const bool hasPermissions () const
 Whether this document instance has any permissions set. More...
 
MLCLIENT_API void setPermissions (PermissionSet own_permissions)
 Sets this document's permissions. More...
 
MLCLIENT_API bool operator== (const Document &other)
 Equality operator. Checks equality of URI only.
 
MLCLIENT_API bool operator!= (const Document &other)
 Inequality operator. Checks inequality of URI only.
 

Detailed Description

Provides a representation of a MarkLogic Document.

Since
8.0.2
Date
2016-08-04
Note
The top level Document object is implementation independent and so is a concrete class.

Constructor & Destructor Documentation

MLCLIENT_API mlclient::Document::Document ( const std::string &  uri)

Creates a Document that holds only a URI reference.

Parameters
[in]uriThe URI for the Document within MarkLogic Server
MLCLIENT_API mlclient::Document::Document ( const std::string &  uri,
IDocumentContent own_content 
)

Creates a document with a URI and document content fragment.

Parameters
[in]uriThe URI for the Document within MarkLogic Server
[in]own_contentThe content fragment. The Document class owns this reference, and deletes it upon destruction
MLCLIENT_API mlclient::Document::Document ( const std::string &  uri,
IDocumentContent own_content,
IDocumentContent own_properties 
)

Creates a Document with a URI, document content fragment, and a document properties document fragment.

Parameters
[in]uriThe URI for the Document within MarkLogic Server
[in]own_contentThe content fragment. The Document class owns this reference, and deletes it upon destruction
[in]own_propertiesThe properties fragment. The Document class owns this reference, and deletes it upon destruction
MLCLIENT_API mlclient::Document::Document ( const std::string &  uri,
IDocumentContent own_content,
IDocumentContent own_properties,
PermissionSet  own_permissions 
)

Creates a Document with a URI, document content fragment, and a document properties document fragment, and a set of permissions.

Parameters
[in]uriThe URI for the Document within MarkLogic Server
[in]own_contentThe content fragment. The Document class owns this reference, and deletes it upon destruction
[in]own_propertiesThe properties fragment. The Document class owns this reference, and deletes it upon destruction
[in]own_permissionsThe permission set to apply. The Document class owns this reference, and deletes it upon destruction

Member Function Documentation

MLCLIENT_API const CollectionSet mlclient::Document::getCollections ( ) const

Returns the set of collections this document belongs to.

Note
A CollectionSet is a typedef for std::vector<std::string>
Returns
The set of collections this document belongs to. An empty Set if not specified.
MLCLIENT_API const IDocumentContent* mlclient::Document::getContent ( ) const

Returns the content fragment of this document.

Returns
The content fragment pointer. nullptr if no content is set (use hasContent() to check)
MLCLIENT_API const PermissionSet mlclient::Document::getPermissions ( ) const

Returns the permissions set on this document instance.

Returns
The permission set
MLCLIENT_API const IDocumentContent* mlclient::Document::getProperties ( ) const

Retrieves the property fragment of this document instance.

Returns
The properties fragment document content. nullptr if not set
MLCLIENT_API const std::string& mlclient::Document::getUri ( ) const

Returns the URI of this document.

Returns an empty string if not set

Returns
The document URI, or empty string
MLCLIENT_API const bool mlclient::Document::hasCollections ( ) const

Whether this document has any collections set.

Returns
True if this document's collections have been set
MLCLIENT_API const bool mlclient::Document::hasContent ( ) const

Whether this document has it's content fragment set.

Returns
True if the content fragment has been set on this document instance
MLCLIENT_API const bool mlclient::Document::hasPermissions ( ) const

Whether this document instance has any permissions set.

Returns
True if this document instance has had its permissions set
MLCLIENT_API const bool mlclient::Document::hasProperties ( ) const

Whether this document instance has its properties fragment set.

Returns
True if this document instance has its properties fragment set
MLCLIENT_API const bool mlclient::Document::hasUri ( ) const

Returns true if the Document's URI has been set.

Returns
True if the Document URI has been set, false if blank
MLCLIENT_API void mlclient::Document::setCollections ( const CollectionSet collections)

Sets the collections this Document is a member of.

Note
A CollectionSet is a typedef for std::vector<std::string>
Parameters
collectionsThe collections the document is a member of
MLCLIENT_API void mlclient::Document::setContent ( IDocumentContent own_content)

Sets the content fragment of this document instance.

Parameters
own_contentThe content fragment. This class OWNS this pointer from this point on, and deletes it upon destruction.
MLCLIENT_API void mlclient::Document::setPermissions ( PermissionSet  own_permissions)

Sets this document's permissions.

Parameters
own_permissionsThe permissions to set. Uses std::move to own the resources of the PermissionSet
MLCLIENT_API void mlclient::Document::setProperties ( IDocumentContent own_properties)

Sets this document's properties fragment.

Parameters
own_propertiesThe properties fragment. This class OWNS this pointer from this point on, and deletes it upon destruction.
MLCLIENT_API void mlclient::Document::setUri ( const std::string &  uri)

Sets the Document URI.

Parameters
uriThe document URI string

The documentation for this class was generated from the following file: