ATLAS Offline Software
Loading...
Searching...
No Matches
LineFormatter Class Reference

#include <LineFormatter.h>

Collaboration diagram for LineFormatter:

Public Member Functions

 LineFormatter (std::size_t perline)
template<typename T>
std::string operator() (const std::vector< T > &v)

Private Attributes

std::size_t m_perline

Detailed Description

Definition at line 14 of file LineFormatter.h.

Constructor & Destructor Documentation

◆ LineFormatter()

LineFormatter::LineFormatter ( std::size_t perline)
inline

Definition at line 16 of file LineFormatter.h.

16 :m_perline(perline){
17 }
std::size_t m_perline

Member Function Documentation

◆ operator()()

template<typename T>
std::string LineFormatter::operator() ( const std::vector< T > & v)
inline

Definition at line 19 of file LineFormatter.h.

19 {
20 std::size_t count{0};
21 std::size_t linecount{0};
22 std::ostringstream oss{"", std::ios::ate};
23 oss << linecount << '|' << " ";
24 for (const auto& e : v){
25 if (count == m_perline){
26 count = 0;
27 linecount += m_perline;
28 oss << '\n'<<linecount<< '|' << " ";
29 }
30 oss << e << " ";
31 ++count;
32 }
33 // if(count != 0){oss << '\n';}
34 return oss.str();
35 }
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

Member Data Documentation

◆ m_perline

std::size_t LineFormatter::m_perline
private

Definition at line 38 of file LineFormatter.h.


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