22 void yaml::ScalarTraits<yaml::BinaryRef>::output(
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)
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) {
56 if (DataIsHexString) {
60 for (uint8_t Byte : Data)
61 OS << hexdigit(Byte >> 4) <<
hexdigit(Byte & 0xf);
This class represents lattice values for constants.
LLVM_NODISCARD size_t size() const
size - Get the string size.
char hexdigit(unsigned X, bool LowerCase=false)
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16)...
size_t size() const
size - Get the array size.
bool isHexDigit(char C)
Checks if character C is a hexadecimal numeric character.
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...
raw_ostream & write(unsigned char C)
ArrayRef< uint8_t >::size_type binary_size() const
The number of bytes that are represented by this BinaryRef.
unsigned hexDigitValue(char C)
Interpret the given character C as a hexadecimal digit and return its value.
Specialized YAMLIO scalar type for representing a binary blob.
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.
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...