Update reviewed Tizen::Io doxygen
[platform/framework/native/appfw.git] / inc / FIoFile.h
index d4297b0..57b9b2e 100644 (file)
@@ -32,6 +32,7 @@
 #include <FBaseColIList.h>
 #include <FBaseResult.h>
 #include <FIoFileAttributes.h>
+#include <FIoFileLock.h>
 
 namespace Tizen { namespace Io
 {
@@ -215,8 +216,8 @@ public:
        virtual ~File(void);
 
        /**
-       * @if OSPDEPREC
        * @{
+       * @if OSPDEPREC
        * Initializes this instance of %File with the specified parameters. @n
        * This method opens an existing file or creates a new one according to the specified file opening mode.
        *
@@ -264,8 +265,8 @@ public:
        * @remarks              The following file opening mode strings are recognized by this method: "w+", "wb+", "w+b", "w", "wb", "a+",
        *                               "ab+", "a+b", "a", "ab", "r+", "rb+", "r+b", "r", "rb". @n
        *                               Other strings lead to E_INVALID_ARG. However, "b"(binary) open mode is ignored internally.
-       * @}
        * @endif
+       * @}
        */
        result Construct(const Tizen::Base::String& filePath, const Tizen::Base::String& openMode, bool createParentDirectories);
 
@@ -553,7 +554,7 @@ public:
        result Write(const Tizen::Base::String& buffer);
 
        /**
-       * Flushes the internally buffered data into a permanent storage immediately.
+       * Flushes the internally buffered data.
        *
        * @since                        2.0
        *
@@ -652,6 +653,128 @@ public:
        Tizen::Base::String GetName(void) const;
 
        /**
+       * Acquires the file lock on the current opened whole file if it is not acquired.
+       * If the file lock is already acquired by another process, the current process is blocked until the file lock is
+       * released.
+       *
+       * @since                        2.1
+       *
+       * @return           The pointer to %FileLock instance, @n
+       *                                               else @c null pointer in case of failure
+       * @param[in]            lockType                                The type of file lock to be created
+       * @exception            E_SUCCESS                               The method is successful.
+       * @exception            E_INVALID_ARG                   The specified @c lockType is invalid.
+       * @exception            E_INVALID_OPERATION             Either of the following conditions has occurred: @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_SHARED if the current
+       *                                                                                                 file is not open for reading. @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_EXCLUSIVE if the current
+       *                                                                                                 file is not open for writing. @n
+       * @exception            E_WOULD_DEADLOCK                The method would cause a deadlock. @n
+       *                                                                                               The lock is blocked by a lock from another process, and putting the
+       *                                                                                               calling process to sleep to wait for that lock to become free would
+       *                                                                                               cause a deadlock.
+       * @exception            E_MAX_EXCEEDED                  The number of file lock exceeds system limitations.
+       * @exception            E_SYSTEM                                The method cannot proceed due to a severe system error.
+       * @remarks                      The %FileLock instance is invalid if the associated %File instance is deleted. @n
+       *                                               The specific error code can be accessed using the GetLastResult() method.
+       * @see                          Tizen::Io::File::FileLockType
+       */
+       FileLock* LockN(FileLockType lockType);
+
+       /**
+       * Acquires the file lock on the specified region of the current opened file if it is not acquired.
+       * If the file lock is already acquired by another process, the current process is blocked until the file lock is
+       * released.
+       *
+       * @since                        2.1
+       *
+       * @return                       The pointer to %FileLock instance, @n
+       *                                               else @c null pointer in case of failure
+       * @param[in]            lockType                                The type of file lock to be created
+       * @param[in]            offset                                  The starting offset for the locked region
+       * @param[in]            length                                  The length of the locked region in bytes
+       * @exception            E_SUCCESS                               The method is successful.
+       * @exception            E_INVALID_ARG                   Either of the following conditions has occurred: @n
+       *                                                                                       - The specified @c lockType is invalid.
+       *                                                                                       - The specified @c offset or @c length is negative or is greater than
+       *                                                                                         the system limitation.
+       * @exception            E_INVALID_OPERATION             Either of the following conditions has occurred: @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_SHARED if the current
+       *                                                                                                 file is not open for reading. @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_EXCLUSIVE if the current
+       *                                                                                                 file is not open for writing. @n
+       * @exception            E_WOULD_DEADLOCK                The method would cause a deadlock. @n
+       *                                                                                               The lock is blocked by a lock from another process, and putting the
+       *                                                                                               calling process to sleep to wait for that lock to become free would
+       *                                                                                               cause a deadlock.
+       * @exception            E_MAX_EXCEEDED                  The number of file lock exceeds system limitations.
+       * @exception            E_SYSTEM                                The method cannot proceed due to a severe system error.
+       * @remarks                      The %FileLock instance is invalid if the associated %File instance is deleted. @n
+       *                                               The specific error code can be accessed using the GetLastResult() method.
+       * @see                          Tizen::Io::File::FileLockType
+       */
+       FileLock* LockN(FileLockType lockType, int offset, int length);
+
+       /**
+       * Tries to acquire the file lock on the current opened whole file.
+       * If the file lock is already acquired by another process, E_OBJECT_LOCKED is returned.
+       *
+       * @since                        2.1
+       *
+       * @return                       The pointer to %FileLock instance, @n
+       *                                               else @c null pointer in case of failure
+       * @param[in]            lockType                                The type of file lock to be created
+       * @exception            E_SUCCESS                               The method is successful.
+       * @exception            E_INVALID_ARG                   The specified @c lockType is invalid.
+       * @exception            E_INVALID_OPERATION             Either of the following conditions has occurred: @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_SHARED if the current
+       *                                                                                                 file is not open for reading. @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_EXCLUSIVE if the current
+       *                                                                                                 file is not open for writing. @n
+       * @exception            E_OBJECT_LOCKED                 Either of the following conditions has occurred: @n
+       *                                                                                               - The file lock is already held by another process. @n
+       *                                                                                               - The file to be locked has been memory-mapped by another process.
+       * @exception            E_MAX_EXCEEDED                  The number of file lock exceeds system limitations.
+       * @exception            E_SYSTEM                                The method cannot proceed due to a severe system error.
+       * @remarks                      The %FileLock instance is invalid if the associated %File instance is deleted. @n
+       *                                               The specific error code can be accessed using the GetLastResult() method.
+       * @see                          Tizen::Io::File::FileLockType
+       */
+       FileLock* TryToLockN(FileLockType lockType);
+
+       /**
+       * Tries to acquire the file lock on the specified region of the current opened file.
+       * If the file lock is already acquired by another process, E_OBJECT_LOCKED is returned.
+       *
+       * @since                        2.1
+       *
+       * @return                       The pointer to %FileLock instance, @n
+       *                                               else @c null pointer in case of failure
+       * @param[in]            lockType                                The type of file lock to be created
+       * @param[in]            offset                                  The starting offset for the locked region
+       * @param[in]            length                                  The length of the locked region in bytes
+       * @exception            E_SUCCESS                               The method is successful.
+       * @exception            E_INVALID_ARG                   Either of the following conditions has occurred: @n
+       *                                                                                               - The specified @c lockType is invalid.
+       *                                                                                               - The specified @c offset or @c length is negative or is greater than
+       *                                                                                                 the system limitation.
+       * @exception            E_INVALID_OPERATION             Either of the following conditions has occurred: @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_SHARED if the current
+       *                                                                                                 file is not open for reading. @n
+       *                                                                                               - The specified @c lockType cannot be FILE_LOCK_EXCLUSIVE if the current
+       *                                                                                                 file is not open for writing. @n
+       * @exception            E_OBJECT_LOCKED                 Either of the following conditions has occurred: @n
+       *                                                                                               - The file lock is already held by another process. @n
+       *                                                                                               - The file to be locked has been memory-mapped by another process.
+       * @exception            E_MAX_EXCEEDED                  The number of file lock exceeds system limitations.
+       * @exception            E_SYSTEM                                The method cannot proceed due to a severe system error.
+       * @remarks                      The %FileLock instance is invalid if the associated %File instance is deleted. @n
+       *                                               The specific error code can be accessed using the GetLastResult() method.
+       * @see                          Tizen::Io::File::FileLockType
+       */
+       FileLock* TryToLockN(FileLockType lockType, int offset, int length);
+
+       /**
        * Deletes the file specified. @n
        * The opened file cannot be deleted. This method is static.
        *