RobWorkProject  24.5.15-
Public Types | Public Member Functions | List of all members
MultipleFileIterator Class Reference

This class is used to iterate over multiple files, keeping track of the current file and current line number at all times. More...

#include <MultipleFileIterator.hpp>

Inherits iterator< std::bidirectional_iterator_tag, char >.

Public Types

typedef std::vector< std::pair< size_t, boost::spirit::classic::file_position > > PosToFileMap
 a map from a absolute iterator position to a file description.
 

Public Member Functions

 MultipleFileIterator (std::shared_ptr< std::vector< char >> data, std::shared_ptr< PosToFileMap > filedata)
 Constructor. More...
 
virtual ~MultipleFileIterator ()
 Constructor.
 
MultipleFileIteratoroperator++ ()
 Increases the position of the iterator by one.
 
MultipleFileIteratoroperator-- ()
 Decreases the position of the iterator by one.
 
char & operator* ()
 return reference to char that this interator points to
 
char * operator-> ()
 return pointer to char that this interator points to
 
MultipleFileIteratoroperator= (const MultipleFileIterator &other)
 assignment operator. Assignment is straight forward.
 
bool operator== (const MultipleFileIterator &other) const
 Tests whether the positions of two iterators are equal. More...
 
bool operator!= (const MultipleFileIterator &other) const
 Tests whether the positions of two iterators are unequal. More...
 
std::string getDirectory ()
 returns the directory of the file that the iterator is currently iterating through More...
 
boost::spirit::classic::file_position get_position () const
 returns the position in the file that the iterator is currently at More...
 
std::string getFile ()
 returns the file that the iterator is currently iterating More...
 
MultipleFileIterator begin ()
 returns a new begin iterator
 
MultipleFileIterator end ()
 return a new end iterator
 

Detailed Description

This class is used to iterate over multiple files, keeping track of the current file and current line number at all times.

Constructor & Destructor Documentation

◆ MultipleFileIterator()

MultipleFileIterator ( std::shared_ptr< std::vector< char >>  data,
std::shared_ptr< PosToFileMap filedata 
)

Constructor.

Parameters
data[in] vector of char data
filedata[in] data position to file info map

Member Function Documentation

◆ get_position()

boost::spirit::classic::file_position get_position ( ) const
inline

returns the position in the file that the iterator is currently at

Returns
the position of the iterator in the current file

◆ getDirectory()

std::string getDirectory ( )
inline

returns the directory of the file that the iterator is currently iterating through

Returns
the current directory

◆ getFile()

std::string getFile ( )
inline

returns the file that the iterator is currently iterating

Returns
filename of current file

◆ operator!=()

bool operator!= ( const MultipleFileIterator other) const
inline

Tests whether the positions of two iterators are unequal.

Parameters
other[in] VectorIterator to compare with
Returns
true if unequal

◆ operator==()

bool operator== ( const MultipleFileIterator other) const
inline

Tests whether the positions of two iterators are equal.

Parameters
other[in] VectorIterator to compare with
Returns
true if equal

The documentation for this class was generated from the following file: