UA Server SDK C++ Bundle  1.4.3.291
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages

#include <uafileengine.h>

Inherits UaAbstractFileEngine.

Public Member Functions

 UaFileEngine ()
 construction
 
virtual ~UaFileEngine ()
 destruction
 
virtual bool remove (const UaUniString &sFileName) const
 Removes the file sFileName. More...
 
virtual bool copy (const UaUniString &fileName, const UaUniString &newName) const
 The copy function copies an existing file (fileName) to an new file with the name newName. More...
 
virtual bool rename (const UaUniString &fileName, const UaUniString &newName) const
 Renames the file fileName with the new name newName. More...
 
virtual bool link (const UaUniString &fileName, const UaUniString &newName) const
 Create a hard link to a new file. More...
 
virtual bool mkdir (const UaUniString &dirName) const
 Creates the directory dirName. More...
 
virtual bool rmdir (const UaUniString &dirName) const
 Removes the directory dirName. More...
 
virtual bool caseSensitive () const
 This method checks if the underlying OS is case-sensitive or not. More...
 
virtual bool isRelativePath (const UaUniString &sPath) const
 Returns true if sPath is relative; returns false if it is absolute. More...
 
virtual bool cd (const UaUniString &sDirName) const
 Changes the UaDir's directory to sDirName. More...
 
virtual bool createFile (const UaUniString &sPath, const UaUniString &sFileName) const
 Create a new file with the name sFileName and opens it for writing. More...
 
virtual bool exists (const UaUniString &sPath) const
 This method checks if the given path sPath still exists or not. More...
 
virtual FILE * openFile (const UaUniString &fileName, const UaUniString &mode) const
 Opens a file. More...
 
virtual OpcUa_Int64 writeFile (const void *pData, OpcUa_Int64 size, OpcUa_Int64 count, FILE *pFile) const
 Writes data to a file opened with openFile(). More...
 
virtual OpcUa_Int64 readFile (void *ptr, OpcUa_Int64 size, OpcUa_Int64 count, FILE *pFile) const
 Reads data from a file opened with openFile(). More...
 
virtual bool closeFile (FILE *pFile) const
 Closes a file opened with openFile(). More...
 
virtual OpcUa_Int64 getFileSize (const UaUniString &fileName) const
 Returns the size of a file. More...
 
virtual UaUniString canonicalPath (const UaUniString &sPath) const
 Returns the canonical path, i.e. More...
 
virtual UaUniStringList entryList (const UaUniString &sPath, int filters=UaDir::NoFilter, int sort=UaDir::NoSort) const
 Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters. More...
 
virtual OpcUa_UInt16 count (const UaUniString &sPath) const
 Returns the total number of directories and files in the directory (including "." and "..") More...
 
virtual UaUniString homePath () const
 Returns the absolute path of the user's home directory. More...
 
virtual UaUniString applicationDataPath () const
 Get the path to the application folder (/home/<username>/.config). More...
 
virtual UaUniString systemApplicationDataPath () const
 Get the path to the application folder (/etc/xdg). More...
 

Detailed Description

Member Function Documentation

UaUniString UaFileEngine::applicationDataPath ( ) const
virtual

Get the path to the application folder (/home/<username>/.config).

Returns
the path to the application folder (/home/<username>/.config).
UaUniString UaFileEngine::canonicalPath ( const UaUniString sPath) const
virtual

Returns the canonical path, i.e.

a path without symbolic links or redundant "." or ".." elements. On systems that do not have symbolic links this function will always return the same string that absolutePath() returns. If the canonical path does not exist (normally due to dangling symbolic links) canonicalPath() returns an empty string. Example:

UaUniString bin = "/local/bin"; // where /local/bin is a symlink to /usr/bin
UaDir binDir(bin);
UaUniString canonicalBin = binDir.canonicalPath();
// canonicalBin now equals "/usr/bin"
UaUniString ls = "/local/bin/ls"; // where ls is the executable "ls"
UaDir lsDir(ls);
UaUniString canonicalLs = lsDir.canonicalPath();
// canonicalLS now equals "/usr/bin/ls".
bool UaFileEngine::caseSensitive ( ) const
virtual

This method checks if the underlying OS is case-sensitive or not.

Returns
always true, because unix IS case-sensitive.
bool UaFileEngine::cd ( const UaUniString sDirName) const
virtual

Changes the UaDir's directory to sDirName.

Returns
true if the new directory exists and is readable; otherwise returns false. Note that the logical cd() operation is not performed if the new directory does not exist.
bool UaFileEngine::closeFile ( FILE *  pFile) const
virtual

Closes a file opened with openFile().

Parameters
pFilethe file to close.
Returns
true if closing the file succeeded.
bool UaFileEngine::copy ( const UaUniString fileName,
const UaUniString newName 
) const
virtual

The copy function copies an existing file (fileName) to an new file with the name newName.

Parameters
fileNamethe original file name to copy.
newNamethe new name of the copied file.
Returns
true if successful, false if not.
OpcUa_UInt16 UaFileEngine::count ( const UaUniString sPath) const
virtual

Returns the total number of directories and files in the directory (including "." and "..")

Parameters
sPaththe path to the directory where to count all the files and dirs.
Returns
the total number of directories and files. -1 if an error occured.
bool UaFileEngine::createFile ( const UaUniString sPath,
const UaUniString sFileName 
) const
virtual

Create a new file with the name sFileName and opens it for writing.

The file will be created with the rights 640.

Parameters
sPathpath to the new file.
sFileNamethe name of the new file.
Returns
true if successful, false if not.
UaUniStringList UaFileEngine::entryList ( const UaUniString sPath,
int  filters = UaDir::NoFilter,
int  sort = UaDir::NoSort 
) const
virtual

Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters.

The attribute filter and sorting specifications can be overridden using the filters and sort arguments.

Returns
an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
bool UaFileEngine::exists ( const UaUniString sPath) const
virtual

This method checks if the given path sPath still exists or not.

Parameters
sPaththe path to the file / directory.
Returns
true if the file / directory exists, false if not.
OpcUa_Int64 UaFileEngine::getFileSize ( const UaUniString fileName) const
virtual

Returns the size of a file.

Parameters
fileNamethe path to the file.
Returns
the size in bytes of the file or -1 if it could not be opened.
UaUniString UaFileEngine::homePath ( ) const
virtual

Returns the absolute path of the user's home directory.

Typically, this is:

/home/username
Returns
the user's home directory.
bool UaFileEngine::isRelativePath ( const UaUniString sPath) const
virtual

Returns true if sPath is relative; returns false if it is absolute.

A unixpath is relative if it does not start with a "/".

bool UaFileEngine::link ( const UaUniString fileName,
const UaUniString newName 
) const
virtual

Create a hard link to a new file.

Establishes a hard link between an existing file and a new file.

Parameters
fileNamepath to the file to link with.
newNamethe new name of the linked file.
Returns
true if successful, false if not.
bool UaFileEngine::mkdir ( const UaUniString dirName) const
virtual

Creates the directory dirName.

The directory will be created with mod 750.

Parameters
dirNamethe directory to create.
Returns
true if successful, false if not.
FILE * UaFileEngine::openFile ( const UaUniString fileName,
const UaUniString mode 
) const
virtual

Opens a file.

Parameters
fileNamethe path to the file.
modethe open mode (see fopen for details).
Returns
a pointer to the opened file or OpcUa_Null if it could not be opened.
OpcUa_Int64 UaFileEngine::readFile ( void *  pData,
OpcUa_Int64  size,
OpcUa_Int64  count,
FILE *  pFile 
) const
virtual

Reads data from a file opened with openFile().

Parameters
pDataa buffer to store the read data.
sizethe size of a single element to be read.
countthe number of elements to read.
pFilethe file to read from.
Returns
the number of elements read.
bool UaFileEngine::remove ( const UaUniString sFileName) const
virtual

Removes the file sFileName.

Parameters
sFileNamethe file to remove.
Returns
true if successful, false if not.
bool UaFileEngine::rename ( const UaUniString fileName,
const UaUniString newName 
) const
virtual

Renames the file fileName with the new name newName.

Parameters
fileNamethe file to rename.
newNamethe new name for the file.
Returns
true if successful, false if not.
bool UaFileEngine::rmdir ( const UaUniString dirName) const
virtual

Removes the directory dirName.

Parameters
dirNamethe directory to remove.
Returns
true if successful false if not.
UaUniString UaFileEngine::systemApplicationDataPath ( ) const
virtual

Get the path to the application folder (/etc/xdg).

Returns
the path to the application folder (/etc/xdg).
OpcUa_Int64 UaFileEngine::writeFile ( const void *  pData,
OpcUa_Int64  size,
OpcUa_Int64  count,
FILE *  pFile 
) const
virtual

Writes data to a file opened with openFile().

Parameters
pDatathe array of data to write.
sizethe size of a single array item.
countthe number of array items.
pFilethe file to write to.
Returns
the number of array elements written.

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