Qore Programming Language  0.9.16
QoreNodeAsStringHelper Class Reference

safely manages the return values to AbstractQoreNode::getAsString(), stack only, cannot be dynamically allocated More...

#include <QoreStringNode.h>

Public Member Methods

DLLEXPORT QoreNodeAsStringHelper (const AbstractQoreNode *n, int format_offset, ExceptionSink *xsink)
 makes the call to AbstractQoreNode::getAsString() and manages the return values
 
DLLEXPORT QoreNodeAsStringHelper (const QoreValue n, int format_offset, ExceptionSink *xsink)
 makes the call to AbstractQoreNode::getAsString() and manages the return values
 
DLLEXPORT ~QoreNodeAsStringHelper ()
 destroys the object and deletes the QoreString pointer being managed if it was a temporary pointer
 
DLLEXPORT QoreStringgiveString ()
 returns a copy of the QoreString that the caller owns More...
 
const DLLLOCAL QoreStringoperator* ()
 returns the object being managed More...
 
const DLLLOCAL QoreStringoperator-> ()
 returns the object being managed More...
 

Detailed Description

safely manages the return values to AbstractQoreNode::getAsString(), stack only, cannot be dynamically allocated

// FMT_NONE gives all information on a single line
QoreNodeAsStringHelper str(n, FMT_NONE, xsink);
if (*xsink)
return 0;
printf("str='%s'\n", str->getBuffer());

Member Function Documentation

◆ giveString()

DLLEXPORT QoreString* QoreNodeAsStringHelper::giveString ( )

returns a copy of the QoreString that the caller owns

the object may be left empty after this call

Returns
a QoreString pointer owned by the caller

◆ operator*()

const DLLLOCAL QoreString* QoreNodeAsStringHelper::operator* ( )
inline

returns the object being managed

Returns
the object being managed

◆ operator->()

const DLLLOCAL QoreString* QoreNodeAsStringHelper::operator-> ( )
inline

returns the object being managed

Returns
the object being managed

The documentation for this class was generated from the following file:
QoreNodeAsStringHelper
safely manages the return values to AbstractQoreNode::getAsString(), stack only, cannot be dynamicall...
Definition: QoreStringNode.h:484
QoreString::getBuffer
const DLLEXPORT char * getBuffer() const
returns the string's buffer; this data should not be changed