nfd::tools::nfdc::text::ItemAttributes Class Reference

print attributes of an item More...

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

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


struct  Attribute

Public Member Functions

 ItemAttributes (bool wantMultiLine=false, int maxAttributeWidth=0)
 constructor More...
std::string end () const
Attribute operator() (const std::string &attribute)


std::ostream & operator<< (std::ostream &os, const ItemAttributes::Attribute &attr)

Detailed Description

print attributes of an item

ItemAttributes ia(wantMultiLine, 3);
os << ia("id") << 500
<< ia("uri") << "udp4://"
<< ia.end();
// prints in single-line style (wantMultiLine==false):
// id=500 uri=udp4:// [no-newline]
// prints in multi-line style (wantMultiLine==true):
// id=500
// uri=udp4:// [newline]

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

Constructor & Destructor Documentation

◆ ItemAttributes()

nfd::tools::nfdc::text::ItemAttributes::ItemAttributes ( bool  wantMultiLine = false,
int  maxAttributeWidth = 0 


wantMultiLinetrue to select multi-line style, false to use single-line style
maxAttributeWidthmaximum width of attribute names, for alignment in multi-line style

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

Member Function Documentation

◆ end()

std::string nfd::tools::nfdc::text::ItemAttributes::end ( ) const

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

◆ operator()()

ItemAttributes::Attribute nfd::tools::nfdc::text::ItemAttributes::operator() ( const std::string &  attribute)
Caller must ensure ItemAttributes object is alive until after all Attribute objects are destructed.

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

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const ItemAttributes::Attribute attr 

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