C++ Based OPC UA Client/Server SDK  1.5.5.355

#include <uafileengine.h>

Inherits UaAbstractFileEngine, UaAbstractFileEngine, UaAbstractFileEngine, UaAbstractFileEngine, UaAbstractFileEngine, and UaAbstractFileEngine.

Public Member Functions

 UaFileEngine ()
 construction More...
 
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 sensitiv 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 OpcUa_Int64 readLine (char *pData, OpcUa_Int64 maxSize, FILE *pFile) const
 Reads one line from a text file opened with openFile(). More...
 
virtual OpcUa_Int64 pos (FILE *pFile) const
 Returns the current value of the position. More...
 
virtual bool seek (OpcUa_Int64 pos, FILE *pFile, int origin) const
 Set the current position to the position specified. 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 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 UaUniString canonicalPath (const UaUniString &sPath) const
 NOT supported under INtime. 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. More...
 
virtual UaUniString systemApplicationDataPath () const
 Get the path to the application folder. More...
 
virtual OpcUa_UInt16 count (const UaUniString &sPath) const
 Returns the total number of directories and files in the directory (including "." and "..") More...
 

Detailed Description

Constructor & Destructor Documentation

UaFileEngine::UaFileEngine ( )

construction

function pointer to PathIsRelativeWType

construction

Member Function Documentation

UaUniString UaFileEngine::applicationDataPath ( ) const
virtual

Get the path to the application folder.

Get the path to the application folder (<username>\Application Data).

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

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

NOT supported under INtime.

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 sensitiv or not.

Nothing to do under Win.

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

Returns
always true, because unix IS case sensitive.
always true, because unix IS case-sensitive.
false
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.

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.

Returns
true if successful, false if not.
See also
exists()
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.

The copy function copies an existing file to an new file.

Parameters
fileNamethe original file name to copy.
newNamethe new name of the copied file.
Returns
true if successful false if not.
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.
Parameters
sPaththe path to the directory where to count all the files and dirs.
Returns
the total number of directories and files.
bool UaFileEngine::createFile ( const UaUniString sPath,
const UaUniString sFileName 
) const
virtual

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

Create a new file 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.

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.
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.

This method checks if the given path 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:

C:/Documents and Settings/Username
Returns
the user's home directory.

Typically, this is:

/home/username
Returns
the user's home directory.

Under Windows this function will return the directory of the current user's profile. Typically, this is:

C:/Documents and Settings/Username
Returns
the absolute path of 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.

Checks if a directory path is an absolute path or a relative path.

Converts the directory path to an absolute path.

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

If it is already absolute nothing happens.

Returns
true if sPath is relative; returns false if it is absolute.
true if sPath is relative; returns false if it is absolute.
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.

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.

Creates a sub-directory called dirName.

The directory will be created with mod 750.

Parameters
dirNamethe directory to create.
Returns
true if successful false if not.

The directory will be created with mod 750.

Parameters
dirNamethe directory to create.
Returns
true if successful, false if not.

Returns true on success; otherwise returns false.

Parameters
dirNamethe directory to create.
Returns
true if successful false if not.
See also
rmdir()
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::pos ( FILE *  pFile) const
virtual

Returns the current value of the position.

Returns
On success returns the current value of the position, otherwise return -1.
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.
OpcUa_Int64 UaFileEngine::readLine ( char *  pData,
OpcUa_Int64  maxSize,
FILE *  pFile 
) const
virtual

Reads one line from a text file opened with openFile().

Parameters
pDataa buffer to store the read data.
maxSizethe maximuum number of character to read from one line.
pFilethe file to read from.
Returns
the number of bytes read or -1 if an error occured.
bool UaFileEngine::remove ( const UaUniString sFileName) const
virtual

Removes the file sFileName.

Removes the file, fileName.

Parameters
sFileNamethe file to remove.
Returns
true if successful false if not.
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.

Renames a file or directory from fileName to newName, and returns true if successful; otherwise returns false.

Parameters
fileNamethe file to rename.
newNamethe new name for the file.
Returns
true if successful false if not.
Parameters
fileNamethe file to rename.
newNamethe new name for the file.
Returns
true if successful, false if not.

On most file systems, rename() fails only if fileName does not exist, if newName and fileName are not on the same partition or if a file with the new name already exists. However, there are also other reasons why rename() can fail. For example, on at least one file system rename() fails if newName points to an open file.

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.

Removes the directory specified by dirName.

Parameters
dirNamethe directory to remove.
Returns
true if successful false if not.

The directory must be empty for rmdir() to succeed.

Parameters
dirNamethe directory to remove.
Returns
true if successful false if not.
See also
mkdir()
bool UaFileEngine::seek ( OpcUa_Int64  pos,
FILE *  pFile,
int  origin 
) const
virtual

Set the current position to the position specified.

Returns true on success; otherwise returns false.

Parameters
posthe position to set. If pos is bigger than the end of the file seek() sets the position to the end of the file.
originthe origin from where to start seeking.
Returns
true if successful false if not.
UaUniString UaFileEngine::systemApplicationDataPath ( ) const
virtual

Get the path to the application folder.

Get the path to the application folder (All Users\Application Data).

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

Returns
the path to the application folder.
the path to the application folder (/etc/xdg).
the path to the application folder (All Users\Application Data).
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: