UA Server SDK C++ Bundle  1.4.1.271
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
UaFileEngine Class Reference

#include <uafileengine.h>

Inherits UaAbstractFileEngine.

Public Member Functions

 UaFileEngine ()
 function pointer to PathIsRelativeWType More...
 
virtual ~UaFileEngine ()
 destruction
 
virtual bool remove (const UaUniString &sFileName) const
 Removes the file, fileName. More...
 
virtual bool copy (const UaUniString &fileName, const UaUniString &newName) const
 The copy function copies an existing file to an new file. More...
 
virtual bool rename (const UaUniString &fileName, const UaUniString &newName) const
 Renames a file or directory from fileName to newName, and returns true if successful; otherwise returns false. 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 a sub-directory called dirName. More...
 
virtual bool rmdir (const UaUniString &dirName) const
 Removes the directory specified by dirName. More...
 
virtual bool caseSensitive () const
 Nothing to do under Win. More...
 
virtual bool isRelativePath (const UaUniString &sPath) const
 Converts the directory path to an absolute path. 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 and opens it for writing. More...
 
virtual bool exists (const UaUniString &sPath) const
 This method checks if the given path still exists or not. More...
 
virtual FILE * openFile (const UaUniString &fileName, const UaUniString &mode) const
 Opens a file. More...
 
virtual FILE * openFile (const UaUniString &fileName, const UaUniString &mode, ShareMode shareMode) 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 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
 Returns the canonical path, i.e. 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 (<username>\Application Data). More...
 
virtual UaUniString systemApplicationDataPath () const
 Get the path to the application folder (All Users\Application Data). 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 ( )

function pointer to PathIsRelativeWType

construction

Member Function Documentation

UaUniString UaFileEngine::applicationDataPath ( ) const
virtual

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

Returns
the path to the application folder (<username>\Application Data).
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

Nothing to do under Win.

Returns
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 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 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.
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.
bool UaFileEngine::createFile ( const UaUniString sPath,
const UaUniString sFileName 
) const
virtual

Create a new file and opens it for writing.

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

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

Converts the directory path to an absolute path.

If it is already absolute nothing happens.

Returns
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.
bool UaFileEngine::mkdir ( const UaUniString dirName) const
virtual

Creates a sub-directory called dirName.

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.
FILE * UaFileEngine::openFile ( const UaUniString fileName,
const UaUniString mode,
ShareMode  shareMode 
) const
virtual

Opens a file.

Parameters
fileNamethe path to the file.
modethe open mode (see fopen for details).
shareModespecifies if other processes are allowed to open the file.
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, fileName.

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

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

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 specified by dirName.

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

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

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

Returns
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: