NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
string-helper.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_STRING_HELPER_HPP
23
#define NDN_STRING_HELPER_HPP
24
25
#include "../common.hpp"
26
#include "../encoding/buffer.hpp"
27
28
namespace
ndn
{
29
30
class
StringHelperError
:
public
std::invalid_argument
31
{
32
public
:
33
explicit
34
StringHelperError
(
const
std::string& what)
35
:
std
::invalid_argument(what)
36
{
37
}
38
};
39
57
void
58
printHex
(std::ostream& os,
const
uint8_t* buffer,
size_t
length,
bool
isUpperCase =
true
);
59
67
void
68
printHex
(std::ostream& os,
const
Buffer
& buffer,
bool
isUpperCase =
true
);
69
86
std::string
87
toHex
(
const
uint8_t* buffer,
size_t
length,
bool
isUpperCase =
true
);
88
95
std::string
96
toHex
(
const
Buffer
& buffer,
bool
isUpperCase =
true
);
97
104
shared_ptr<const Buffer>
105
fromHex
(
const
std::string& hexString);
106
110
void
111
trimLeft
(std::string& str);
112
116
void
117
trimRight
(std::string& str);
118
122
void
123
trim
(std::string& str);
124
128
int
129
fromHexChar
(uint8_t c);
130
142
std::string
143
unescape
(
const
std::string& str);
144
145
}
// namespace ndn
146
147
#endif // NDN_STRING_HELPER_HPP
ndn::StringHelperError
Definition:
string-helper.hpp:30
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
std
STL namespace.
ndn::printHex
void printHex(std::ostream &os, const uint8_t *buffer, size_t length, bool isUpperCase)
Output the hex representation of the bytes in array to the output stream os.
Definition:
string-helper.cpp:34
ndn::StringHelperError::StringHelperError
StringHelperError(const std::string &what)
Definition:
string-helper.hpp:34
ndn::toHex
std::string toHex(const uint8_t *buffer, size_t length, bool isUpperCase)
Return the hex representation of the bytes in array.
Definition:
string-helper.cpp:59
ndn::unescape
std::string unescape(const std::string &str)
Decode a percent-encoded string.
Definition:
string-helper.cpp:128
ndn::trimRight
void trimRight(std::string &str)
Modify str in place to erase whitespace on the right.
Definition:
string-helper.cpp:116
ndn::trim
void trim(std::string &str)
Modify str in place to erase whitespace on the left and right.
Definition:
string-helper.cpp:122
ndn::trimLeft
void trimLeft(std::string &str)
Modify str in place to erase whitespace on the left.
Definition:
string-helper.cpp:110
ndn::fromHexChar
int fromHexChar(uint8_t c)
Convert the hex character to an integer from 0 to 15, or -1 if not a hex character.
Definition:
string-helper.cpp:76
ndn::fromHex
shared_ptr< const Buffer > fromHex(const std::string &hexString)
Convert the hex string to buffer.
Definition:
string-helper.cpp:89
ndn::Buffer
Class representing a general-use automatically managed/resized buffer.
Definition:
buffer.hpp:44
ndnSIM
ndn-cxx
src
util
string-helper.hpp
Generated on Sat Nov 12 2016 16:02:53 for ndnSIM by
1.8.12