80 return currentSectionIndex;
86 return section ? section->recordIndex : -1;
101 if(index < sectionCount) {
102 return §ions[index];
110 nextSectionCallback = callback;
115 nextRecordCallback = callback;
125 if(index < 0 || index >= sectionCount) {
144 if(nextRecordCallback) {
145 return nextRecordCallback();
161 uint32_t readOffset{0};
162 uint32_t sectionOffset{0};
163 uint8_t sectionCount{0};
164 int8_t currentSectionIndex{-1};
165 int8_t newSection{-1};
166 bool finished{
false};
uint32_t recordCount
Definition: SectionStream.h:34
bool setNewSection(int8_t index)
Definition: SectionStream.h:123
int recordIndex() const
Definition: SectionStream.h:83
uint32_t end() const
Definition: SectionStream.h:37
size_t count() const
Definition: SectionStream.h:89
Base class for read-only stream.
Definition: DataSourceStream.h:40
virtual bool nextRecord()
Move to first/next record.
Definition: SectionStream.h:142
uint32_t size
Definition: SectionStream.h:33
int recordIndex
Definition: SectionStream.h:35
The String class.
Definition: WString.h:136
static constexpr uint8_t maxSections
Definition: SectionStream.h:29
int sectionIndex() const
Definition: SectionStream.h:78
SeekOrigin
Stream/file seek origins.
Definition: SeekOrigin.h:18
#define F(string_literal)
Wrap a string literal stored in flash and access it using a String object.
Definition: WString.h:113
void onNextRecord(NextRecord callback)
Definition: SectionStream.h:113
void onNextSection(NextSection callback)
Definition: SectionStream.h:108
SectionStream(IDataSourceStream *source)
Definition: SectionStream.h:54
bool gotoSection(uint8_t index)
Goto a new section immediately.
int seekFrom(int offset, SeekOrigin origin) override
Change position in stream.
uint32_t start
Definition: SectionStream.h:32
uint16_t readMemoryBlock(char *data, int bufSize) override
Read a block of memory.
Definition: SectionStream.h:31
~SectionStream()
Definition: SectionStream.h:59
int available() override
Return the total length of the stream.
Definition: SectionStream.h:64
Presents each section within a source stream as a separate stream.
Definition: SectionStream.h:26
const Section * getSection() const
Definition: SectionStream.h:94
bool isFinished() override
Check if all data has been read.
Definition: SectionStream.h:73
virtual void nextSection()
Invoked when moving to a new section.
const Section * getSection(unsigned index) const
Definition: SectionStream.h:99