theCore C++ embedded framework
ecl::fat::file_inode Class Reference

FATFS file inode. More...

#include </home/travis/build/forGGe/theCore/lib/fs/fat/export/ecl/fat/file_inode.hpp>

Inheritance diagram for ecl::fat::file_inode:
Collaboration diagram for ecl::fat::file_inode:

Public Types

using type = typename fs::inode::type
 
- Public Types inherited from ecl::fs::inode
enum  type { type::file = 0, type::dir = 1 }
 Possible filesystem entity types. More...
 

Public Member Functions

 file_inode (FATFS *fs, const allocator &alloc, const char *path, const char *name)
 Constructs FATFS inode for given file. More...
 
virtual ~file_inode ()
 Destroys inode. More...
 
type get_type () const override
 Gets type of entity, represented by the curent inode. More...
 
fs::file_ptr open () override
 Returns the file descriptor, if this inode represents file. More...
 
err size (size_t &sz) const override
 Returns size of a file or number of entries in the directory. More...
 
err get_name (char *buf, size_t &buf_sz) const override
 Gets a name of an entity. More...
 
- Public Member Functions inherited from ecl::fs::inode
 inode ()
 Constructs inode. More...
 
virtual ~inode ()
 Destroys inode. More...
 
virtual dir_ptr open_dir ()
 Returns the descriptor associated with this directory. More...
 
void set_weak (const fs::inode_ptr &ptr)
 Assigns weak reference to the inode. More...
 

Additional Inherited Members

- Protected Attributes inherited from ecl::fs::inode
fs::inode_weak my_ptr
 Weak self-pointer. More...
 

Detailed Description

FATFS file inode.

Member Typedef Documentation

◆ type

Constructor & Destructor Documentation

◆ file_inode()

file_inode::file_inode ( FATFS *  fs,
const allocator alloc,
const char *  path,
const char *  name 
)

Constructs FATFS inode for given file.

Parameters
[in]fsFATFS filesystem object,
[in]allocAllocator, used for internal allocations.
[in]pathPath to a parent dir.
[in]nameName of a file represented by this inode.

◆ ~file_inode()

file_inode::~file_inode ( )
virtual

Destroys inode.

Member Function Documentation

◆ get_type()

file_inode::type file_inode::get_type ( ) const
overridevirtual

Gets type of entity, represented by the curent inode.

Returns
Type of the entity.

Implements ecl::fs::inode.

◆ open()

ecl::fs::file_ptr file_inode::open ( )
overridevirtual

Returns the file descriptor, if this inode represents file.

Precondition
inode representing file entity.

Meaningless if used on the dir inode.

Returns
Pointer to file descriptor.

Reimplemented from ecl::fs::inode.

◆ size()

ecl::err file_inode::size ( size_t &  sz) const
overridevirtual

Returns size of a file or number of entries in the directory.

Parameters
[out]szParameter to store either file size (if this inode represents a file) or count of etries in the directory (if this inode represents a dir).
Returns
Status of operation.

Implements ecl::fs::inode.

◆ get_name()

ecl::err file_inode::get_name ( char *  buf,
size_t &  buf_sz 
) const
overridevirtual

Gets a name of an entity.

Parameters
[in]bufBuffer to store name to.
[in,out]buf_szOn entry: size of a buffer. On exit: bytes written excluding null character. If truncation occur then it will store amount of bytes that would have been written if enough space had been avaliable.
Returns
Status of operation.

Implements ecl::fs::inode.


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