Defined in header <cparse/Cursor.hh>

unsigned long int getLineNumber() const noexcept;

Returns the one-based line number of the last character consumed via get() or safeGet(). Returns 0 before any character has been read.

Parameters

None.

Return value

The current line number, one-based. 0 if no character has been consumed yet.

Exceptions

noexcept.

Notes

Lines are advanced by the read that consumes the newline: after reading \n, the counter still reports the line the newline was on, and the next read starts line line + 1 at column 1. This is handled by the internal newLinePassed flag inside get() / safeGet().

Peeks — peek() and safePeek() — do not advance line or column.

See also