74 return buffer; |
74 return buffer; |
75 } |
75 } |
76 } |
76 } |
77 } |
77 } |
78 |
78 |
79 /*! |
79 String quote(const ByteArray &bytes) |
80 * \brief Constructs a byte array from an initializer list containing bytes. |
|
81 * \param initializerList List of bytes. |
|
82 */ |
|
83 ByteArray::ByteArray(std::initializer_list<unsigned char> initializerList) : |
|
84 Vector<unsigned char>(initializerList) {} |
|
85 |
|
86 /*! |
|
87 * \returns a quoted representation of the contents of the byte array. |
|
88 */ |
|
89 String ByteArray::quote() const |
|
90 { |
80 { |
91 String result; |
81 String result; |
92 |
82 |
93 for (unsigned char byte : *this) |
83 for (unsigned char byte : bytes) |
94 result += representByte(byte); |
84 result += representByte(byte); |
95 |
85 |
96 return "\"" + result + "\""; |
86 return "\"" + result + "\""; |
97 } |
87 } |
98 |
88 |