Lines Matching refs:span
19 // span - sequence of bytes
22 // This template is similar to std::span, which will be included in C++20.
24 class span {
28 span() : data_(nullptr), size_(0) {}
29 span(const T* data, index_type size) : data_(data), size_(size) {}
38 span<T> subspan(index_type offset, index_type count) const {
39 return span(data_ + offset, count);
42 span<T> subspan(index_type offset) const {
43 return span(data_ + offset, size_ - offset);
57 span<T> SpanFrom(const std::vector<T>& v) {
58 return span<T>(v.data(), v.size());
62 span<uint8_t> SpanFrom(const char (&str)[N]) {
63 return span<uint8_t>(reinterpret_cast<const uint8_t*>(str), N - 1);
66 inline span<uint8_t> SpanFrom(const char* str) {
67 return str ? span<uint8_t>(reinterpret_cast<const uint8_t*>(str), strlen(str))
68 : span<uint8_t>();
71 inline span<uint8_t> SpanFrom(const std::string& v) {
72 return span<uint8_t>(reinterpret_cast<const uint8_t*>(v.data()), v.size());
145 virtual void HandleString8(span<uint8_t> chars) = 0;
146 virtual void HandleString16(span<uint16_t> chars) = 0;
147 virtual void HandleBinary(span<uint8_t> bytes) = 0;
195 bool IsCBORMessage(span<uint8_t> msg);
217 void EncodeString16(span<uint16_t> in, std::vector<uint8_t>* out);
218 void EncodeString16(span<uint16_t> in, std::string* out);
221 void EncodeString8(span<uint8_t> in, std::vector<uint8_t>* out);
222 void EncodeString8(span<uint8_t> in, std::string* out);
227 void EncodeFromLatin1(span<uint8_t> latin1, std::vector<uint8_t>* out);
228 void EncodeFromLatin1(span<uint8_t> latin1, std::string* out);
232 void EncodeFromUTF16(span<uint16_t> utf16, std::vector<uint8_t>* out);
233 void EncodeFromUTF16(span<uint16_t> utf16, std::string* out);
238 void EncodeBinary(span<uint8_t> in, std::vector<uint8_t>* out);
239 void EncodeBinary(span<uint8_t> in, std::string* out);
349 explicit CBORTokenizer(span<uint8_t> bytes);
380 span<uint8_t> GetString8() const;
384 span<uint8_t> GetString16WireRep() const;
387 span<uint8_t> GetBinary() const;
390 span<uint8_t> GetEnvelopeContents() const;
397 span<uint8_t> bytes_;
413 void ParseCBOR(span<uint8_t> bytes, StreamingParserHandler* out);
422 Status AppendString8EntryToCBORMap(span<uint8_t> string8_key,
423 span<uint8_t> string8_value,
425 Status AppendString8EntryToCBORMap(span<uint8_t> string8_key,
426 span<uint8_t> string8_value,
430 size_t ReadTokenStart(span<uint8_t> bytes,
480 span<uint8_t> chars,
483 span<uint16_t> chars,
490 span<uint8_t> cbor,
493 span<uint8_t> cbor,
496 span<uint8_t> json,
499 span<uint16_t> json,
502 span<uint8_t> json,
505 span<uint16_t> json,