SkipCommentsReader module

Module contents

template<typename IteratorT>
class SkipCommentsReader

Loop over a set of lines and skip comments.

Comments in a text file are often denoted by some special character like ‘#’ as the first non-whitespace character on a line. This filter takes a stream of lines and produces a stream that omits all comment lines.

Note that we only intercept lines where the comment character is at the beginning of the line. This filter will not detect lines where you attempt to remove data at the end by putting the comment character somewhere in the middle.

We do not expect that you will instantiate this class directly. Its main purpose is to be part of the stack that makes up PointReader.

NOTE: Although the CommentCharacter member is a string and can have arbitrary length, we only care about the first character.

Public Types

typedef IteratorT inner_iterator_type
typedef IteratorT::value_type value_type
typedef value_type::value_type char_type
typedef SkipCommentsIterator iterator
typedef SkipCommentsIterator const const_iterator

Public Functions

SkipCommentsReader()
SkipCommentsReader(const SkipCommentsReader &other)
SkipCommentsReader(inner_iterator_type const &start, inner_iterator_type const &finish, std::string const &comment = "#")
virtual ~SkipCommentsReader()
void set_comment_character(std::string const &c)
std::string const &comment_character() const
SkipCommentsReader &operator=(SkipCommentsReader const &other)
bool operator==(SkipCommentsReader const &other) const
bool operator!=(SkipCommentsReader const &other) const
void set_input_range(inner_iterator_type const &start, inner_iterator_type const &finish)
iterator begin() const
iterator end() const
const_iterator const_begin() const
const_iterator const_end() const

Private Members

inner_iterator_type InnerBegin
inner_iterator_type InnerEnd
std::string CommentCharacter
class SkipCommentsIterator : public std::iterator<std::input_iterator_tag, inner_iterator_type::value_type, std::ptrdiff_t, const inner_iterator_type::value_type *, inner_iterator_type::value_type const&>

Public Types

template<>
typedef inner_iterator_type::value_type value_type
template<>
typedef inner_iterator_type::value_type::value_type char_type

Public Functions

template<>
SkipCommentsIterator()
template<>
SkipCommentsIterator(inner_iterator_type Begin, inner_iterator_type End, std::string const &Comment)
template<>
SkipCommentsIterator(SkipCommentsIterator const &other)
template<>
~SkipCommentsIterator()
template<>
SkipCommentsIterator &operator=(SkipCommentsIterator const &other)
template<>
value_type const &operator*() const
template<>
value_type const *operator->() const
template<>
SkipCommentsIterator &operator++()
template<>
SkipCommentsIterator &operator++(int)
template<>
bool operator==(SkipCommentsIterator const &other) const
template<>
bool operator!=(SkipCommentsIterator const &other) const

Private Functions

template<>
void _advance_to_valid_string()
template<>
bool _string_is_comment(value_type const &test_string) const

Private Members

template<>
inner_iterator_type InnerIterator
template<>
inner_iterator_type InnerEnd
template<>
std::string CommentCharacter