Fix : Remove exception handling codes at the sample code
[platform/framework/native/content.git] / inc / FCntContentManager.h
index 7501c2d..8aad3f5 100644 (file)
@@ -45,83 +45,58 @@ class IContentUpdateEventListener;
  *
  * @since      2.0
  *
+ * @final   This class is not intended for extension.
+ *
  * The %ContentManager class manages the information stored locally on the device's content database. @n
- * It also allows you to create, read, update, and delete specific content information in the database.
+ * It also allows the user to create, read, update, and delete specific content information in the database.
  *
  * For more information on managing content on the device, see <a href="../org.tizen.native.appprogramming/html/guide/content/device_content_mgmt.htm">Device Content Management</a>.
  *
  * The following example demonstrates how to use the %ContentManager class.
  *
  * @code
+ * #include <FApp.h>
+ * #include <FBase.h>
+ * #include <FContent.h>
+ * #include <FSystem.h>
+ *
+ * using namespace Tizen::Content;
+ *
  * result
  * MyClass::TestContentManager(void)
  * {
- *             result r = E_SUCCESS;
- *             ContentId contentId;
  *             ContentManager contentManager;
- *             r = contentManager.Construct();
- *             TryReturn(!IsFailed(r), r, "Construct failed.");
+ *             result r = contentManager.Construct();
  *
- *             // Creates
+ *             // Creates Content
  *             ImageContentInfo imageContentInfo;
  *             r = imageContentInfo.Construct(null);
- *             TryReturn(!IsFailed(r), r, "Construct failed.");
  *
  *             r = imageContentInfo.SetKeyword(L"platform, tizen");
- *             if (IsFailed(r))
- *             {
- *                     return r;
- *             }
- *
  *             r = imageContentInfo.SetLocationTag(L"seoul");
- *             if (IsFailed(r))
- *             {
- *                     return r;
- *             }
  *
  *             Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.jpg";
  *             Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Images/flower.jpg";
  *
- *             contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
- *             TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
+ *             ContentId contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
+ *             r = GetLastResult();
  *
- *             // Gets
- *             ImageContentInfo* pImageContentInfo = null;
- *             pImageContentInfo = dynamic_cast<ImageContentInfo*>(contentManager.GetContentInfoN(contentId));
- *             TryReturn(pImageContentInfo != null, GetLastResult(), "GetContentInfoN failed.");
+ *             // Gets Content
+ *             ImageContentInfo* pImageContentInfo = dynamic_cast< ImageContentInfo* >(contentManager.GetContentInfoN(contentId));
+ *             r = GetLastResult();
  *
  *             pImageContentInfo->GetContentPath();
  *
- *             // Updates
+ *             // Updates Content
  *             r = pImageContentInfo->SetKeyword(L"apple, fruit");
- *             if (IsFailed(r))
- *             {
- *                     delete pImageContentInfo;
- *                     return r;
- *             }
  *             r = pImageContentInfo->SetProvider(L"kw1128");
- *             if (IsFailed(r))
- *             {
- *                     delete pImageContentInfo;
- *                     return r;
- *             }
  *             r = contentManager.UpdateContent(*pImageContentInfo);
- *             if (IsFailed(r))
- *             {
- *                     delete pImageContentInfo;
- *                     return r;
- *             }
  *
- *             // Deletes
+ *             // Deletes Content
  *             r = contentManager.DeleteContent(contentId);
- *             if (IsFailed(r))
- *             {
- *                     delete pImageContentInfo;
- *                     return r;
- *             }
  *
  *             delete pImageContentInfo;
- *             return r;
+ *             return r;
  * }
  * @endcode
  */
@@ -152,7 +127,6 @@ public:
         *
         * @return                      An error code
         * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         * @exception   E_SYSTEM                                        A system error has occurred.
         */
        result Construct(void);
@@ -160,25 +134,25 @@ public:
        /**
         * Creates the content information.
         *
-        * @since                       2.0
-        * @privlevel           public
-        * @privilege           %http://tizen.org/privilege/content.write
+        * @since               2.0
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/content.write
         *
-        * @return                      The content ID
-        * @param[in]   contentInfo                                             An instance of ContentInfo
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           The specified input parameter is invalid, or
-        *                                                      the specified format is invalid or not supported on the device.
+        * @return              The content ID
+        * @param[in]   contentInfo                             An instance of ContentInfo
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_INVALID_ARG                   Either of the following conditions has occurred:
+        *                                                                      - The specified input parameter is invalid.
+        *                                                                      - The specified format is either invalid or not supported on the device.
         * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
-        * @exception   E_IO                                                            An I/O error has occurred.
-        * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
-        * @exception   E_SYSTEM                                                A system error has occurred.
+        * @exception   E_IO                                    An I/O error has occurred.
+        * @exception   E_SYSTEM                                A system error has occurred.
         * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
         * @remarks
-        *                              - If the @c E_UNSUPPORTED_FORMAT exception is received from ContentManagerUtil::CheckContentType(),
-        *                                      the file can be created as a content only using the OtherContentInfo class.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        *                      - If the @c E_UNSUPPORTED_FORMAT exception is received from ContentManagerUtil::CheckContentType(),
+        *                      the file can be created as content only using the OtherContentInfo class.
+        *                      - The specific error code can be accessed using the GetLastResult() method.
         */
        ContentId CreateContent(const ContentInfo& contentInfo);
 
@@ -191,32 +165,31 @@ public:
         * @since                       2.0
         * @if OSPCOMPAT
         * @compatibility This method has compatibility issues with OSP compatible applications. @n
-        *                       For more information, see @ref CompContentManagerCreateContentPage "here".
+        *                 For more information, see @ref CompContentManagerCreateContentPage "here".
         * @endif
-        * @privlevel           public
-        * @privilege           %http://tizen.org/privilege/content.write
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/content.write
         *
-        * @return                      The content ID
-        * @param[in]   byteBuffer                                              The @c byteBuffer of the content to create
-        * @param[in]   destinationPath                         The destination file path formed by the @c byteBuffer
-        * @param[in]   pContentInfo                                    A pointer to the ContentInfo instance @n
-        *                                                         If the content path exists in %ContentInfo, it gets ignored.
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           Either of the following conditions has occurred: @n
-        *                                                         - A specified input parameter is invalid. @n
-        *                                                         - There is a mismatch between the type specified in ContentInfo and the type specified in the actual content.
-        * @exception   E_STORAGE_FULL                  The storage is full.
-        * @exception   E_FILE_ALREADY_EXIST    The specified file already exists.
-        * @exception   E_ILLEGAL_ACCESS                Access is denied due to insufficient permission.
-        * @exception   E_MAX_EXCEEDED                  The number of opened files has exceeded the maximum limit.
-        * @exception   E_IO                                                            An I/O error has occurred.
-        * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
-        * @exception   E_SYSTEM                                                A system error has occurred.
-        * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
-        * @exception   E_SERVICE_BUSY                  The database is busy.
-        * @remarks
-        *                              - The destination path should start with the directory path returned by either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath().
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        * @return              The content ID
+        * @param[in]   byteBuffer                         The @c byteBuffer of the content to create
+        * @param[in]   destinationPath            The destination file path formed by the @c byteBuffer @n
+        *                                                                         The path should start with the directory path returned by either
+        *                                                                         Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath().
+        * @param[in]   pContentInfo               A pointer to the ContentInfo instance @n
+        *                                     If the content path exists in %ContentInfo, it gets ignored.
+        * @exception   E_SUCCESS                          The method is successful.
+        * @exception   E_INVALID_ARG              Either of the following conditions has occurred:
+        *                                                              - A specified input parameter is invalid. 
+        *                                                              - There is a mismatch between the type specified in ContentInfo and the type specified in the actual content.
+        * @exception   E_STORAGE_FULL             The storage is full.
+        * @exception   E_FILE_ALREADY_EXIST   The specified file already exists.
+        * @exception   E_ILLEGAL_ACCESS           The access is denied due to insufficient permission.
+        * @exception   E_MAX_EXCEEDED             The number of opened files has exceeded the maximum limit.
+        * @exception   E_IO                               An I/O error has occurred.
+        * @exception   E_SYSTEM                           A system error has occurred.
+        * @exception   E_PRIVILEGE_DENIED         The application does not have the privilege to call this method.
+        * @exception   E_SERVICE_BUSY         The database is busy.
+        * @remarks     The specific error code can be accessed using the GetLastResult() method.
         */
        ContentId CreateContent(const Tizen::Base::ByteBuffer& byteBuffer, const Tizen::Base::String& destinationPath, const ContentInfo* pContentInfo = null);
 
@@ -224,42 +197,42 @@ public:
         * Copies or moves the actual content to the destination path and creates the content information.
         *
         * @if OSPCOMPAT
-        * @brief       <i> [Compatibility] </i>
+        * @brief                 <i> [Compatibility] </i>
         * @endif
-        * @since                       2.0
+        * @since                  2.0
         * @if OSPCOMPAT
         * @compatibility This method has compatibility issues with OSP compatible applications. @n
-        *                       For more information, see @ref CompContentManagerCreateContentPage "here".
+        *                For more information, see @ref CompContentManagerCreateContentPage "here".
         * @endif
-        * @privlevel           public
-        * @privilege           %http://tizen.org/privilege/content.write
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/content.write
         *
-        * @return                      The content ID
-        * @param[in]   sourcePath                                              The source file path
-        * @param[in]   destinationPath                         The destination file path
-        * @param[in]   deleteSource                                    Set to @c true in order to delete the source file, @n
-        *                                                                                                                      else @c false
-        * @param[in]   pContentInfo                                    A pointer to the ContentInfo instance @n
-        *                                                         If the content path exists in %ContentInfo, it gets ignored.
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           Either of the following conditions has occurred: @n
-        *                                                         - A specified input parameter is invalid. @n
-        *                                                         - There is a mismatch between the type of the source path and destination path. @n
-        *                                                         - There is a mismatch between the type specified in ContentInfo and the type specified in the actual content.
+        * @return              The content ID
+        * @param[in]   sourcePath                              The source file path @n
+        *                                                                              The path should start with the directory path returned by either Tizen::App::App::GetAppRootPath()
+        *                                                                              or Tizen::System::Environment::GetExternalStoragePath().
+        * @param[in]   destinationPath                 The destination file path @n
+        *                                                                          The path should start with the directory path returned by either Tizen::System::Environment::GetMediaPath()
+        *                                                                          or Tizen::System::Environment::GetExternalStoragePath().
+        * @param[in]   deleteSource                    Set to @c true in order to delete the source file, @n
+        *                                                                              else @c false
+        * @param[in]   pContentInfo                    A pointer to the ContentInfo instance @n
+        *                                      If the content path exists in %ContentInfo, it gets ignored.
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_INVALID_ARG                   Either of the following conditions has occurred:
+        *                                                              - A specified input parameter is invalid.
+        *                                                              - There is a mismatch between the type of the source path and the destination path.
+        *                                                              - There is a mismatch between the type specified in ContentInfo and the type specified in the actual content.
         * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
         * @exception   E_STORAGE_FULL                  The storage is full.
         * @exception   E_FILE_ALREADY_EXIST    The specified file already exists.
-        * @exception   E_ILLEGAL_ACCESS                Access is denied due to insufficient permission.
+        * @exception   E_ILLEGAL_ACCESS                The access is denied due to insufficient permission.
         * @exception   E_MAX_EXCEEDED                  The number of opened files has exceeded the maximum limit.
-        * @exception   E_IO                                                            An I/O error has occurred.
-        * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
-        * @exception   E_SYSTEM                                                A system error has occurred.
+        * @exception   E_IO                                    An I/O error has occurred.
+        * @exception   E_SYSTEM                                A system error has occurred.
         * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
-        * @remarks
-        *                              - The source path should start with the directory path returned by either Tizen::App::App::GetAppRootPath() or Tizen::System::Environment::GetExternalStoragePath().
-        *                              - The destination path should start with the directory path returned by either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath().
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        * @remarks     The specific error code can be accessed using the GetLastResult() method.
         */
        ContentId CreateContent(const Tizen::Base::String& sourcePath, const Tizen::Base::String& destinationPath, bool deleteSource, const ContentInfo* pContentInfo = null);
 
@@ -267,18 +240,18 @@ public:
         * @if OSPCOMPAT
         * @page        CompContentManagerCreateContentPage Compatibility for the file path.
         * @section     CompContentManagerCreateContentPageIssueSection Issues
-        *                 The content path argument of this method in OSP compatible applications has the following issues: @n
-        *                 -# The content path should be a path that begins with an allowed path prefix. @n
-        *                     For example, L"/Media/Images/flower.jpg", L"/Storagecard/Media/Images/flower.jpg".
+        *          The content path argument of this method in OSP compatible applications has the following issues: @n
+        *          -# The content path should be a path that begins with an allowed path prefix. @n
+        *             For example, L"/Media/Images/flower.jpg", L"/Storagecard/Media/Images/flower.jpg".
         *
         * @section     CompContentManagerCreateContentPageSolutionSection Resolutions
-        *                 This issue has been resolved in Tizen. @n
-        *                 -# The content path can be a path without a specific allowed path prefix. @n
-        *                 Application do not need to know the specific allowed path prefixes. @n
-        *                 To get the directory path, use the following methods: @n
-        *                 - For accessing the home directory, use Tizen::App::App::GetInstance()->GetAppRootPath().
-        *                 - For accessing the media directory, use Tizen::System::Environment::GetMediaPath().
-        *                 - For accessing the external storage, use Tizen::System::Environment::GetExternalStoragePath().
+        *          This issue has been resolved in Tizen. @n
+        *          -# The content path can be a path without a specific allowed path prefix. @n
+        *             Applications do not need to know the specific allowed path prefixes. @n
+        *             To get the directory path, use the following methods: @n
+        *             - For accessing the home directory, use Tizen::App::App::GetInstance()->GetAppRootPath().
+        *             - For accessing the media directory, use Tizen::System::Environment::GetMediaPath().
+        *             - For accessing the external storage, use Tizen::System::Environment::GetExternalStoragePath().
         *
         * @endif
         */
@@ -286,18 +259,18 @@ public:
        /**
         * Gets the content information.
         *
-        * @since                       2.0
-        * @privlevel           public
-        * @privilege           %http://tizen.org/privilege/content.read
+        * @since               2.0
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/content.read
         *
-        * @return                      A pointer to ContentInfo
-        * @param[in]   contentId                                               The content ID
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           The specified input parameter is invalid, or
-        *                                          the content information corresponding to @c contentId cannot be found.
+        * @return              A pointer to ContentInfo
+        * @param[in]   contentId                               The content ID
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_INVALID_ARG                   Either of the following conditions has occurred:
+        *                                                                      - The specified input parameter is invalid.
+        *                                                                      - The content information corresponding to @c contentId cannot be found.
         * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
-        * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
-        * @exception   E_SYSTEM                                                A system error has occurred.
+        * @exception   E_SYSTEM                                A system error has occurred.
         * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
@@ -307,17 +280,16 @@ public:
        /**
         * Updates the content information with the specified instance of ContentInfo.
         *
-        * @since                       2.0
-        * @privlevel           public
-        * @privilege           %http://tizen.org/privilege/content.write
+        * @since               2.0
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/content.write
         *
-        * @return                      An error code
-        * @param[in]   contentInfo                                             An instance of ContentInfo
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
+        * @return              An error code
+        * @param[in]   contentInfo                             An instance of ContentInfo
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
         * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
-        * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
-        * @exception   E_SYSTEM                                                A system error has occurred.
+        * @exception   E_SYSTEM                                A system error has occurred.
         * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
         */
@@ -326,19 +298,19 @@ public:
        /**
         * Deletes the content information with the specified content ID.
         *
-        * @since                       2.0
-        * @privlevel           public
-        * @privilege           %http://tizen.org/privilege/content.write
+        * @since               2.0
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/content.write
         *
-        * @return                      An error code
-        * @param[in]   contentId                                               The content ID
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           The specified input parameter is invalid, or
-        *                                          the content information corresponding to @c contentId cannot be found.
+        * @return              An error code
+        * @param[in]   contentId                               The content ID
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_INVALID_ARG                   Either of the following conditions has occurred:
+        *                                                                      - The specified input parameter is invalid.
+        *                                                                      - The content information corresponding to @c contentId cannot be found.
         * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
-        * @exception   E_ILLEGAL_ACCESS                Access is denied due to insufficient permission.
-        * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
-        * @exception   E_SYSTEM                                                A system error has occurred.
+        * @exception   E_ILLEGAL_ACCESS                The access is denied due to insufficient permission.
+        * @exception   E_SYSTEM                                A system error has occurred.
         * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
         * @remarks             The physical file corresponding to @c contentId is deleted.
@@ -353,33 +325,32 @@ public:
         * @return                      An error code
         * @param[in]           listener                                The event listener to add
         * @exception           E_SUCCESS                               The method is successful.
-        * @exception           E_OBJ_ALREADY_EXIST     The listener has already been added.
+        * @exception           E_OBJ_ALREADY_EXIST         The listener has already been added.
         * @exception           E_SYSTEM                                The method cannot proceed due to a severe system error.
-        * @remarks             Only a listener of an instance can be added.
-        *                                      If you add more than two listeners, the listener added first will receive notification for the DB change.
+        * @remarks             Only a listener of an instance can be added. If you add more than two listeners, the listener added first receives the notification for the DB change.
         */
        result AddContentUpdateEventListener(IContentUpdateEventListener& listener);
 
        /**
-        * Removes a listener.
+        * Removes a listener which is registered to receive the database change notification.
         *
         * @since           2.1
         *
         * @return                      An error code
         * @param[in]           listener                        The event listener to remove
         * @exception           E_SUCCESS                       The method is successful.
-        * @exception           E_OBJ_NOT_FOUND The listener is not found.
+        * @exception           E_OBJ_NOT_FOUND     The listener is not found.
         * @exception           E_SYSTEM                        The method cannot proceed due to a severe system error.
         */
        result RemoveContentUpdateEventListener(IContentUpdateEventListener& listener);
 
 
        /**
-        * Requests to scan a file.
+        * Requests to synchronize a specified file with the database.
         *
-        * @since                       2.1
-        * @privlevel           public
-        * @privilege           %http://tizen.org/privilege/content.write
+        * @since               2.1
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/content.write
         *
         * @return              An error code
         * @param[in]   contentPath                     The content path
@@ -392,7 +363,7 @@ public:
        static result ScanFile(const Tizen::Base::String& contentPath);
 
        /**
-        * Requests to scan a directory.
+        * Requests to synchronize files in the specified directory with the database.
         *
         * @since                       2.1
         * @privlevel           public
@@ -426,9 +397,9 @@ private:
 
 private:
        friend class _ContentManagerImpl;
-       _ContentManagerImpl* __pImpl;
+       _ContentManagerImpl* __pContentManagerImpl;
 
-};  // Class ContentManager
+};  // ContentManager
 
 }}  // Tizen::Content