32#ifndef _QORE_INPUTSTREAMLINEITERATOR_H
33#define _QORE_INPUTSTREAMLINEITERATOR_H
38#include "qore/InputStream.h"
39#include "qore/intern/BufferedStreamReader.h"
40#include "qore/intern/StreamReader.h"
41#include "qore/intern/EncodingConversionInputStream.h"
49 const QoreStringNode* n_eol,
bool n_trim,
size_t bufsize = DefaultStreamBufferSize) :
54 if (assignEol(n_eol, xsink))
66 enc(sr->getEncoding()),
68 if (assignEol(n_eol, xsink))
72 if (enc != sr->getEncoding()) {
82 if (validp && line && !line->
empty()) {
85 validp = getLine(xsink);
96 DLLLOCAL
int64 index()
const {
105 DLLLOCAL
bool valid()
const {
111 xsink->
raiseException(
"ITERATOR-ERROR",
"the %s is not pointing at a valid element; make sure %s::next() "
112 "returns True before calling this method", getName(), getName());
132 DLLLOCAL
virtual const char* getName()
const {
133 return "InputStreamLineIterator";
136 DLLLOCAL
virtual const QoreTypeInfo* getElementType()
const {
137 return stringTypeInfo;
142 if (!n_eol || n_eol->
empty()) {
150 eol = q_remove_bom_utf16(neol.release(), enc);
158 line = reader->
readLine(*eol, trim, xsink);
DLLLOCAL void ref() const
increments the reference count of the object
Definition AbstractPrivateData.h:51
Private data for the Qore::BufferedStreamReader class.
Definition BufferedStreamReader.h:45
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition ExceptionSink.h:50
DLLEXPORT AbstractQoreNode * raiseException(const char *err, const char *fmt,...)
appends a Qore-language exception to the list
defines string encoding functions in Qore
Definition QoreEncoding.h:83
abstract base class for iterator private data
Definition QoreIteratorBase.h:68
DLLEXPORT bool ROdereference() const
Atomically decrements the reference count.
DLLEXPORT const QoreEncoding * getEncoding() const
returns the encoding for the string
DLLEXPORT bool empty() const
returns true if the string is empty, false if not
Qore's string value type, reference counted, dynamically-allocated only.
Definition QoreStringNode.h:50
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 * stringRefSelf() const
references the object and returns a non-const pointer to "this"
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition ReferenceHolder.h:52
manages a reference count of a pointer to a class that takes a simple "deref()" call with no argument...
Definition ReferenceHolder.h:127
Private data for the Qore::StreamReader class.
Definition StreamReader.h:45
DLLLOCAL QoreStringNode * readLine(const QoreStringNode *eol, bool trim, ExceptionSink *xsink)
Read one line.
Definition StreamReader.h:126
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:266