#include <FSNode.hpp>
Public Member Functions | |
FSNode (const std::string &_path="~") | |
~FSNode () | |
bool | exist () const |
enum typeNode | getNodeType () const |
etk::FSNodeRight | getRight () const |
bool | setRight (etk::FSNodeRight _newRight) |
void | setName (const std::string &_newName) |
std::string | getFileSystemName () const |
std::string | getNameFolder () const |
std::string | getName () const |
std::string | getNameFile () const |
std::string | getRelativeFolder () const |
bool | touch () |
bool | move (const std::string &_path) |
enum FSNType | getTypeAccess () const |
bool | remove () |
uint64_t | timeCreated () const |
std::string | timeCreatedString () const |
uint64_t | timeModified () const |
std::string | timeModifiedString () const |
uint64_t | timeAccessed () const |
std::string | timeAccessedString () const |
const etk::FSNode & | operator= (const etk::FSNode &_obj) |
bool | operator== (const etk::FSNode &_obj) const |
bool | operator!= (const etk::FSNode &_obj) const |
int64_t | folderCount () |
std::vector< etk::FSNode * > | folderGetSubList (bool _showHidenFile=true, bool _getFolderAndOther=true, bool _getFile=true, bool _temporaryFile=true) |
std::vector< etk::FSNode * > | folderGetSubList (bool _showHidenFile=true, bool _getFolderAndOther=true, bool _getFile=true, const std::string &_filter=".*") |
std::vector< std::string > | folderGetSub (bool _getFolder, bool _getFile, const std::string &_filter) |
etk::FSNode | folderGetParent () |
void | folderGetRecursiveFiles (std::vector< std::string > &_output, bool _recursiveEnable=true) |
bool | fileHasExtention () |
std::string | fileGetExtention () |
uint64_t | fileSize () |
bool | fileOpenRead () |
bool | fileOpenWrite () |
bool | fileOpenAppend () |
bool | fileIsOpen () |
bool | fileClose () |
char * | fileGets (char *_elementLine, int64_t _maxData) |
char | fileGet () |
bool | fileGets (std::string &_output) |
bool | filePut (char _input) |
bool | filePuts (const std::string &_input) |
int64_t | fileRead (void *_data, int64_t _blockSize, int64_t _nbBlock) |
int64_t | fileWrite (const void *_data, int64_t _blockSize, int64_t _nbBlock) |
int64_t | fileTell () |
bool | fileSeek (long int _offset, enum etk::seekNode _origin) |
void | fileFlush () |
template<typename T > | |
std::vector< T > | fileReadAll () |
std::string | fileReadAllString () |
template<typename T > | |
void | fileWriteAll (const std::vector< T > &_value) |
void | fileWriteAll (const std::string &_value) |
Detailed Description
FS node is for File System IO access (named classicly "node in linux EXT) This class is independent of the OS, If you acces to a file in windows, it might generate the right like Linux (it is important to know that windows right is lighter than linux)
Constructor & Destructor Documentation
§ FSNode()
etk::FSNode::FSNode | ( | const std::string & | _path = "~" | ) |
Constructor.
- Parameters
-
[in] _path Path of the curent file /folder ...
§ ~FSNode()
etk::FSNode::~FSNode | ( | ) |
Destructor.
- Note
- you will have some warning if you did not close your files
Member Function Documentation
§ exist()
|
inline |
Check if the node exist.
- Returns
- true : The node existed.
- false : The node does not exist.
§ fileClose()
bool etk::FSNode::fileClose | ( | ) |
Close the curent file.
- Returns
- true : action done
- false : action not done
§ fileFlush()
void etk::FSNode::fileFlush | ( | ) |
Flush the current file.
§ fileGet()
char etk::FSNode::fileGet | ( | ) |
Get a unique data in the file.
- Returns
- the next element in the file.
§ fileGetExtention()
std::string etk::FSNode::fileGetExtention | ( | ) |
Get the extention of the Node.
- Returns
- the requested extention
§ fileGets() [1/2]
char* etk::FSNode::fileGets | ( | char * | _elementLine, |
int64_t | _maxData | ||
) |
Get the pointer on the start line and the next line (or null)
- Parameters
-
[in,out] _elementLine Pointer to an array of chars where the string read is copied. [in] _maxData Maximum number of characters to be copied into str (including the terminating null-character).
- Returns
- the pointer on the end of the cuurent line.
§ fileGets() [2/2]
bool etk::FSNode::fileGets | ( | std::string & | _output | ) |
Get a compleate line in a text file.
- Parameters
-
[out] _output the next element in the file.
- Returns
- true The file is not ended.
- false The file is ended.
§ fileHasExtention()
bool etk::FSNode::fileHasExtention | ( | ) |
Check if the file have an extention ( ***.ccc)
- Returns
- true The file have an extention.
- false The file have NO extention.
§ fileIsOpen()
bool etk::FSNode::fileIsOpen | ( | ) |
Check if the current file is Open.
- Returns
- true : File is open in write or in read
- false : File is NOT open in write or in read
§ fileOpenAppend()
bool etk::FSNode::fileOpenAppend | ( | ) |
Open the file in write Append Mode.
- Note
- You can not do it with the DATA: file ==> this is not allowed in some Board like Android)
- Returns
- true : action done
- false : action not done
§ fileOpenRead()
bool etk::FSNode::fileOpenRead | ( | ) |
Open the file in Read mode.
- Returns
- true : action done
- false : action not done
§ fileOpenWrite()
bool etk::FSNode::fileOpenWrite | ( | ) |
Open the file in write Mode.
- Note
- You can not do it with the DATA: file ==> this is not allowed in some Board like Android)
- Returns
- true : action done
- false : action not done
§ filePut()
bool etk::FSNode::filePut | ( | char | _input | ) |
Write data on the file.
- Parameters
-
[in] _input data to write.
- Returns
- true Write done corectly.
- false ErrorOn write.
§ filePuts()
bool etk::FSNode::filePuts | ( | const std::string & | _input | ) |
Write data on the file.
- Parameters
-
[in] _input data to write.
- Returns
- true Write done corectly.
- false ErrorOn write.
§ fileRead()
int64_t etk::FSNode::fileRead | ( | void * | _data, |
int64_t | _blockSize, | ||
int64_t | _nbBlock | ||
) |
Read data from the file.
- Parameters
-
[in,out] _data Pointer on the buffer that might be set the data [in] _blockSize Size of one block of data [in] _nbBlock Number of block needed
- Returns
- Number of element read (in block number)
§ fileReadAll()
|
inline |
Read all element in a file and set it in a generic vector.
- Returns
- the read vector
§ fileReadAllString()
|
inline |
Read all element in a file and set it in a generic std::string.
- Returns
- the read string
§ fileSeek()
bool etk::FSNode::fileSeek | ( | long int | _offset, |
enum etk::seekNode | _origin | ||
) |
Move in the file Position.
- Parameters
-
[in] _offset Offset to apply at the file [in] _origin Origin of the position
- Returns
- true : action done
- false : action not done
§ fileSize()
uint64_t etk::FSNode::fileSize | ( | ) |
Get the File size.
- Returns
- the requested size
§ fileTell()
int64_t etk::FSNode::fileTell | ( | ) |
Get the position in the file.
- Returns
- the requested position.
§ fileWrite()
int64_t etk::FSNode::fileWrite | ( | const void * | _data, |
int64_t | _blockSize, | ||
int64_t | _nbBlock | ||
) |
Write data on the file.
- Parameters
-
[in] _data Pointer on the buffer that might be set on the file [in] _blockSize Size of one block of data [in] _nbBlock Number of block needed
- Returns
- Number of element written (in block number)
§ fileWriteAll() [1/2]
|
inline |
Write all the vector in a file.
- Parameters
-
[in] _value Data to write in the File
§ fileWriteAll() [2/2]
|
inline |
Write all the vector in a file.
- Parameters
-
[in] _value String data to write in the File
§ folderCount()
int64_t etk::FSNode::folderCount | ( | ) |
Count the number of subFolder in the curent Folder.
- Returns
- >=0 nb of subElement
- -1 an error occured ==> not a folder ???
§ folderGetParent()
etk::FSNode etk::FSNode::folderGetParent | ( | ) |
Get the father node of this node.
- Returns
- The requested node
§ folderGetRecursiveFiles()
void etk::FSNode::folderGetRecursiveFiles | ( | std::vector< std::string > & | _output, |
bool | _recursiveEnable = true |
||
) |
Get all the File inside a Folder (done recursively)
- Parameters
-
[out] _output List of all the File names (You must clear it before set it in) [in] _recursiveEnable Activate the recursive mode (enable by default)
§ folderGetSub()
std::vector<std::string> etk::FSNode::folderGetSub | ( | bool | _getFolder, |
bool | _getFile, | ||
const std::string & | _filter | ||
) |
Get the List of all node inside a node (folder only)
- Parameters
-
[in] _getFolder get folder [in] _getFile Get files [in] _filter Generic regex string to filter file names
- Returns
- The requested list
§ folderGetSubList() [1/2]
std::vector<etk::FSNode*> etk::FSNode::folderGetSubList | ( | bool | _showHidenFile = true , |
bool | _getFolderAndOther = true , |
||
bool | _getFile = true , |
||
bool | _temporaryFile = true |
||
) |
Get the List of all node inside a node (folder only)
- Parameters
-
[in] _showHidenFile Add hidden file/folder/... [in] _getFolderAndOther get folder [in] _getFile Get files [in] _temporaryFile add Tmp file like .bck or ~
- Returns
- The requested list
§ folderGetSubList() [2/2]
std::vector<etk::FSNode*> etk::FSNode::folderGetSubList | ( | bool | _showHidenFile = true , |
bool | _getFolderAndOther = true , |
||
bool | _getFile = true , |
||
const std::string & | _filter = ".*" |
||
) |
Get the List of all node inside a node (folder only)
- Parameters
-
[in] _showHidenFile Add hidden file/folder/... [in] _getFolderAndOther get folder [in] _getFile Get files [in] _filter Generic regex string to filter file names
- Returns
- The requested list
§ getFileSystemName()
std::string etk::FSNode::getFileSystemName | ( | ) | const |
Get the Generate FileSystem name.
- Returns
- the requested filename
§ getName()
std::string etk::FSNode::getName | ( | ) | const |
Get the current compleate node name (file system name)
- Returns
- All the user name definition (like /xxxxx/xxxxx/myFile.kkk or c:/xxxxx/xxxxx/myFile.kkk)
- Note
- Auto remove of ../../../ and //
§ getNameFile()
std::string etk::FSNode::getNameFile | ( | ) | const |
Get the file or current file name (if it was a file)
- Returns
- the name of the node (like myFile.kkk)
§ getNameFolder()
std::string etk::FSNode::getNameFolder | ( | ) | const |
Get the current folder of the Node. (file system name)
- Returns
- the common name define (like /xxxxx/xxxxx/ or c:/xxxxx/xxxxx/)
- Note
- Auto remove of ../../../ and //
§ getNodeType()
|
inline |
Get the node type.
- Returns
- the requested type, typeNode_unknow if it does not existed
§ getRelativeFolder()
std::string etk::FSNode::getRelativeFolder | ( | ) | const |
Get the current folder of the Node.
- Returns
- the common name define (like DATA:xxxxx/xxxxx/)
- Note
- Auto remove of ../../../ and //
§ getRight()
|
inline |
Get the node Right.
- Returns
- the requested right
§ getTypeAccess()
|
inline |
Get the node type (DATA/DIRECT...)
- Returns
- the requested type
§ move()
bool etk::FSNode::move | ( | const std::string & | _path | ) |
Move the Node at a new path.
- Parameters
-
[in] _path The new path
- Returns
- true : action done
- false : action not done
§ operator!=()
bool etk::FSNode::operator!= | ( | const etk::FSNode & | _obj | ) | const |
Check if the 2 node are NOT link with the same file.
- Parameters
-
[in] _obj input node
- Returns
- false : same node, true otherwise
§ operator=()
const etk::FSNode& etk::FSNode::operator= | ( | const etk::FSNode & | _obj | ) |
copy the other FSnode ==> for vector
- Parameters
-
[in] _obj input node
- Returns
- the current modify node
§ operator==()
bool etk::FSNode::operator== | ( | const etk::FSNode & | _obj | ) | const |
Check if the 2 node are link with the same file.
- Parameters
-
[in] _obj input node
- Returns
- true : same node, false otherwise
§ remove()
bool etk::FSNode::remove | ( | ) |
Remove the current node ( if folder, this remove all subfolder but not the Link subfolder)
- Returns
- true : action done
- false : action not done
§ setName()
void etk::FSNode::setName | ( | const std::string & | _newName | ) |
Change the Node seeing (not rename the node, for this etk::FSNodeMove)
- Parameters
-
[in] _newName New node name to show
- Returns
- true action done
- false action not done
§ setRight()
bool etk::FSNode::setRight | ( | etk::FSNodeRight | _newRight | ) |
Set the specific right of the node.
- Parameters
-
[in] _newRight new right to set
- Returns
- true : action done
- false : action not done
§ timeAccessed()
uint64_t etk::FSNode::timeAccessed | ( | ) | const |
Get the Accessed time of the File.
- Returns
- The time requested
§ timeAccessedString()
std::string etk::FSNode::timeAccessedString | ( | ) | const |
Get the Accessed time of the File.
- Returns
- The time requested (in string)
§ timeCreated()
uint64_t etk::FSNode::timeCreated | ( | ) | const |
Get the creating time of the File.
- Returns
- The time requested
§ timeCreatedString()
std::string etk::FSNode::timeCreatedString | ( | ) | const |
Get the creating time of the File.
- Returns
- The time requested (in string)
§ timeModified()
uint64_t etk::FSNode::timeModified | ( | ) | const |
Get the modifying time of the File.
- Returns
- The time requested
§ timeModifiedString()
std::string etk::FSNode::timeModifiedString | ( | ) | const |
Get the modifying time of the File.
- Returns
- The time requested (in string)
§ touch()
bool etk::FSNode::touch | ( | ) |
update the Time of the file with the current time
- Returns
- true : action done
- false : action not done
The documentation for this class was generated from the following file:
- framework/atria-soft/etk/etk/os/FSNode.hpp