--- a/qthighway/xqserviceutil/src/xqsharablefile.cpp Wed Aug 18 10:38:12 2010 +0300
+++ b/qthighway/xqserviceutil/src/xqsharablefile.cpp Thu Sep 02 21:20:48 2010 +0300
@@ -23,26 +23,52 @@
#include "xqsharablefile.h"
#include <QVariant>
+/*!
+ \class XQSharableFile
+ \inpublicgroup QtBaseModule
+ \ingroup ipc
+ \brief Encapsulates needed functionality to pass one Symbian data-caged file handle to service provider.
+*/
+
+/*!
+ Constructor.
+*/
XQSharableFile::XQSharableFile() :
mHandle(0)
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::XQSharableFile");
}
+/*!
+ Constructor.
+ \param file Existing and valid file handle to be set to this XQSharableFile.
+*/
XQSharableFile::XQSharableFile(RFile &file)
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::XQSharableFile(RFile)");
setHandle(file);
}
+/*!
+ Destroys the descriptor.
+
+ \b Note!
+ The destructor does not close the file handle.
+ You have to close it via the close() method.
+*/
XQSharableFile::~XQSharableFile()
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::~XQSharableFile");
// One need to call close() explicitelly when all done
}
-
+/*!
+ Sets the existing and valid sharable file. Use this
+ function if you obtained the handle from the other APIs.
+ \return True if the handle is valid and can be set,
+ false otherwise.
+*/
bool XQSharableFile::setHandle(RFile &file)
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::setHandle");
@@ -65,6 +91,12 @@
return true;
}
+/*!
+ Gets the set handle, if any.
+ \param handle Reference to handle to be set with
+ this XQSharableFile's handle.
+ \return True if the handle is valid, false otherwise.
+*/
bool XQSharableFile::getHandle(RFile &handle) const
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::getHandle");
@@ -75,19 +107,37 @@
return true;
}
-
+/*!
+ Get file name associated with this XQSharableFile.
+ \return Full file name associated with this XQSharableFile.
+*/
QString XQSharableFile::fileName() const
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::fileName");
return mFileName;
}
+/*!
+ Checks if this XQSharableFile is valid, that is if the associated
+ file handle is valid.
+ \return True if file handle of this XQSharableFile is valid,
+ false otherwise.
+*/
bool XQSharableFile::isValid() const
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::isValid=%d", mHandle != 0);
return mHandle != 0;
}
+/*!
+ Creates and sets the sharable file handle of the given file.
+ The file can be private, data-caged directory.
+ Currently only supported access mode is R/O.
+ \b Note! After opening the file, it should be closed by calling close().
+ \param fileName File to be opened.
+ \return True if the file name was ok and the file was opened successfuly,
+ false otherwise.
+*/
bool XQSharableFile::open(const QString &fileName)
{
close(); // Close possibly existing old one
@@ -116,6 +166,10 @@
return true;
}
+/*!
+ Close the sharable file handle.
+ <b>It is very important to close the handle if it is no longer needed.</b>
+*/
void XQSharableFile::close()
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::close");
@@ -132,7 +186,10 @@
}
-
+/*!
+ Serializes XQSharableFile into a stream.
+ \param s Stream to which this XQSharableFile will be serialized.
+*/
template <typename Stream> void XQSharableFile::serialize(Stream &s) const
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::serialize");
@@ -142,6 +199,10 @@
XQSERVICE_DEBUG_PRINT("%s", qPrintable(str));
}
+/*!
+ Deserializes XQSharableFile from a stream.
+ \param s Stream from which XQSharableFile will be deserialized.
+*/
template <typename Stream> void XQSharableFile::deserialize(Stream &s)
{
XQSERVICE_DEBUG_PRINT("XQSharableFile::deserialize");
@@ -154,6 +215,10 @@
}
+/*!
+ Compares two XQSharableFile objects.
+ \return True if both XQSharableFile objects are equal, false otherwise.
+*/
bool XQSharableFile::operator==( const XQSharableFile &other )
{
return (mFileName == other.mFileName) && (mHandle == other.mHandle);