1 #ifndef __FIPAACL_MESSAGEPARSER_BYTESEQUENCE_H_
2 #define __FIPAACL_MESSAGEPARSER_BYTESEQUENCE_H_
8 #include <boost/cstdint.hpp>
10 namespace fipa {
namespace acl {
15 typedef boost::variant<boost::uint_least8_t,boost::uint_least16_t, boost::uint_least32_t>
LengthValue;
20 typedef boost::variant<std::string, std::vector<unsigned char> >
ByteString;
53 std::string
operator()(
const std::vector<unsigned char>& vector)
const
55 size_t length = vector.size();
56 std::string tmp(
"HEX(");
60 for(
size_t i = 0; i < length; i++)
63 sprintf(currentChar,
"%02x", vector[i]);
64 tmp += std::string(currentChar);
111 std::string
operator()(
const std::vector<unsigned char>& vector)
const
115 output->assign(vector.begin(), vector.end());
118 std::string rawData(vector.begin(), vector.end());
std::string toRawDataString() const
void toRawDataString(std::string *output) const
fipa::acl::ByteString bytes
std::string operator()(const std::vector< unsigned char > &vector) const
Representation of a byte sequence. We also embed information about the encoding.
boost::variant< std::string, std::vector< unsigned char > > ByteString
Definition of a ByteString.
Printer using the visitor pattern for the ByteString type.
ByteStringRawPrinter(std::string *_output)
ByteStringPrinter(std::string enc)
std::string operator()(const std::vector< unsigned char > &vector) const
boost::variant< boost::uint_least8_t, boost::uint_least16_t, boost::uint_least32_t > LengthValue
Definition of a length - internally used by the parser.
fipa::acl::LengthValue length
Printer using the visitor pattern for the ByteString type.
std::string toPrettyString() const
std::string operator()(const std::string &s) const
std::string operator()(const std::string &s) const