34#ifndef _QORE_QORESTRINGNODE_H
36#define _QORE_QORESTRINGNODE_H
38#include <qore/AbstractQoreNode.h>
39#include <qore/QoreString.h>
56 DLLLOCAL
virtual bool getAsBoolImpl()
const;
57 DLLLOCAL
virtual int getAsIntImpl()
const;
58 DLLLOCAL
virtual int64 getAsBigIntImpl()
const;
59 DLLLOCAL
virtual double getAsFloatImpl()
const;
293 DLLEXPORT QoreStringNodeMaker(
const char* fmt, ...);
296 QoreStringNodeMaker(
const QoreStringNodeMaker& str) =
delete;
297 QoreStringNodeMaker& operator=(
const QoreStringNodeMaker&) =
delete;
364 void*
operator new(size_t) =
delete;
428 void*
operator new(size_t) =
delete;
434#include <qore/ReferenceHolder.h>
489 void*
operator new(size_t) =
delete;
DLLEXPORT const QoreEncoding * QCS_DEFAULT
the default encoding for the Qore library
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
holds arbitrary binary data
Definition: BinaryNode.h:41
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:93
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:50
defines string encoding functions in Qore
Definition: QoreEncoding.h:83
safely manages the return values to AbstractQoreNode::getAsString(), stack only, cannot be dynamicall...
Definition: QoreStringNode.h:454
DLLEXPORT QoreNodeAsStringHelper(const AbstractQoreNode *n, int format_offset, ExceptionSink *xsink)
makes the call to AbstractQoreNode::getAsString() and manages the return values
DLLEXPORT const QoreString * operator->()
returns the object being managed
DLLEXPORT const QoreString * operator*()
returns the object being managed
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 QoreString * giveString()
returns a copy of the QoreString that the caller owns
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
DLLEXPORT size_t length() const
returns the number of characters (not bytes) in the string
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
DLLEXPORT QoreStringNode(const char *str, size_t len, const QoreEncoding *new_qorecharset=QCS_DEFAULT)
copies the c-string passed (up to len) and assigns the encoding passed
DLLEXPORT QoreStringNode * regexSubst(QoreString &match, QoreString &subst, int opts, ExceptionSink *xsink) const
performs perl5-compatible regular expression substitution
DLLEXPORT int getAsString(QoreString &str, int format_offset, ExceptionSink *xsink) const
concatenates the string data in double quotes to an existing QoreString
DLLEXPORT QoreStringNode(const std::string &str, const QoreEncoding *enc=QCS_DEFAULT)
creates a new object from a std::string and sets the character encoding
DLLEXPORT QoreStringNode * extract(qore_offset_t offset, ExceptionSink *xsink)
removes characters from the string starting at position "offset" and returns a string of the characte...
DLLLOCAL QoreStringNode(hashdecl qore_string_private *p)
constructor using the private implementation of QoreString; not exported in the library
DLLLOCAL QoreStringNode(const char *str, const QoreEncoding *from, const QoreEncoding *to, ExceptionSink *xsink)
constructor supporting createAndConvertEncoding(), not exported in the library
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
static DLLEXPORT QoreStringNode * createAndConvertEncoding(const char *str, const QoreEncoding *from, const QoreEncoding *to, ExceptionSink *xsink)
creates a new QoreStringNode from a string and converts its encoding
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns the current string and sets del to false
DLLEXPORT QoreStringNode(const BinaryNode *bin, size_t maxlinelen)
creates a new string as the base64-encoded value of the binary object passed and ensures the maximum ...
virtual DLLLOCAL int parseInit(QoreValue &val, QoreParseContext &parse_context)
returns the type information
DLLEXPORT QoreStringNode * parseBase64ToString(const QoreEncoding *enc, ExceptionSink *xsink) const
parses the current string data as base64-encoded data and returns it as a QoreStringNode pointer owne...
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values for container types) with possible ...
DLLEXPORT QoreStringNode * extract(qore_offset_t offset, qore_offset_t length, ExceptionSink *xsink)
removes "length" characters from the string starting at position "offset" and returns a string of the...
DLLEXPORT QoreStringNode * convertEncoding(const QoreEncoding *nccs, ExceptionSink *xsink) const
converts the encoding of the string to the specified encoding, returns 0 if an error occurs,...
DLLEXPORT QoreStringNode(const char *str, const QoreEncoding *enc=QCS_DEFAULT)
creates a new object from a string and sets the character encoding
DLLEXPORT QoreStringNode * stringRefSelf() const
references the object and returns a non-const pointer to "this"
DLLEXPORT QoreStringNode()
creates an empty string and assigns the default encoding QCS_DEFAULT
DLLEXPORT QoreStringNode * extract(qore_offset_t offset, qore_offset_t length, QoreValue strn, ExceptionSink *xsink)
removes "length" characters from the string starting at position "offset" and replaces them with the ...
DLLEXPORT QoreStringNode * substr(qore_offset_t offset, ExceptionSink *xsink) const
returns a new string consisting of all the characters from the current string starting with character...
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreStringNode.h:275
DLLEXPORT QoreStringNode(const QoreString &str)
creates a new QoreStringNode from an existing QoreString reference
virtual DLLEXPORT void getStringRepresentation(QoreString &str) const
concatentates the value of the type to an existing QoreString reference
DLLEXPORT QoreStringNode * substr(qore_offset_t offset, qore_offset_t length, ExceptionSink *xsink) const
returns a new string consisting of "length" characters from the current string starting with characte...
DLLEXPORT QoreStringNode * reverse() const
return a QoreStringNode with the characters reversed
virtual DLLEXPORT DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this string
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values for container types) without type o...
DLLEXPORT QoreStringNode(const QoreStringNode &str)
creates a new QoreStringNode from an existing QoreStringNode reference
DLLEXPORT QoreStringNode(char *nbuf, size_t nlen, size_t nallocated, const QoreEncoding *enc)
creates a new object; takes ownership of the char pointer passed, all parameters are mandatory
virtual DLLEXPORT ~QoreStringNode()
destructor only called when references = 0, use deref() instead
DLLEXPORT QoreString * getAsString(bool &del, int format_offset, ExceptionSink *xsink) const
returns a QoreString giving the string data in double quotes
virtual DLLEXPORT void getDateTimeRepresentation(DateTime &dt) const
assigns the date representation of this string to the DateTime reference passed
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreStringNode.h:270
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object, the caller owns the reference count
DLLEXPORT QoreStringNode * parseBase64ToString(ExceptionSink *xsink) const
parses the string as a base64-encoded binary and returns the decoded value as a QoreStringNode
this class is used to safely manage calls to AbstractQoreNode::getStringRepresentation() when a QoreS...
Definition: QoreStringNode.h:378
DLLEXPORT bool is_temp() const
returns true if the reference being managed is temporary
DLLEXPORT QoreStringNode * getReferencedValue()
returns a referenced value - the caller will own the reference
DLLEXPORT ~QoreStringNodeValueHelper()
destroys the object and dereferences the QoreStringNode if it is a temporary pointer
DLLEXPORT const QoreStringNode * operator->()
returns the object being managed
DLLEXPORT QoreStringNodeValueHelper(const QoreValue n, const QoreEncoding *enc, ExceptionSink *xsink)
gets the QoreString representation and ensures that it's in the desired encoding
DLLEXPORT const QoreStringNode * operator*()
returns the object being managed
this class is used to safely manage calls to AbstractQoreNode::getStringRepresentation() when a simpl...
Definition: QoreStringNode.h:309
DLLEXPORT const QoreString * operator->()
returns the object being managed
DLLEXPORT ~QoreStringValueHelper()
destroys the object and deletes the QoreString pointer being managed if it was a temporary pointer
DLLEXPORT QoreStringValueHelper(const QoreValue n, const QoreEncoding *enc, ExceptionSink *xsink)
gets the QoreString representation and ensures that it's in the desired encoding
DLLEXPORT QoreString * giveString()
returns a copy of the QoreString that the caller owns
DLLEXPORT const QoreString * operator*()
returns the object being managed
DLLEXPORT QoreStringValueHelper(const QoreValue n)
creates the object and acquires a pointer to the QoreString representation of the QoreValue passed
DLLEXPORT char * giveBuffer()
returns a char* string that the caller owns and must free()
DLLEXPORT bool is_temp() const
returns true if the pointer being managed is temporary
manages a reference count of a pointer to a class that takes a simple "deref()" call with no argument...
Definition: ReferenceHolder.h:127
base class for simple value types
Definition: AbstractQoreNode.h:372
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
Definition: common.h:70
intptr_t qore_offset_t
used for offsets that could be negative
Definition: common.h:76
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
const qore_type_t NT_STRING
type value for QoreStringNode
Definition: node_types.h:45
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276