\hypertarget{class_qore_1_1_file_line_iterator}{}\doxysection{Qore\+::File\+Line\+Iterator Class Reference}
\label{class_qore_1_1_file_line_iterator}\index{Qore::FileLineIterator@{Qore::FileLineIterator}}


This class defines a line iterator for text files.  




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



Inheritance diagram for Qore\+::File\+Line\+Iterator\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=223pt]{class_qore_1_1_file_line_iterator__inherit__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_file_line_iterator_abf669d5c3e7bbfa809b22c930ea237d8}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} eol, bool \mbox{\hyperlink{group__string__functions_gae8d314e819a299d46d181696600d4293}{trim}}=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}, \+\_\+\+\_\+7\+\_\+ bool nonblocking\+\_\+open)
\begin{DoxyCompactList}\small\item\em Opens the given file for reading with the given options and creates the \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}} object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_file_line_iterator_a00df8c3068548371230467c0cbca0169}{copy}} ()
\begin{DoxyCompactList}\small\item\em Creates a new \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}} object, based on the same object being iterated in the original object (the original file is reopened) \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_file_line_iterator_ada463647abb761af55b6b6964c80c299}{get\+Encoding}} ()
\begin{DoxyCompactList}\small\item\em Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the File\+Line\+Iterator. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a06a105043332a4c4ff52a3c2d3bcc163}{get\+File\+Name}} ()
\begin{DoxyCompactList}\small\item\em Returns the file path/name used to open the file. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a0d738d5e8d770c1e50baf275e9ca3981}{get\+Line}} ()
\begin{DoxyCompactList}\small\item\em Returns the current line in the file or throws an {\ttfamily ITERATOR-\/\+ERROR} exception if the iterator is invalid. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a83dc18c41ade9e9503d3d21785accbd3}{get\+Value}} ()
\begin{DoxyCompactList}\small\item\em Returns the current line in the file or throws an {\ttfamily ITERATOR-\/\+ERROR} exception if the iterator is invalid. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a380f6f72150723ecdc2a81f0d56d5b73}{hstat}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash of \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a380f6f72150723ecdc2a81f0d56d5b73}{hstat()}} of the underlying file. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a9eb374145fd48a41420b96684ff895f5}{index}} ()
\begin{DoxyCompactList}\small\item\em Returns the current iterator line number in the file (the first line is line 1) or 0 if not pointing at a valid element. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a33ae9488dfc60606876eb1f4c9b2be9a}{is\+Tty}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}} is connected to a terminal device, \mbox{\hyperlink{basic_data_types_False}{False}} if not. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a9e6ad34f365bfeb5e4bcd045daf43921}{next}} ()
\begin{DoxyCompactList}\small\item\em Moves the current position to the next line in the file; returns \mbox{\hyperlink{basic_data_types_False}{False}} if there are no more lines to read; if the iterator is not pointing at a valid element before this call, the iterator will be positioned to the beginning of the file. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_file_line_iterator_aa202848cc75284b73f315a07fdd0e0b2}{reset}} ()
\begin{DoxyCompactList}\small\item\em Reset the iterator instance to its initial state. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a86c97b9e42d4b6f5a4871a89b29b51fb}{stat}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} of \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a86c97b9e42d4b6f5a4871a89b29b51fb}{stat()}} of the underlying file. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a93c4a650206085736f7bf8efe89ff613}{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 a line iterator for text files. 

\begin{DoxySince}{Since}
Qore 0.\+8.\+6
\end{DoxySince}
\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+: File\+Line\+Iterator basic usage}

\begin{DoxyCode}{0}
\DoxyCodeLine{file content:}
\DoxyCodeLine{a2ps-\/4.13-\/1332.1.x86\_64}
\DoxyCodeLine{a2ps-\/devel-\/4.13-\/1332.1.x86\_64}
\DoxyCodeLine{aaa\_base-\/11.3-\/7.2.x86\_64}
\DoxyCodeLine{...}
\DoxyCodeLine{}
\DoxyCodeLine{FileLineIterator it(\textcolor{stringliteral}{"{}/export/home/pvanek/ren.list"{}});}
\DoxyCodeLine{\textcolor{keywordflow}{while} (it.next()) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}\%s:\%d = \%n\(\backslash\)n"{}}, it.getFileName(), it.index(), it.getValue());}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{/export/home/pvanek/ren.list:1 = \textcolor{stringliteral}{"{}a2ps-\/4.13-\/1332.1.x86\_64"{}}}
\DoxyCodeLine{/export/home/pvanek/ren.list:2 = \textcolor{stringliteral}{"{}a2ps-\/devel-\/4.13-\/1332.1.x86\_64"{}}}
\DoxyCodeLine{/export/home/pvanek/ren.list:3 = \textcolor{stringliteral}{"{}aaa\_base-\/11.3-\/7.2.x86\_64"{}}}
\DoxyCodeLine{...}
\DoxyCodeLine{/export/home/pvanek/ren.list:2155 = \textcolor{stringliteral}{"{}zypper-\/1.4.5-\/1.10.x86\_64"{}}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_input_stream_line_iterator}{Qore\+::\+Input\+Stream\+Line\+Iterator}} 

\mbox{\hyperlink{class_qore_1_1_data_line_iterator}{Qore\+::\+Data\+Line\+Iterator}} 
\end{DoxySeeAlso}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_abf669d5c3e7bbfa809b22c930ea237d8}\label{class_qore_1_1_file_line_iterator_abf669d5c3e7bbfa809b22c930ea237d8}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+File\+Line\+Iterator\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{eol,  }\item[{bool}]{trim = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}},  }\item[{\+\_\+\+\_\+7\+\_\+ bool}]{nonblocking\+\_\+open }\end{DoxyParamCaption})}



Opens the given file for reading with the given options and creates the \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}} object. 


\begin{DoxyParams}{Parameters}
{\em path} & the path to open for reading \\
\hline
{\em encoding} & character encoding of the data in the file; if not ASCII-\/compatible, all data will be converted to UTF-\/8; if not present, the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} is assumed \\
\hline
{\em eol} & the optional end of line character(s) to use to detect lines in the file; if this string is not passed, then the end of line character(s) are detected automatically, and can be either {\ttfamily \char`\"{}\textbackslash{}n\char`\"{}}, {\ttfamily \char`\"{}\textbackslash{}r\char`\"{}}, or {\ttfamily \char`\"{}\textbackslash{}r\textbackslash{}n\char`\"{}} (the last one is only automatically detected when not connected to a terminal device in order to keep the I/O from stalling); if this string is passed and has a different \mbox{\hyperlink{character_encoding}{character encoding}} from this object\textquotesingle{}s (as determined by the {\ttfamily encoding} parameter), then it will be converted to the \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}}\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}} \\
\hline
{\em trim} & if \mbox{\hyperlink{basic_data_types_True}{True}} the string return values for the lines iterated will be trimmed of the eol bytes \\
\hline
{\em nonblocking\+\_\+open} & if \mbox{\hyperlink{basic_data_types_True}{True}}, then the {\ttfamily O\+\_\+\+NONBLOCK} flag will be set in the call to {\ttfamily open() (2)}\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em ENCODING-\/\+CONVERSION-\/\+ERROR} & this exception could be thrown if the eol argument has a different \mbox{\hyperlink{character_encoding}{character encoding}} from the \mbox{\hyperlink{class_qore_1_1_file}{File}}\textquotesingle{}s and an error occurs during encoding conversion \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & \mbox{\hyperlink{class_qore_1_1_file_line_iterator_abf669d5c3e7bbfa809b22c930ea237d8}{File\+Line\+Iterator\+::constructor()}} cannot be called with a TTY target when \mbox{\hyperlink{parse_directives_no-terminal-io}{\%no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+9.\+3 added the {\itshape nonblocking\+\_\+open} flag 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a00df8c3068548371230467c0cbca0169}\label{class_qore_1_1_file_line_iterator_a00df8c3068548371230467c0cbca0169}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!copy@{copy}}
\index{copy@{copy}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+File\+Line\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Creates a new \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}} object, based on the same object being iterated in the original object (the original file is reopened) 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{FileLineIterator ni = i.copy();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & \mbox{\hyperlink{class_qore_1_1_file_line_iterator_abf669d5c3e7bbfa809b22c930ea237d8}{File\+Line\+Iterator\+::constructor()}} cannot be called with a TTY target when \mbox{\hyperlink{parse_directives_no-terminal-io}{\%no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_ada463647abb761af55b6b6964c80c299}\label{class_qore_1_1_file_line_iterator_ada463647abb761af55b6b6964c80c299}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!getEncoding@{getEncoding}}
\index{getEncoding@{getEncoding}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{getEncoding()}{getEncoding()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+File\+Line\+Iterator\+::get\+Encoding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the File\+Line\+Iterator. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string encoding = f.getEncoding();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the \mbox{\hyperlink{character_encoding}{character encoding}} for the File\+Line\+Iterator 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a06a105043332a4c4ff52a3c2d3bcc163}\label{class_qore_1_1_file_line_iterator_a06a105043332a4c4ff52a3c2d3bcc163}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!getFileName@{getFileName}}
\index{getFileName@{getFileName}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{getFileName()}{getFileName()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+File\+Line\+Iterator\+::get\+File\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the file path/name used to open the file. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string fn = f.getFileName();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the file path/name used to open the file 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a0d738d5e8d770c1e50baf275e9ca3981}\label{class_qore_1_1_file_line_iterator_a0d738d5e8d770c1e50baf275e9ca3981}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!getLine@{getLine}}
\index{getLine@{getLine}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{getLine()}{getLine()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+File\+Line\+Iterator\+::get\+Line (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



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

\begin{DoxyReturn}{Returns}
the current line in the file or throws an {\ttfamily ITERATOR-\/\+ERROR} exception if the iterator is invalid
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}}
\end{DoxyParagraph}
\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 ITERATOR-\/\+ERROR} & the iterator is not pointing at a valid element \\
\hline
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_file_line_iterator_a83dc18c41ade9e9503d3d21785accbd3}{File\+Line\+Iterator\+::get\+Value()}} 
\end{DoxySeeAlso}


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

\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a83dc18c41ade9e9503d3d21785accbd3}\label{class_qore_1_1_file_line_iterator_a83dc18c41ade9e9503d3d21785accbd3}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!getValue@{getValue}}
\index{getValue@{getValue}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{getValue()}{getValue()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+File\+Line\+Iterator\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



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

\begin{DoxyReturn}{Returns}
the current line in the file or throws an {\ttfamily ITERATOR-\/\+ERROR} exception if the iterator is invalid
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}}
\end{DoxyParagraph}
\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 ITERATOR-\/\+ERROR} & the iterator is not pointing at a valid element \\
\hline
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_file_line_iterator_a0d738d5e8d770c1e50baf275e9ca3981}{File\+Line\+Iterator\+::get\+Line()}} 
\end{DoxySeeAlso}


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

\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a380f6f72150723ecdc2a81f0d56d5b73}\label{class_qore_1_1_file_line_iterator_a380f6f72150723ecdc2a81f0d56d5b73}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!hstat@{hstat}}
\index{hstat@{hstat}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{hstat()}{hstat()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ Qore\+::\+File\+Line\+Iterator\+::hstat (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash of \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a380f6f72150723ecdc2a81f0d56d5b73}{hstat()}} of the underlying file. 

If any errors occur, a {\ttfamily FILE-\/\+HSTAT-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<StatInfo> h = f.hstat();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash of \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a380f6f72150723ecdc2a81f0d56d5b73}{hstat()}} of the underlying file
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 0.\+8.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a9eb374145fd48a41420b96684ff895f5}\label{class_qore_1_1_file_line_iterator_a9eb374145fd48a41420b96684ff895f5}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!index@{index}}
\index{index@{index}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{index()}{index()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+File\+Line\+Iterator\+::index (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



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

\begin{DoxyReturn}{Returns}
the current iterator line number in the file (the first line is line 1) or 0 if not pointing at a valid element
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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

\end{DoxyCode}
 
\end{DoxyParagraph}


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

\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a33ae9488dfc60606876eb1f4c9b2be9a}\label{class_qore_1_1_file_line_iterator_a33ae9488dfc60606876eb1f4c9b2be9a}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!isTty@{isTty}}
\index{isTty@{isTty}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{isTty()}{isTty()}}
{\footnotesize\ttfamily bool Qore\+::\+File\+Line\+Iterator\+::is\+Tty (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}} is connected to a terminal device, \mbox{\hyperlink{basic_data_types_False}{False}} if not. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{File\+Line\+Iterator}} is connected to a terminal device, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = i.isTty();}

\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a9e6ad34f365bfeb5e4bcd045daf43921}\label{class_qore_1_1_file_line_iterator_a9e6ad34f365bfeb5e4bcd045daf43921}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!next@{next}}
\index{next@{next}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{next()}{next()}}
{\footnotesize\ttfamily bool Qore\+::\+File\+Line\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Moves the current position to the next line in the file; returns \mbox{\hyperlink{basic_data_types_False}{False}} if there are no more lines to read; if the iterator is not pointing at a valid element before this call, the iterator will be positioned to the beginning of the file. 

This method will return \mbox{\hyperlink{basic_data_types_True}{True}} again after it returns \mbox{\hyperlink{basic_data_types_False}{False}} once if file 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 file (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.getValue());}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}


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

\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_aa202848cc75284b73f315a07fdd0e0b2}\label{class_qore_1_1_file_line_iterator_aa202848cc75284b73f315a07fdd0e0b2}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!reset@{reset}}
\index{reset@{reset}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{reset()}{reset()}}
{\footnotesize\ttfamily Qore\+::\+File\+Line\+Iterator\+::reset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reset the iterator instance to its initial state. 

Reset the iterator instance to its initial state

\begin{DoxyParagraph}{Example}

\begin{DoxyCode}{0}
\DoxyCodeLine{i.reset();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a86c97b9e42d4b6f5a4871a89b29b51fb}\label{class_qore_1_1_file_line_iterator_a86c97b9e42d4b6f5a4871a89b29b51fb}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!stat@{stat}}
\index{stat@{stat}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{stat()}{stat()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ Qore\+::\+File\+Line\+Iterator\+::stat (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} of \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a86c97b9e42d4b6f5a4871a89b29b51fb}{stat()}} of the underlying file. 

If any errors occur, a {\ttfamily FILE-\/\+HSTAT-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{list<auto> l = f.stat();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} of \mbox{\hyperlink{class_qore_1_1_file_line_iterator_a86c97b9e42d4b6f5a4871a89b29b51fb}{stat()}} of the underlying file 
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 0.\+8.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_file_line_iterator_a93c4a650206085736f7bf8efe89ff613}\label{class_qore_1_1_file_line_iterator_a93c4a650206085736f7bf8efe89ff613}} 
\index{Qore::FileLineIterator@{Qore::FileLineIterator}!valid@{valid}}
\index{valid@{valid}!Qore::FileLineIterator@{Qore::FileLineIterator}}
\doxysubsubsection{\texorpdfstring{valid()}{valid()}}
{\footnotesize\ttfamily bool Qore\+::\+File\+Line\+Iterator\+::valid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [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}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\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_line_iterator_a06fc51d01bfae9f17f290ac247ffd3f3}{Qore\+::\+Abstract\+Line\+Iterator}}.

