21 using namespace object::yaml;
30 if (Scalar.
size() % 2 != 0)
31 return "BinaryRef hex string must contain an even number of nybbles.";
34 for (
unsigned I = 0,
N = Scalar.
size();
I !=
N; ++
I)
35 if (!isxdigit(Scalar[
I]))
36 return "BinaryRef hex string must contain only hex digits.";
42 if (!DataIsHexString) {
46 for (
unsigned I = 0,
N = Data.
size();
I !=
N;
I += 2) {
58 if (DataIsHexString) {
65 OS << hexdigit(Byte >> 4);
size_t size() const
size - Get the string size.
Specialized YAMLIO scalar type for representing a binary blob.
ArrayRef< uint8_t >::size_type binary_size() const
The number of bytes that are represented by this BinaryRef. This is the number of bytes that writeAsB...
void writeAsBinary(raw_ostream &OS) const
Write the contents (regardless of whether it is binary or a hex string) as binary to the given raw_os...
size_t size() const
size - Get the array size.
void writeAsHex(raw_ostream &OS) const
Write the contents (regardless of whether it is binary or a hex string) as hex to the given raw_ostre...
enable_if_c< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
raw_ostream & write(unsigned char C)
static char hexdigit(unsigned X, bool LowerCase=false)