16 if (this->m_is_open) {
33 FW_ASSERT(mode >= 0 and mode < OpenMode::MAX_OPEN_MODE);
34 Status status = this->m_delegate.
open(path, mode);
36 this->m_is_open =
true;
43 return this->m_is_open;
47 if (not this->m_is_open) {
48 return Status::NOT_OPENED;
50 return this->m_delegate.
rewind();
55 if (not this->m_is_open) {
56 return Status::NOT_OPENED;
59 Status status = this->m_delegate.
read(fileNameBuffer, bufSize);
60 fileNameBuffer[bufSize - 1] =
'\0';
66 if (not this->m_is_open) {
67 return Status::NOT_OPENED;
74 this->m_is_open =
false;
75 return this->m_delegate.
close();
83 if (not this->m_is_open) {
84 return Status::NOT_OPENED;
90 const FwSizeType loopLimit = std::numeric_limits<FwSizeType>::max();
96 for (
FwSizeType iter = 0; iter < loopLimit; ++iter) {
97 readStatus = this->
read(unusedBuffer,
sizeof(unusedBuffer));
98 if (readStatus == Status::NO_MORE_FILES) {
116 if (not this->m_is_open) {
117 return Status::NOT_OPENED;
129 for (index = 0; index < filenameArraySize; index++) {
130 readStatus = this->
read(filenameArray[index]);
131 if (readStatus == Status::NO_MORE_FILES) {
137 filenameCount = index;
PlatformSizeType FwSizeType
virtual const CHAR * toChar() const =0
virtual SizeType getCapacity() const =0
return size of buffer
Status rewind() override
Rewind directory stream.
Status getFileCount(FwSizeType &fileCount)
Get the number of files in the directory.
Status open(const char *path, OpenMode mode) override
Open or create a directory.
bool isOpen()
Check if Directory is open or not.
DirectoryHandle * getHandle() override
return the underlying Directory handle (implementation specific)
Status readDirectory(Fw::String filenameArray[], const FwSizeType arraySize, FwSizeType &filenameCount)
Read the contents of the directory and store filenames in filenameArray of size arraySize.
void close() override
Close directory.
~Directory() final
Destructor.
Status read(char *fileNameBuffer, FwSizeType buffSize) override
Get next filename from directory stream.
virtual Status rewind()=0
Rewind directory stream.
virtual Status open(const char *path, OpenMode mode)=0
Open or create a directory.
virtual ~DirectoryInterface()=default
default virtual destructor
virtual void close()=0
Get next filename from directory stream and write it to a Fw::StringBase object.
virtual Status read(char *fileNameBuffer, FwSizeType buffSize)=0
Get next filename from directory stream.
virtual DirectoryHandle * getHandle()=0
return the underlying Directory handle (implementation specific)
@ OP_OK
Operation succeeded.
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.