class line_iterator

Declaration

class line_iterator { /* full declaration omitted */ };

Description

A forward iterator which reads text lines from a buffer. This class provides a forward iterator interface for reading one line at a time from a buffer. When default constructed the iterator will be the "end" iterator. The iterator is aware of what line number it is currently processing. It strips blank lines by default, and comment lines given a comment-starting character. Note that this iterator requires the buffer to be nul terminated.

Declared at: llvm/include/llvm/Support/LineIterator.h:33

Member Variables

private Optional<llvm::MemoryBufferRef> Buffer
private char CommentMarker = '\x00'
private bool SkipBlanks = true
private unsigned int LineNumber = 1
private llvm::StringRef CurrentLine

Method Overview

Methods

void advance()

Description

Advance the iterator to the next line.

Declared at: llvm/include/llvm/Support/LineIterator.h:94

bool is_at_end() const

Description

Return true if we're an "end" iterator or have reached EOF.

Declared at: llvm/include/llvm/Support/LineIterator.h:63

bool is_at_eof() const

Description

Return true if we've reached EOF or are an "end" iterator.

Declared at: llvm/include/llvm/Support/LineIterator.h:60

line_iterator()

Description

Default construct an "end" iterator.

Declared at: llvm/include/llvm/Support/LineIterator.h:49

line_iterator(const llvm::MemoryBufferRef& Buffer,
              bool SkipBlanks = true,
              char CommentMarker = '\x00')

Description

Construct a new iterator around an unowned memory buffer.

Declared at: llvm/include/llvm/Support/LineIterator.h:52

Parameters

const llvm::MemoryBufferRef& Buffer
bool SkipBlanks = true
char CommentMarker = '\x00'

line_iterator(const llvm::MemoryBuffer& Buffer,
              bool SkipBlanks = true,
              char CommentMarker = '\x00')

Description

Construct a new iterator around some memory buffer.

Declared at: llvm/include/llvm/Support/LineIterator.h:56

Parameters

const llvm::MemoryBuffer& Buffer
bool SkipBlanks = true
char CommentMarker = '\x00'

int64_t line_number() const

Description

Return the current line number. May return any number at EOF.

Declared at: llvm/include/llvm/Support/LineIterator.h:66