NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
string-helper.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_UTIL_STRING_HELPER_HPP
23
#define NDN_UTIL_STRING_HELPER_HPP
24
25
#include "../common.hpp"
26
27
namespace
ndn
{
28
29
class
Buffer;
30
31
class
StringHelperError
:
public
std::invalid_argument
32
{
33
public
:
34
explicit
35
StringHelperError
(
const
std::string& what)
36
:
std
::invalid_argument(what)
37
{
38
}
39
};
40
52
class
AsHex
53
{
54
public
:
55
constexpr
explicit
56
AsHex
(uint64_t val) noexcept
57
: m_value(val)
58
{
59
}
60
61
private
:
62
uint64_t m_value;
63
64
friend
std::ostream&
operator<<
(std::ostream&,
const
AsHex
&);
65
};
66
67
std::ostream&
68
operator<<
(std::ostream& os,
const
AsHex
& hex);
69
79
void
80
printHex
(std::ostream& os, uint64_t num,
bool
wantUpperCase =
false
);
81
101
void
102
printHex
(std::ostream& os,
const
uint8_t* buffer,
size_t
length,
bool
wantUpperCase =
true
);
103
111
void
112
printHex
(std::ostream& os,
const
Buffer
& buffer,
bool
wantUpperCase =
true
);
113
132
std::string
133
toHex
(
const
uint8_t* buffer,
size_t
length,
bool
wantUpperCase =
true
);
134
141
std::string
142
toHex
(
const
Buffer
& buffer,
bool
wantUpperCase =
true
);
143
147
int
148
fromHexChar
(
char
c);
149
156
shared_ptr<Buffer>
157
fromHex
(
const
std::string& hexString);
158
172
std::string
173
unescape
(
const
std::string& str);
174
175
}
// namespace ndn
176
177
#endif // NDN_UTIL_STRING_HELPER_HPP
ndn::StringHelperError
Definition:
string-helper.hpp:31
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::toHex
std::string toHex(const uint8_t *buffer, size_t length, bool wantUpperCase)
Return a string containing the hex representation of the bytes in buffer.
Definition:
string-helper.cpp:67
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:274
ndn::AsHex
Helper class to convert a number to hexadecimal format, for use with stream insertion operators...
Definition:
string-helper.hpp:52
std
STL namespace.
ndn::StringHelperError::StringHelperError
StringHelperError(const std::string &what)
Definition:
string-helper.hpp:35
ndn::fromHex
shared_ptr< Buffer > fromHex(const std::string &hexString)
Convert the hex string to buffer.
Definition:
string-helper.cpp:94
ndn::unescape
std::string unescape(const std::string &str)
Decode a percent-encoded string.
Definition:
string-helper.cpp:110
ndn::fromHexChar
int fromHexChar(char c)
Convert the hex character to an integer from 0 to 15, or -1 if not a hex character.
Definition:
string-helper.cpp:81
ndn::printHex
void printHex(std::ostream &os, uint64_t num, bool wantUpperCase)
Output the hex representation of num to the output stream os.
Definition:
string-helper.cpp:42
ndn::Buffer
General-purpose automatically managed/resized buffer.
Definition:
buffer.hpp:40
ndn::AsHex::AsHex
constexpr AsHex(uint64_t val) noexcept
Definition:
string-helper.hpp:56
ndnSIM
ndn-cxx
src
util
string-helper.hpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11