Fix : Remove exception handling codes at the sample code
[platform/framework/native/content.git] / inc / FCntContentManagerUtil.h
index 7d60d8a..c685ca0 100644 (file)
@@ -14,7 +14,7 @@
 // limitations under the License.
 //
 /**
- * @file                       FCntContentManagerUtil.h
+ * @file               FCntContentManagerUtil.h
  * @brief              This is the header file for the %ContentManagerUtil class.
  *
  * This header file contains the declarations of the %ContentManagerUtil class.
@@ -39,45 +39,42 @@ class VideoMetadata;
  *
  * @since      2.0
  *
- * The %ContentManagerUtil class provides access to different local content types, such as image, audio, and video, and manages the content metadata.
+ * The %ContentManagerUtil class provides access to different local content types, such as images, audios, and videos, and manages the content metadata.
  *
  * For more information on managing the content's utility 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 %ContentManagerUtil class.
  *
  * @code
+ * #include <FBase.h>
+ * #include <FContent.h>
+ * #include <FSystem.h>
+ *
+ * using namespace Tizen::Content;
+ *
  * result
  * MyClass::TestContentManagerUtil(void)
  * {
  *             // Image
  *             Tizen::Base::String imagePath = Tizen::System::Environment::GetMediaPath() + L"Images/full_meta.jpg";
  *             ImageMetadata* pImageMeta = ContentManagerUtil::GetImageMetaN(imagePath);
- *             TryReturn(pImageMeta != null, GetLastResult(), "GetImageMetaN failed.");
+ *             result r = GetLastResult();
  *
  *             // Audio
  *             Tizen::Base::String audioPath = Tizen::System::Environment::GetMediaPath() + L"Sounds/hot.mp3";
  *             AudioMetadata* pAudioMeta = ContentManagerUtil::GetAudioMetaN(audioPath);
- *             if(pAudioMeta == null)
- *             {
- *                     delete pImageMeta;
- *                     return GetLastResult();
- *             }
+ *             r = GetLastResult();
  *
  *             // Video
  *             Tizen::Base::String videoPath = Tizen::System::Environment::GetMediaPath() + L"Videos/video.mp4";
  *             VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(videoPath);
- *             if(pVideoMeta == null)
- *             {
- *                     delete pImageMeta;
- *                     delete pAudioMeta;
- *                     return GetLastResult();
- *             }
+ *             r = GetLastResult();
  *
  *             delete pImageMeta;
  *             delete pAudioMeta;
  *             delete pVideoMeta;
  *
- *             return E_SUCCESS;
+ *             return r;
  * }
  * @endcode
  */
@@ -88,22 +85,22 @@ public:
         * Gets the metadata for an image from the file.
         *
         * @if OSPCOMPAT
-        * @brief       <i> [Compatibility] </i>
+        * @brief                <i> [Compatibility] </i>
         * @endif
         * @since                       2.0
         * @if OSPCOMPAT
         * @compatibility This method has compatibility issues with OSP compatible applications. @n
-        *                       For more information, see @ref CompContentManagerUtilPage "here".
+        *                For more information, see @ref CompContentManagerUtilPage "here".
         * @endif
         *
-        * @return                      A pointer to ImageMetadata, @n
-        *                     else @c null if an exception occurs
-        * @param[in]   filePath                                        The file path
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
+        * @return                A pointer to ImageMetadata, @n
+        *                else @c null if an exception occurs
+        * @param[in]     filePath                                      The file path
+        * @exception     E_SUCCESS                                     The method is successful.
+        * @exception     E_INVALID_ARG                         The specified input parameter is invalid.
         * @remarks
-        *                              - If the image data is valid but meta information does not exist, the width and height are set from the actual image data.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        *                      - If the image data is valid but the meta information does not exist, the width and the height are set from the actual image data.
+        *                      - The specific error code can be accessed using the GetLastResult() method.
         */
        static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::String& filePath);
 
@@ -112,14 +109,14 @@ public:
         *
         * @since               2.1
         *
-        * @return                      A pointer to ImageMetadata, @n
-        *                     else @c null if an exception occurs
-        * @param[in]   byteBuffer                                      The buffer that contains image data
+        * @return              A pointer to ImageMetadata, @n
+        *              else @c null if an exception occurs
+        * @param[in]   byteBuffer                                      The buffer that contains the image data
         * @exception   E_SUCCESS                                       The method is successful.
         * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
         * @remarks
-        *                              - If the image data in the buffer is valid but meta information does not exist, the width and height are set from the actual image data.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        *                      - If the image data in the buffer is valid but the meta information does not exist, the width and the height are set from the actual image data.
+        *                      - The specific error code can be accessed using the GetLastResult() method.
         */
        static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
 
@@ -127,22 +124,22 @@ public:
         * Gets the metadata for an audio from the file.
         *
         * @if OSPCOMPAT
-        * @brief       <i> [Compatibility] </i>
+        * @brief                       <i> [Compatibility] </i>
         * @endif
         * @since                       2.0
         * @if OSPCOMPAT
-        * @compatibility This method has compatibility issues with OSP compatible applications. @n
-        *                       For more information, see @ref CompContentManagerUtilPage "here".
+        * @compatibility   This method has compatibility issues with OSP compatible applications. @n
+        *                  For more information, see @ref CompContentManagerUtilPage "here".
         * @endif
         *
         * @return                      A pointer to AudioMetadata, @n
-        *                     else @c null if an exception occurs
-        * @param[in]   filePath                                        The file path
-        * @exception   E_SUCCESS                                       The method is successful.
-        * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
+        *                  else @c null if an exception occurs
+        * @param[in]       filePath                                    The file path
+        * @exception       E_SUCCESS                                   The method is successful.
+        * @exception       E_INVALID_ARG                               The specified input parameter is invalid.
         * @remarks
-        *                              - If the audio data is valid but meta information does not exist, the duration is set from the actual audio data.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        *                      - If the audio data is valid but the meta information does not exist, the duration is set from the actual audio data.
+        *                      - The specific error code can be accessed using the GetLastResult() method.
         */
        static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::String& filePath);
 
@@ -151,14 +148,14 @@ public:
         *
         * @since               2.1
         *
-        * @return                      A pointer to AudioMetadata, @n
-        *                     else @c null if an exception occurs
-        * @param[in]   byteBuffer                                      The buffer that contains audio data
+        * @return              A pointer to AudioMetadata, @n
+        *              else @c null if an exception occurs
+        * @param[in]   byteBuffer                                      The buffer that contains the audio data
         * @exception   E_SUCCESS                                       The method is successful.
         * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
         * @remarks
-        *                              - If the audio data in the buffer is valid but meta information does not exist, the duration is set from the actual audio data.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        *                      - If the audio data in the buffer is valid but the meta information does not exist, the duration is set from the actual audio data.
+        *                      - The specific error code can be accessed using the GetLastResult() method.
         */
        static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
 
@@ -171,17 +168,17 @@ public:
         * @since                       2.0
         * @if OSPCOMPAT
         * @compatibility This method has compatibility issues with OSP compatible applications. @n
-        *                       For more information, see @ref CompContentManagerUtilPage "here".
+        *                For more information, see @ref CompContentManagerUtilPage "here".
         * @endif
         *
-        * @return                      A pointer to VideoMetadata, @n
-        *                     else @c null if an exception occurs
-        * @param[in]   filePath                                        The file path
+        * @return                A pointer to VideoMetadata, @n
+        *                else @c null if an exception occurs
+        * @param[in]     filePath                                      The file path
         * @exception   E_SUCCESS                                       The method is successful.
         * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
         * @remarks
-        *                              - If the video data is valid but meta information does not exist, the duration is set from the actual video data.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        *                      - If the video data is valid but the meta information does not exist, the duration is set from the actual video data.
+        *                      - The specific error code can be accessed using the GetLastResult() method.
         */
        static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::String& filePath);
 
@@ -190,14 +187,14 @@ public:
         *
         * @since               2.1
         *
-        * @return                      A pointer to VideoMetadata, @n
-        *                     else @c null if an exception occurs
-        * @param[in]   byteBuffer                                      The buffer that contains video data
+        * @return              A pointer to VideoMetadata, @n
+        *              else @c null if an exception occurs
+        * @param[in]   byteBuffer                                      The buffer that contains the video data
         * @exception   E_SUCCESS                                       The method is successful.
         * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
         * @remarks
-        *                              - If the video data in the buffer is valid but meta information does not exist, the duration is set from the actual video data.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        *                      - If the video data in the buffer is valid but the meta information does not exist, the duration is set from the actual video data.
+        *                      - The specific error code can be accessed using the GetLastResult() method.
         */
        static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
 
@@ -210,19 +207,19 @@ public:
         * @since           2.0
         * @if OSPCOMPAT
         * @compatibility This method has compatibility issues with OSP compatible applications. @n
-        *                       For more information, see @ref CompContentManagerUtilPage "here".
+        *                For more information, see @ref CompContentManagerUtilPage "here".
         * @endif
         *
-        * @return              The content type
-        * @param[in]   filePath                                                The file path
-        * @exception   E_SUCCESS                                               The method is successful.
-        * @exception   E_INVALID_ARG                                   The specified input parameter is invalid, or
-        *                                                          the length of the specified path is @c 0 or exceeds system limitations.
-        * @exception   E_FILE_NOT_FOUND                        The specified file cannot be found.
+        * @return              The content type @n
+        *                              The value can be different for each device
+        * @param[in]   filePath                                The file path
+        * @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 length of the specified path is equal to @c 0 or exceeds system limitations.
+        * @exception   E_FILE_NOT_FOUND                The specified file cannot be found.
         * @exception   E_UNSUPPORTED_FORMAT    The specified format is invalid or not supported.
-        * @remarks
-        *                              - The content type can be different for each device.
-        *                              - The specific error code can be accessed using the GetLastResult() method.
+        * @remarks     The specific error code can be accessed using the GetLastResult() method.
         */
        static Tizen::Content::ContentType CheckContentType(const Tizen::Base::String& filePath);
 
@@ -230,28 +227,28 @@ public:
         * @if OSPDEPREC
         * Copies an existing file to a new directory.
         *
-        * @brief       <i> [Deprecated] </i>
-        * @deprecated   This method is deprecated because a new method has been added. @n
-        *                       Instead of using this method, use ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*).
+        * @brief                   <i> [Deprecated] </i>
+        * @deprecated      This method is deprecated because a new method has been added. @n
+        *                  Instead of using this method, use ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*).
         * @since                       2.0
         *
         * @return                      An error code
         * @param[in]           srcFilePath                             The source file path
-        * @param[in]           destFilePath                            The destination file path
-        * @exception           E_SUCCESS                                       The method is successful.
-        * @exception           E_INVALID_ARG                           Either of the following conditions has occurred: @n
-        *                                                                                                                      - The length of the specified path is equal to @c 0 or exceeds system limitations. @n
-        *                                                                                                                      - The specified path contains prohibited character(s). @n
-        *                                                                                                                      - The specified path is invalid.
-        * @exception           E_ILLEGAL_ACCESS                Access is denied due to insufficient permission.
+        * @param[in]           destFilePath                    The destination file path
+        * @exception           E_SUCCESS                               The method is successful.
+        * @exception           E_INVALID_ARG                   Either of the following conditions has occurred:
+        *                                                                              - The length of the specified path is equal to @c 0 or exceeds system limitations.
+        *                                                                              - The specified path contains prohibited character(s).
+        *                                                                              - The specified path is invalid.
+        * @exception           E_ILLEGAL_ACCESS                The access is denied due to insufficient permission.
         * @exception           E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
         * @exception           E_FILE_ALREADY_EXIST    The specified file already exists.
         * @exception           E_MAX_EXCEEDED                  The number of opened files has exceeded the maximum limit.
         * @exception           E_STORAGE_FULL                  The disk space is full.
-        * @exception           E_IO                                                            Either of the following conditions has occurred: @n
-        *                                                           - An unexpected device failure has occurred as the media ejected suddenly. @n
-        *                                                           - File corruption is detected. @n
-        *                                                           - The volume or quota is no more available.
+        * @exception           E_IO                                    Either of the following conditions has occurred:
+        *                                                              - An unexpected device failure has occurred as the media ejected suddenly.
+        *                                                              - %File corruption is detected.
+        *                                                              - The volume or quota is no more available.
         * @remarks
         *                               - The source file in the system region cannot be copied.
         *                               - The destination file path must start with @c '/Media' or @c '/Storagecard/Media'.
@@ -263,28 +260,28 @@ public:
         * @if OSPDEPREC
         * Moves the file to a new directory.
         *
-        * @brief       <i> [Deprecated] </i>
-        * @deprecated   This method is deprecated because a new method has been added. @n
-        *                       Instead of using this method, use ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*).
+        * @brief               <i> [Deprecated] </i>
+        * @deprecated      This method is deprecated because a new method has been added. @n
+        *                  Instead of using this method, use ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*).
         * @since                       2.0
         *
         * @return                      An error code
         * @param[in]           srcFilePath                             The source file path
-        * @param[in]           destFilePath                            The destination file path
-        * @exception           E_SUCCESS                                       The method is successful.
-        * @exception           E_INVALID_ARG                           Either of the following conditions has occurred: @n
-        *                                                           - The length of the specified path is equal to @c 0 or exceeds system limitations. @n
-        *                                                           - The specified path contains prohibited character(s). @n
-        *                                                           - The specified path is invalid.
-        * @exception           E_ILLEGAL_ACCESS                Access is denied due to insufficient permission.
+        * @param[in]           destFilePath                    The destination file path
+        * @exception           E_SUCCESS                               The method is successful.
+        * @exception           E_INVALID_ARG                   Either of the following conditions has occurred:
+        *                                                              - The length of the specified path is equal to @c 0 or exceeds system limitations.
+        *                                                              - The specified path contains prohibited character(s).
+        *                                                              - The specified path is invalid.
+        * @exception           E_ILLEGAL_ACCESS                The access is denied due to insufficient permission.
         * @exception           E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
         * @exception           E_FILE_ALREADY_EXIST    The specified file already exists.
         * @exception           E_MAX_EXCEEDED                  The number of opened files has exceeded the maximum limit.
         * @exception           E_STORAGE_FULL                  The disk space is full.
-        * @exception           E_IO                                                            Either of the following conditions has occurred: @n
-        *                                                                                                                      - An unexpected device failure has occurred as the media ejected suddenly. @n
-        *                                                                                                                      - File corruption is detected. @n
-        *                                                                                                                      - The volume or quota is no more available.
+        * @exception           E_IO                                    Either of the following conditions has occurred:
+        *                                                                      - An unexpected device failure has occurred as the media ejected suddenly.
+        *                                                                      - %File corruption is detected.
+        *                                                                      - The volume or quota is no more available.
         * @remarks
         *                       - The source file in the system region cannot be copied.
         *                       - The destination file path must start with @c '/Media' or @c '/Storagecard/Media'.
@@ -296,18 +293,18 @@ public:
         * @if OSPCOMPAT
         * @page        CompContentManagerUtilPage Compatibility for the file path.
         * @section     CompContentManagerUtilPageIssueSection Issues
-        *                 The file path argument of this method in OSP compatible applications has the following issues: @n
-        *                 -# The file path should be a path that begins with an allowed path prefix. @n
-        *                     For example, L"/Media/Images/flower.jpg", "/Storagecard/Media/Images/flower.jpg".
+        *          The file path argument of this method in OSP compatible applications has the following issues: @n
+        *          -# The file path should be a path that begins with an allowed path prefix. @n
+        *             For example, L"/Media/Images/flower.jpg", "/Storagecard/Media/Images/flower.jpg".
         *
         * @section     CompContentManagerUtilPageSolutionSection Resolutions
-        *                 This issue has been resolved in Tizen. @n
-        *                 -# The file 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 file 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
         */