16 if (this->m_is_open) {
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) {
50 return this->m_delegate.
rewind();
55 if (not this->m_is_open) {
59 Status status = this->m_delegate.
read(fileNameBuffer, bufSize);
60 fileNameBuffer[bufSize - 1] =
'\0';
66 if (not this->m_is_open) {
74 this->m_is_open =
false;
75 return this->m_delegate.
close();
83 if (not this->m_is_open) {
90 const FwSizeType loopLimit = std::numeric_limits<FwSizeType>::max();
96 for (
FwSizeType iter = 0; iter < loopLimit; ++iter) {
97 readStatus = this->
read(unusedBuffer,
sizeof(unusedBuffer));
116 if (not this->m_is_open) {
129 for (index = 0; index < filenameArraySize; index++) {
130 readStatus = this->
read(filenameArray[index]);
137 filenameCount = index;
PlatformSizeType FwSizeType
virtual SizeType getCapacity() const =0
return size of buffer
virtual const CHAR * toChar() const =0
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 DirectoryHandle * getHandle()=0
return the underlying Directory handle (implementation specific)
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.
@ MAX_OPEN_MODE
Maximum value of OpenMode.
@ OP_OK
Operation was successful.
@ NO_MORE_FILES
Directory stream has no more files.
@ NOT_OPENED
Directory hasn't been opened yet.
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.