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

Wraps a file system file ready for its upload to MarkLogic Server. More...

#include <DocumentContent.hpp>

Inheritance diagram for mlclient::FileDocumentContent:
mlclient::IDocumentContent

Public Member Functions

MLCLIENT_API FileDocumentContent (std::string file)
 
MLCLIENT_API std::istream * getStream () const override
 Returns the content of this IDocumentContent as an istream. More...
 
MLCLIENT_API std::string getContent () const override
 Returns the content of this IDocumentContent as a std::string. More...
 
MLCLIENT_API std::string getMimeType () const override
 Returns the MIME type of this content. More...
 
MLCLIENT_API void setMimeType (const std::string &mt) override
 Sets the MIME type of this content. More...
 
- Public Member Functions inherited from mlclient::IDocumentContent
MLCLIENT_API IDocumentContent ()
 
virtual MLCLIENT_API ~IDocumentContent ()=0
 

Additional Inherited Members

- Static Public Attributes inherited from mlclient::IDocumentContent
static MLCLIENT_API const std::string MIME_JSON
 
static MLCLIENT_API const std::string MIME_XML
 

Detailed Description

Wraps a file system file ready for its upload to MarkLogic Server.

Since
8.0.2

Member Function Documentation

MLCLIENT_API std::string mlclient::FileDocumentContent::getContent ( ) const
overridevirtual

Returns the content of this IDocumentContent as a std::string.

This allows streaming of a HTTP request, with data encoded as a string.

Returns
A string representing this content;

Implements mlclient::IDocumentContent.

MLCLIENT_API std::string mlclient::FileDocumentContent::getMimeType ( ) const
overridevirtual

Returns the MIME type of this content.

E.g. application/json or application/xml

Returns
The string representation of the MIME type. Does not include encoding (always assume UTF-8 for MarkLogic Server)

Implements mlclient::IDocumentContent.

MLCLIENT_API std::istream* mlclient::FileDocumentContent::getStream ( ) const
overridevirtual

Returns the content of this IDocumentContent as an istream.

This allows streaming to a HTTP request, and works for binary and string content.

Note
The stream may be read from asynchronously, so do not destroy the underlying content after returning the stream.
Returns
An istream instance wrapping the content of this Document Content instance

Implements mlclient::IDocumentContent.

MLCLIENT_API void mlclient::FileDocumentContent::setMimeType ( const std::string &  mt)
overridevirtual

Sets the MIME type of this content.

E.g. application/json or application/xml

Parameters
[in]mtThe mimetype string, not including encoding, for this Document Content. Assume always UTF-8 for MarkLogic Server)

Implements mlclient::IDocumentContent.


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