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

An ITextDocumentContent instance that wraps a Microsoft cpprest JSON value object. More...

#include <CppRestJsonDocumentContent.hpp>

Inheritance diagram for mlclient::utilities::CppRestJsonDocumentContent:
mlclient::ITextDocumentContent mlclient::IDocumentContent

Public Member Functions

MLCLIENT_API CppRestJsonDocumentContent ()
 Default constructor.
 
virtual MLCLIENT_API ~CppRestJsonDocumentContent ()
 Virtual destructor to allow subclassing.
 
cpprestjsondocumentcontent_overrides Overridden functions from base class
MLCLIENT_API void setContent (web::json::value &json)
 Sets the content of this document instance from a Microsoft cpprest API web::json::value instance. More...
 
MLCLIENT_API std::istream * getStream () const override
 Returns the content of this ITextDocumentContent as an istream. More...
 
MLCLIENT_API void setContent (std::string content) override
 Sets the textual content for this document. More...
 
MLCLIENT_API std::string getContent () const override
 Returns the content as a 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...
 
MLCLIENT_API int getLength () const override
 Returns the number of characters in the content string. More...
 
MLCLIENT_API IDocumentNavigatornavigate (bool firstElementAsRoot=false) const override
 Returns a way to navigate the document. More...
 
cpprestjsondocumentcontent_functions These functions are new to this subclass.
MLCLIENT_API const web::json::value & getJson () const
 Returns the underlying Microsoft cpprest API web::json::value object. 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

An ITextDocumentContent instance that wraps a Microsoft cpprest JSON value object.

Author
Adam Fowler adam..nosp@m.fowl.nosp@m.er@ma.nosp@m.rklo.nosp@m.gic.c.nosp@m.om
Since
8.0.0
Date
2016-05-10

Used by the CppRestJsonHelper class

Note
This class has an external dependency on Microsoft's C++ cpprest API. As this API is required to use MarkLogic's C++ wrapper (this API) , this does not introduce any extra dependencies.

Member Function Documentation

MLCLIENT_API std::string mlclient::utilities::CppRestJsonDocumentContent::getContent ( ) const
overridevirtual

Returns the content as a string.

Returns
The string representation of the content.

Implements mlclient::IDocumentContent.

MLCLIENT_API const web::json::value& mlclient::utilities::CppRestJsonDocumentContent::getJson ( ) const

Returns the underlying Microsoft cpprest API web::json::value object.

Returns
The underlying Microsoft cpprest web::json::value object.
MLCLIENT_API int mlclient::utilities::CppRestJsonDocumentContent::getLength ( ) const
overridevirtual

Returns the number of characters in the content string.

Note
This number does not include C null characters - just std::string length
Returns
The number of characters in the string. Does not include C null character.

Implements mlclient::ITextDocumentContent.

MLCLIENT_API std::string mlclient::utilities::CppRestJsonDocumentContent::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::utilities::CppRestJsonDocumentContent::getStream ( ) const
overridevirtual

Returns the content of this ITextDocumentContent as an istream.

This allows streaming to a HTTP request of this 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 Text Document Content instance

Implements mlclient::IDocumentContent.

MLCLIENT_API IDocumentNavigator* mlclient::utilities::CppRestJsonDocumentContent::navigate ( bool  firstElementAsRoot = false) const
overridevirtual

Returns a way to navigate the document.

See IDocumentNavigator for details

Since
8.0.2
Date
2016-07-30

Implements mlclient::ITextDocumentContent.

MLCLIENT_API void mlclient::utilities::CppRestJsonDocumentContent::setContent ( web::json::value &  json)

Sets the content of this document instance from a Microsoft cpprest API web::json::value instance.

Parameters
jsonThe cpprest API web::json::value instance to copy
MLCLIENT_API void mlclient::utilities::CppRestJsonDocumentContent::setContent ( std::string  content)
overridevirtual

Sets the textual content for this document.

Assumes content string is non null

Parameters
[in]Thestring content to copy in to this object.

Implements mlclient::ITextDocumentContent.

MLCLIENT_API void mlclient::utilities::CppRestJsonDocumentContent::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: