nfd::tools::nfdc::text::Separator Class Reference

Print different string on first and subsequent usage. More...

#include <tools/nfdc/format-helpers.hpp>

+ Inheritance diagram for nfd::tools::nfdc::text::Separator:
+ Collaboration diagram for nfd::tools::nfdc::text::Separator:

Public Member Functions

 Separator (std::string_view first, std::string_view subsequent)
 
 Separator (std::string_view subsequent)
 
int getCount () const
 

Friends

std::ostream & operator<< (std::ostream &os, Separator &sep)
 

Detailed Description

Print different string on first and subsequent usage.

Separator sep(",");
for (int i = 1; i <= 3; ++i) {
os << sep << i;
}
// prints: 1,2,3
Separator(std::string_view first, std::string_view subsequent)

Definition at line 100 of file format-helpers.hpp.

Constructor & Destructor Documentation

◆ Separator() [1/2]

nfd::tools::nfdc::text::Separator::Separator ( std::string_view  first,
std::string_view  subsequent 
)

Definition at line 129 of file format-helpers.cpp.

◆ Separator() [2/2]

nfd::tools::nfdc::text::Separator::Separator ( std::string_view  subsequent)
explicit

Definition at line 135 of file format-helpers.cpp.

Member Function Documentation

◆ getCount()

int nfd::tools::nfdc::text::Separator::getCount ( ) const
inline

Definition at line 109 of file format-helpers.hpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
Separator sep 
)
friend

Definition at line 140 of file format-helpers.cpp.