Functions
CSVExporter.cxx File Reference
#include "CSVExporter.h"
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits>
#include <stdexcept>
#include <functional>

Go to the source code of this file.

Functions

template<typename T , typename S >
bool printSeparatedValues (std::ostream &output, const std::vector< T > &values, bool firstValuePrinted, S separator, std::function< void(std::ostream &, const T &)> printValue)
 

Function Documentation

template<typename T , typename S >
bool printSeparatedValues ( std::ostream &  output,
const std::vector< T > &  values,
bool  firstValuePrinted,
S  separator,
std::function< void(std::ostream &, const T &)>  printValue 
)

Definition at line 11 of file CSVExporter.cxx.

18 {
19  if (values.empty()) {
20  return firstValuePrinted;
21  }
22 
23  size_t startIdx = 0;
24 
25  if (! firstValuePrinted)
26  {
27  printValue(output, values[0]);
28  startIdx = 1;
29  }
30 
31  for (size_t i = startIdx; i < values.size(); i++)
32  {
33  output << separator;
34  printValue(output, values[i]);
35  }
36 
37  return true;
38 }
void printValue(T val)