Skip to content

Commit 996f2f0

Browse files
committed
Add blob method for char spans
1 parent c15a84d commit 996f2f0

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

src/lib/Blob.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,21 +333,53 @@ namespace fbcpp
333333
///
334334
unsigned read(std::span<std::byte> buffer);
335335

336+
///
337+
/// Reads data from the blob into the provided buffer.
338+
///
339+
unsigned read(std::span<char> buffer)
340+
{
341+
return read(std::as_writable_bytes(buffer));
342+
}
343+
336344
///
337345
/// Reads a single segment from the blob into the provided buffer.
338346
///
339347
unsigned readSegment(std::span<std::byte> buffer);
340348

349+
///
350+
/// Reads a single segment from the blob into the provided buffer.
351+
///
352+
unsigned readSegment(std::span<char> buffer)
353+
{
354+
return readSegment(std::as_writable_bytes(buffer));
355+
}
356+
341357
///
342358
/// Writes data from the buffer into the blob.
343359
///
344360
void write(std::span<const std::byte> buffer);
345361

362+
///
363+
/// Writes data from the buffer into the blob.
364+
///
365+
void write(std::span<const char> buffer)
366+
{
367+
write(std::as_bytes(buffer));
368+
}
369+
346370
///
347371
/// Writes a single segment from the buffer into the blob.
348372
///
349373
void writeSegment(std::span<const std::byte> buffer);
350374

375+
///
376+
/// Writes a single segment from the buffer into the blob.
377+
///
378+
void writeSegment(std::span<const char> buffer)
379+
{
380+
writeSegment(std::as_bytes(buffer));
381+
}
382+
351383
///
352384
/// Repositions the blob read/write cursor.
353385
///

0 commit comments

Comments
 (0)