µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::posix::directory Class Reference

Directory class. More...

#include <cmsis-plus/posix-io/directory.h>

+ Inheritance diagram for os::posix::directory:

Public Member Functions

Constructors & Destructor
 directory (directory_impl &impl)
 
virtual ~directory ()
 
Public Member Functions
virtual direntread (void)
 
virtual void rewind (void)
 
virtual int close (void)
 
direntdir_entry (void)
 
class file_systemget_file_system (void) const
 
directory_implimpl (void) const
 

Detailed Description

Definition at line 74 of file directory.h.

Constructor & Destructor Documentation

◆ directory()

os::posix::directory::directory ( directory_impl impl)

Definition at line 33 of file directory.cpp.

33 : impl_ (impl)
34 {
35#if defined(OS_TRACE_POSIX_IO_DIRECTORY)
36 trace::printf ("directory::%s()=%p\n", __func__, this);
37#endif
38 }
directory_impl & impl(void) const
Definition directory.h:503
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:59

References os::trace::printf().

◆ ~directory()

os::posix::directory::~directory ( )
virtual

Definition at line 40 of file directory.cpp.

41 {
42#if defined(OS_TRACE_POSIX_IO_DIRECTORY)
43 trace::printf ("directory::%s() @%p\n", __func__, this);
44#endif
45 }

References os::trace::printf().

Member Function Documentation

◆ close()

int os::posix::directory::close ( void  )
virtual

Reimplemented in os::posix::directory_lockable< T, L >.

Definition at line 84 of file directory.cpp.

85 {
86#if defined(OS_TRACE_POSIX_IO_DIRECTORY)
87 trace::printf ("directory::%s() @%p\n", __func__, this);
88#endif
89
90 // assert(file_system_ != nullptr);
91 errno = 0;
92
93 // Execute the implementation specific code.
94 int ret = impl ().do_close ();
95 if (ret != 0)
96 {
97 trace::printf ("directory::%s() @%p do_close() returned %d\n",
98 __func__, this, ret);
99 }
100
101 // The file object will be deallocated at the next open.
103
104 return ret;
105 }
virtual int do_close(void)=0
class file_system & get_file_system(void) const
Definition directory.h:491
void add_deferred_directory(directory *dir)

References os::posix::file_system::add_deferred_directory(), os::posix::directory_impl::do_close(), get_file_system(), impl(), and os::trace::printf().

Referenced by __posix_closedir(), and os::posix::directory_lockable< T, L >::close().

◆ dir_entry()

dirent * os::posix::directory::dir_entry ( void  )
inline

Definition at line 497 of file directory.h.

498 {
499 return &(impl ().dir_entry_);
500 }

References impl().

◆ get_file_system()

file_system & os::posix::directory::get_file_system ( void  ) const
inline

Definition at line 491 of file directory.h.

492 {
493 return impl ().get_file_system ();
494 }
class file_system & get_file_system(void) const
Definition directory.h:511

References os::posix::directory_impl::get_file_system(), and impl().

Referenced by close().

◆ impl()

directory_impl & os::posix::directory::impl ( void  ) const
inline

Definition at line 503 of file directory.h.

504 {
505 return /* static_cast<directory_impl&> */ (impl_);
506 }

Referenced by close(), dir_entry(), get_file_system(), read(), and rewind().

◆ read()

dirent * os::posix::directory::read ( void  )
virtual

Reimplemented in os::posix::directory_lockable< T, L >.

Definition at line 50 of file directory.cpp.

51 {
52#if defined(OS_TRACE_POSIX_IO_DIRECTORY)
53 trace::printf ("directory::%s() @%p\n", __func__, this);
54#endif
55
56 // assert(file_system_ != nullptr);
57
58 // POSIX requires not to change errno when end of directory is
59 // encountered. However, in this implementation, errno is
60 // always cleared when entering system calls.
61 errno = 0;
62
63 // Execute the implementation specific code.
64 return impl ().do_read ();
65 }
virtual dirent * do_read(void)=0

References os::posix::directory_impl::do_read(), impl(), and os::trace::printf().

Referenced by __posix_readdir(), and os::posix::directory_lockable< T, L >::read().

◆ rewind()

void os::posix::directory::rewind ( void  )
virtual

Reimplemented in os::posix::directory_lockable< T, L >.

Definition at line 68 of file directory.cpp.

69 {
70#if defined(OS_TRACE_POSIX_IO_DIRECTORY)
71 trace::printf ("directory::%s() @%p\n", __func__, this);
72#endif
73
74 // assert(file_system_ != nullptr);
75
76 // POSIX does not mention what to do with errno.
77 errno = 0;
78
79 // Execute the implementation specific code.
80 impl ().do_rewind ();
81 }
virtual void do_rewind(void)=0

References os::posix::directory_impl::do_rewind(), impl(), and os::trace::printf().

Referenced by __posix_rewinddir(), and os::posix::directory_lockable< T, L >::rewind().


The documentation for this class was generated from the following files: