|
static constexpr std::array< const char *, 2 > | Columns = { "dict", "doc" } |
|
static constexpr size_t | RequiredAlignment = 8 |
|
|
template<typename ValueType > |
std::enable_if_t< sizeof(ValueType)<=RequiredAlignment, bool > ReadValue(ValueType &value) { constexpr size_t valueSize=sizeof(ValueType);const size_t availableBytes=mCurrentBytes - mCurrentIndex;if(availableBytes< valueSize) return valueSize==Read(&value, valueSize);if constexpr(valueSize==1) value=mBufferStart[mCurrentIndex];else value=UncheckedRead< ValueType >();mCurrentIndex+=valueSize;return true;} bool Eof() const ;int GetC();protected:virtual bool HasMoreData() const=0;virtual size_t ReadData(void *buffer, size_t maxBytes)=0;private:bool HandleUnderflow();template< typename T > T UncheckedRead() noexcept { T result;if((mCurrentIndex % sizeof(T))==0) { const void *ptr=mBufferStart+mCurrentIndex;result=*static_cast< const T * >(ptr);} else { const uint8_t *begin=mBufferStart+mCurrentIndex;const uint8_t *end=begin+sizeof(T);void *out=&result;std::copy(begin, end, static_cast< uint8_t * >(out));} return result;} std::vector< uint8_t > | mBufferData |
| Read a single value of ValueType, where sizeof(ValueType) <= 8 and value is aligned to the size boundary. More...
|
|
uint8_t * | mBufferStart |
|
size_t | mBufferSize |
|
size_t | mCurrentIndex { 0 } |
|
size_t | mCurrentBytes { 0 } |
|
Definition at line 338 of file ProjectFileIO.cpp.
◆ BufferedProjectBlobStream()
BufferedProjectBlobStream::BufferedProjectBlobStream |
( |
sqlite3 * |
db, |
|
|
const char * |
schema, |
|
|
const char * |
table, |
|
|
int64_t |
rowID |
|
) |
| |
|
inline |
Definition at line 343 of file ProjectFileIO.cpp.
356 {
357 }
BufferedStreamReader(size_t bufferSize=4096)
◆ HasMoreData()
bool BufferedProjectBlobStream::HasMoreData |
( |
| ) |
const |
|
inlineoverrideprotected |
◆ OpenBlob()
bool BufferedProjectBlobStream::OpenBlob |
( |
size_t |
index | ) |
|
|
inlineprivate |
Definition at line 360 of file ProjectFileIO.cpp.
361 {
363 {
365 return false;
366 }
367
370
372 }
static std::optional< SQLiteBlobStream > Open(sqlite3 *db, const char *schema, const char *table, const char *column, int64_t rowID, bool readOnly) noexcept
References Columns, mBlobStream, mDB, mRowID, mSchema, mTable, and SQLiteBlobStream::Open().
Referenced by ReadData().
◆ ReadData()
size_t BufferedProjectBlobStream::ReadData |
( |
void * |
buffer, |
|
|
size_t |
maxBytes |
|
) |
| |
|
inlineoverrideprotected |
Definition at line 388 of file ProjectFileIO.cpp.
389 {
391 {
393 return {};
394 }
395
396
397 maxBytes = std::min<size_t>(maxBytes, std::numeric_limits<int>::max());
398 auto bytesRead = static_cast<int>(maxBytes);
399
400 if (SQLITE_OK !=
mBlobStream->Read(buffer, bytesRead))
401 {
402
403
406
407 return 0;
408 }
409 else if (bytesRead == 0)
410 {
412 }
413
414 return static_cast<size_t>(bytesRead);
415 }
bool OpenBlob(size_t index)
References Columns, mBlobStream, mNextBlobIndex, and OpenBlob().
◆ Columns
constexpr std::array< const char *, 2 > BufferedProjectBlobStream::Columns = { "dict", "doc" } |
|
staticconstexpr |
◆ mBlobStream
◆ mDB
sqlite3* BufferedProjectBlobStream::mDB |
|
private |
◆ mNextBlobIndex
size_t BufferedProjectBlobStream::mNextBlobIndex { 0 } |
|
private |
◆ mRowID
const int64_t BufferedProjectBlobStream::mRowID |
|
private |
◆ mSchema
const char* BufferedProjectBlobStream::mSchema |
|
private |
◆ mTable
const char* BufferedProjectBlobStream::mTable |
|
private |
The documentation for this class was generated from the following file: