\hypertarget{class_qore_1_1_abstract_line_iterator}{}\doxysection{Qore\+::Abstract\+Line\+Iterator Class Reference}
\label{class_qore_1_1_abstract_line_iterator}\index{Qore::AbstractLineIterator@{Qore::AbstractLineIterator}}


This class defines an abstract interface for line iterators.  




{\ttfamily \#include $<$QC\+\_\+\+Abstract\+Line\+Iterator.\+dox.\+h$>$}



Inheritance diagram for Qore\+::Abstract\+Line\+Iterator\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{class_qore_1_1_abstract_line_iterator__inherit__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
abstract \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_a8ad4c0503f09b24e93bbeac266f2b2a0}{get\+Line}} ()
\begin{DoxyCompactList}\small\item\em Returns the current line in the data or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} $>$ \mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_a6e572b42827159c979e52eedd5485015}{get\+Split\+Line}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sep, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} quote, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} eol=\char`\"{}\textbackslash{}n\char`\"{}, bool trim\+\_\+unquoted=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}})
\begin{DoxyCompactList}\small\item\em Returns the current line and splits the string into a list of components based on a separator string and a quote character. \end{DoxyCompactList}\item 
abstract \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_acc1342afce2820c3d1dded7aeb2b8dd8}{get\+Value}} ()
\begin{DoxyCompactList}\small\item\em Returns the current line in the data or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid. \end{DoxyCompactList}\item 
abstract \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_acde61f19ac0b96adcaafbe4962e9a335}{index}} ()
\begin{DoxyCompactList}\small\item\em Returns the current iterator line number (the first line is line 1) or 0 if not pointing at a valid element. \end{DoxyCompactList}\item 
abstract bool \mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_ac5f7742a325b335f3cd2ab0bb5f37272}{next}} ()
\begin{DoxyCompactList}\small\item\em Moves the current position to the next line; returns \mbox{\hyperlink{basic_data_types_False}{False}} if there are no more lines to read. \end{DoxyCompactList}\item 
abstract bool \mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_a06fc51d01bfae9f17f290ac247ffd3f3}{valid}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the iterator is currently pointing at a valid element, \mbox{\hyperlink{basic_data_types_False}{False}} if not. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This class defines an abstract interface for line iterators. 

Classes inheriting this class can be used to iterate lines from various sources.

\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_abstract_line_iterator_a8ad4c0503f09b24e93bbeac266f2b2a0}\label{class_qore_1_1_abstract_line_iterator_a8ad4c0503f09b24e93bbeac266f2b2a0}} 
\index{Qore::AbstractLineIterator@{Qore::AbstractLineIterator}!getLine@{getLine}}
\index{getLine@{getLine}!Qore::AbstractLineIterator@{Qore::AbstractLineIterator}}
\doxysubsubsection{\texorpdfstring{getLine()}{getLine()}}
{\footnotesize\ttfamily abstract \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Abstract\+Line\+Iterator\+::get\+Line (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Returns the current line in the data or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid. 

\begin{DoxyReturn}{Returns}
the current line in the data
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}+ \%y\(\backslash\)n"{}}, i.getLine());}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element \\
\hline
\end{DoxyExceptions}


Implemented in \mbox{\hyperlink{class_qore_1_1_data_line_iterator_affdfe2642623b31f782eda63e98f5d76}{Qore\+::\+Data\+Line\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a0d738d5e8d770c1e50baf275e9ca3981}{Qore\+::\+File\+Line\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_input_stream_line_iterator_a97843613b1efffb8191a982b034ad35e}{Qore\+::\+Input\+Stream\+Line\+Iterator}}.

\mbox{\Hypertarget{class_qore_1_1_abstract_line_iterator_a6e572b42827159c979e52eedd5485015}\label{class_qore_1_1_abstract_line_iterator_a6e572b42827159c979e52eedd5485015}} 
\index{Qore::AbstractLineIterator@{Qore::AbstractLineIterator}!getSplitLine@{getSplitLine}}
\index{getSplitLine@{getSplitLine}!Qore::AbstractLineIterator@{Qore::AbstractLineIterator}}
\doxysubsubsection{\texorpdfstring{getSplitLine()}{getSplitLine()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} $>$ Qore\+::\+Abstract\+Line\+Iterator\+::get\+Split\+Line (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sep,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{quote,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{eol = {\ttfamily \char`\"{}\textbackslash{}n\char`\"{}},  }\item[{bool}]{trim\+\_\+unquoted = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})}



Returns the current line and splits the string into a list of components based on a separator string and a quote character. 

Retrieves additional lines if the last is quoted and is not terimated; this way fields can contain multiple lines

The quote character can appear as the first part of a field, in which case it is assumed to designate the entire field. If instances of the quote character are found in the field preceded by a backquote character ({\ttfamily \char`\"{}\textbackslash{}\char`\"{}),     then these quote characters are included as part of the field\textquotesingle{}s text and not treated as quote characters.\textbackslash{}n     Also the separator character can appear as a part of a field with this variant.\textbackslash{}n     This variant is useful for parsing CSV files, for example.     @par Code Flags\+:     @ref RET\+\_\+\+VALUE\+\_\+\+ONLY  @param sep the separator string; if the separator string is not found in the string to split, then a list with     only one element containing the entire string argument is returned\textquotesingle{}; if this string has a different     @ref character\+\_\+encoding \char`\"{}character} encoding\char`\"{} than \textbackslash{}a str, then it will be converted to $<$em$>$str$<$/em$>$\textquotesingle{}s     @ref character\+\_\+encoding \char`\"{}character encoding\char`\"{} @param quote the quote character @param eol the end of line string to be readded in case of a field split between lines @param trim\+\_\+unquoted remove leading and trailing whitespace from unquoted fields      @return a list of each component of a string separated by a separator string, with the separator and any enclosing     quote characters removed      @par Example\+:     @code\{.\+py\}  list$<$string$>$ list = \char`\"{}some,\textquotesingle{}text with spaces, and commas, here is another one! ,\textquotesingle{},here\char`\"{}.\+split(\char`\"{},\char`\"{}, \char`\"{}\textquotesingle{}\char`\"{}); \# returns (\char`\"{}some\char`\"{}, \char`\"{}, and commas, here is another one! ,\char`\"{}, \char`\"{}here\char`\"{})     @endcode      @throw ENCODING-\/\+CONVERSION-\/\+ERROR this exception could be thrown if the string arguments have different     @ref character\+\_\+encoding \char`\"{}character encodings"{} and an error occurs during encoding conversion 
\begin{DoxyExceptions}{Exceptions}
{\em SPLIT-\/\+ERROR} & field missing closing quote character; extra text following quoted field\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}

\begin{DoxyItemize}
\item Qore 0.\+9.\+8 added this method 
\end{DoxyItemize}
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_abstract_line_iterator_acc1342afce2820c3d1dded7aeb2b8dd8}\label{class_qore_1_1_abstract_line_iterator_acc1342afce2820c3d1dded7aeb2b8dd8}} 
\index{Qore::AbstractLineIterator@{Qore::AbstractLineIterator}!getValue@{getValue}}
\index{getValue@{getValue}!Qore::AbstractLineIterator@{Qore::AbstractLineIterator}}
\doxysubsubsection{\texorpdfstring{getValue()}{getValue()}}
{\footnotesize\ttfamily abstract \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Abstract\+Line\+Iterator\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Returns the current line in the data or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid. 

This method calls \mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_a8ad4c0503f09b24e93bbeac266f2b2a0}{Abstract\+Line\+Iterator\+::get\+Line()}} internally. \begin{DoxyReturn}{Returns}
the current line in the data
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}+ \%y\(\backslash\)n"{}}, i.getValue());}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_abstract_line_iterator_a8ad4c0503f09b24e93bbeac266f2b2a0}{Abstract\+Line\+Iterator\+::get\+Line()}} 
\end{DoxySeeAlso}


Implements \mbox{\hyperlink{class_qore_1_1_abstract_iterator_aa01374b285003faa21b045082063ac12}{Qore\+::\+Abstract\+Iterator}}.



Implemented in \mbox{\hyperlink{class_qore_1_1_data_line_iterator_a0d695de4158d1f10ded8071ae96d3b88}{Qore\+::\+Data\+Line\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a83dc18c41ade9e9503d3d21785accbd3}{Qore\+::\+File\+Line\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_input_stream_line_iterator_ac20e677f7b65af6efcad994e8baffcf0}{Qore\+::\+Input\+Stream\+Line\+Iterator}}.

\mbox{\Hypertarget{class_qore_1_1_abstract_line_iterator_acde61f19ac0b96adcaafbe4962e9a335}\label{class_qore_1_1_abstract_line_iterator_acde61f19ac0b96adcaafbe4962e9a335}} 
\index{Qore::AbstractLineIterator@{Qore::AbstractLineIterator}!index@{index}}
\index{index@{index}!Qore::AbstractLineIterator@{Qore::AbstractLineIterator}}
\doxysubsubsection{\texorpdfstring{index()}{index()}}
{\footnotesize\ttfamily abstract \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Abstract\+Line\+Iterator\+::index (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Returns the current iterator line number (the first line is line 1) or 0 if not pointing at a valid element. 

\begin{DoxyReturn}{Returns}
the current iterator line number (the first line is line 1) or 0 if not pointing at a valid element
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}+ \%d: \%y\(\backslash\)n"{}}, i.index(), i.getLine());}
\DoxyCodeLine{\}}

\end{DoxyCode}
 
\end{DoxyParagraph}


Implemented in \mbox{\hyperlink{class_qore_1_1_data_line_iterator_a2e9f211ca438b8b3f8a122b040ce46ae}{Qore\+::\+Data\+Line\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a9eb374145fd48a41420b96684ff895f5}{Qore\+::\+File\+Line\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_input_stream_line_iterator_ac2a16a29cd14271505149e96c144c814}{Qore\+::\+Input\+Stream\+Line\+Iterator}}.

\mbox{\Hypertarget{class_qore_1_1_abstract_line_iterator_ac5f7742a325b335f3cd2ab0bb5f37272}\label{class_qore_1_1_abstract_line_iterator_ac5f7742a325b335f3cd2ab0bb5f37272}} 
\index{Qore::AbstractLineIterator@{Qore::AbstractLineIterator}!next@{next}}
\index{next@{next}!Qore::AbstractLineIterator@{Qore::AbstractLineIterator}}
\doxysubsubsection{\texorpdfstring{next()}{next()}}
{\footnotesize\ttfamily abstract bool Qore\+::\+Abstract\+Line\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Moves the current position to the next line; returns \mbox{\hyperlink{basic_data_types_False}{False}} if there are no more lines to read. 

This method will return \mbox{\hyperlink{basic_data_types_True}{True}} again after it returns \mbox{\hyperlink{basic_data_types_False}{False}} once if data is not empty, otherwise it will always return \mbox{\hyperlink{basic_data_types_False}{False}}. The iterator object should not be used after this method returns \mbox{\hyperlink{basic_data_types_False}{False}}.

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_False}{False}} if there are no more lines in the source (in which case the iterator object is invalid and should not be used); \mbox{\hyperlink{basic_data_types_True}{True}} if successful (meaning that the iterator object is valid)
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}line: \%y\(\backslash\)n"{}}, i.getLine());}
\DoxyCodeLine{\}}

\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_abstract_iterator_ab10d5694cc2fcd3b6689ea7494da79de}{Qore\+::\+Abstract\+Iterator}}.



Implemented in \mbox{\hyperlink{class_qore_1_1_data_line_iterator_afa97a63c0d6f6ae2410ae3c7ae68696e}{Qore\+::\+Data\+Line\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a9e6ad34f365bfeb5e4bcd045daf43921}{Qore\+::\+File\+Line\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_input_stream_line_iterator_a15869ee0a81ae224334f83f681b6e760}{Qore\+::\+Input\+Stream\+Line\+Iterator}}.

\mbox{\Hypertarget{class_qore_1_1_abstract_line_iterator_a06fc51d01bfae9f17f290ac247ffd3f3}\label{class_qore_1_1_abstract_line_iterator_a06fc51d01bfae9f17f290ac247ffd3f3}} 
\index{Qore::AbstractLineIterator@{Qore::AbstractLineIterator}!valid@{valid}}
\index{valid@{valid}!Qore::AbstractLineIterator@{Qore::AbstractLineIterator}}
\doxysubsubsection{\texorpdfstring{valid()}{valid()}}
{\footnotesize\ttfamily abstract bool Qore\+::\+Abstract\+Line\+Iterator\+::valid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the iterator is currently pointing at a valid element, \mbox{\hyperlink{basic_data_types_False}{False}} if not. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the iterator is currently pointing at a valid element, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (i.valid())}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}current value: \%y\(\backslash\)n"{}}, i.getValue());}

\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_abstract_iterator_aee1def5d872b487b8917a166d9b263e8}{Qore\+::\+Abstract\+Iterator}}.



Implemented in \mbox{\hyperlink{class_qore_1_1_data_line_iterator_af64f428889d1af031d68da288f2f9dbe}{Qore\+::\+Data\+Line\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a93c4a650206085736f7bf8efe89ff613}{Qore\+::\+File\+Line\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_input_stream_line_iterator_ad67679ac159cec3362a5faed21f0dcdb}{Qore\+::\+Input\+Stream\+Line\+Iterator}}.

