fipa_acl  1.4
Public Member Functions | List of all members
fipa::acl::ByteStringRawPrinter Class Reference

Printer using the visitor pattern for the ByteString type. More...

#include <byte_sequence.h>

Inherits static_visitor< std::string >.

Public Member Functions

 ByteStringRawPrinter (std::string *_output)
 
 ByteStringRawPrinter ()
 
std::string operator() (const std::string &s) const
 
std::string operator() (const std::vector< unsigned char > &vector) const
 

Detailed Description

Printer using the visitor pattern for the ByteString type.

Definition at line 79 of file byte_sequence.h.

Constructor & Destructor Documentation

◆ ByteStringRawPrinter() [1/2]

fipa::acl::ByteStringRawPrinter::ByteStringRawPrinter ( std::string *  _output)
inline

Allow to pass down receiver string (for performance reasons

Definition at line 86 of file byte_sequence.h.

86 : output(_output) {}

◆ ByteStringRawPrinter() [2/2]

fipa::acl::ByteStringRawPrinter::ByteStringRawPrinter ( )
inline

Default constructor

Definition at line 91 of file byte_sequence.h.

91 : output(0) {}

Member Function Documentation

◆ operator()() [1/2]

std::string fipa::acl::ByteStringRawPrinter::operator() ( const std::string &  s) const
inline

Build a string for the given type

Parameters
sOne of the types for the variant that this printer is implemented for

Definition at line 97 of file byte_sequence.h.

98  {
99  if(output)
100  *output = s;
101 
102  return s;
103  }

◆ operator()() [2/2]

std::string fipa::acl::ByteStringRawPrinter::operator() ( const std::vector< unsigned char > &  vector) const
inline

Build a string from a raw byte sequence, i.e. the following output format will be used, embedding encoding information (dword) HEX(dword)[0a af 02 10 ... 01]

Parameters
vectorOne of the types for the variant that this printer is implemented for

Definition at line 111 of file byte_sequence.h.

112  {
113  if(output)
114  {
115  output->assign(vector.begin(), vector.end());
116  return *output;
117  } else {
118  std::string rawData(vector.begin(), vector.end());
119  return rawData;
120  }
121  }

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