29 if (Scalar.
size() % 2 != 0)
30 return "BinaryRef hex string must contain an even number of nybbles.";
33 for (
unsigned I = 0,
N = Scalar.
size();
I !=
N; ++
I)
34 if (!isxdigit(Scalar[
I]))
35 return "BinaryRef hex string must contain only hex digits.";
41 if (!DataIsHexString) {
45 for (
unsigned I = 0,
N = Data.
size();
I !=
N;
I += 2) {
53 if (binary_size() == 0)
55 if (DataIsHexString) {
56 OS.
write((
const char *)Data.data(), Data.size());
59 for (uint8_t Byte : Data)
60 OS << hexdigit(Byte >> 4) <<
hexdigit(Byte & 0xf);
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
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...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
size_t size() const
size - Get the array size.
raw_ostream & write(unsigned char C)
This class should be specialized by type that requires custom conversion to/from a yaml scalar...
static char hexdigit(unsigned X, bool LowerCase=false)
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16)...
Specialized YAMLIO scalar type for representing a binary blob.
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...
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.