A fully typed iterator for walking CSV files
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake
include
scripts
src
test
.gitignore
CMakeLists.txt
LICENSE
Makefile
README.markdown

README.markdown

csv_iterator

A flexible iterator library written in C++ for traversing CSV files

Usage:

Just copy the the files under the folder include in your include files. In your code include the csv_iterator.hpp header and using the boost tuples declare an iterator reading from an istream. The contructor without arguments is a synomim for the end of the stream.

The minimal example would be:

#include <fstream>
#include <boost/tuple/tuple.hpp>
#include <csv_iterator.hpp>

using namespace boost::tuples;
typedef tuple<int,std::string,double> record;

void myFunc(const record& value){
    // Your code here
}

int main(int argc, const char *argv[])
{
    // Example of csv_iterator usage
    std::ifstream in("myCsvFile.csv");
    csv::iterator<record> it(in);

    // Use the iterator in your algorithms.
    std::for_each(it, csv::iterator<record>(), myFunc);

    return 0;
}

Testing

In order to ensure that the libraries work for your platform type make test

Libraries:

sudo apt-get install cmake libboost-dev liboost-iostreams-dev