[content] Add impl classes for ContentInfo
authorSeokpil Park <seokpil.park@samsung.com>
Mon, 5 Aug 2013 06:40:17 +0000 (15:40 +0900)
committerSeokpil Park <seokpil.park@samsung.com>
Mon, 12 Aug 2013 08:55:17 +0000 (17:55 +0900)
Change-Id: Iaeb64b52ad8482559e2f3ed3a3f76385503df8df
Signed-off-by: Seokpil Park <seokpil.park@samsung.com>
39 files changed:
CMakeLists.txt
inc/FCntAudioContentInfo.h
inc/FCntContentInfo.h
inc/FCntContentManager.h
inc/FCntIContentUpdateEventListener.h
inc/FCntImageContentInfo.h
inc/FCntOtherContentInfo.h
inc/FCntVideoContentInfo.h
src/FCntAudioContentInfo.cpp
src/FCntContentInfo.cpp
src/FCntContentManager.cpp
src/FCntDownloadManager.cpp
src/FCntImageContentInfo.cpp
src/FCntOtherContentInfo.cpp
src/FCntVideoContentInfo.cpp
src/FCnt_AudioContentInfoImpl.cpp [new file with mode: 0644]
src/FCnt_ContentDirectoryImpl.cpp
src/FCnt_ContentInfoHelper.cpp [new file with mode: 0644]
src/FCnt_ContentInfoHelper.h [new file with mode: 0644]
src/FCnt_ContentInfoImpl.cpp [new file with mode: 0644]
src/FCnt_ContentManagerImpl.cpp
src/FCnt_ContentSearchImpl.cpp
src/FCnt_ContentUtility.cpp
src/FCnt_DownloadManagerImpl.cpp
src/FCnt_ImageContentInfoImpl.cpp [new file with mode: 0644]
src/FCnt_OtherContentInfoImpl.cpp [new file with mode: 0644]
src/FCnt_PlayListImpl.cpp
src/FCnt_PlayListManagerImpl.cpp
src/FCnt_VideoContentInfoImpl.cpp [new file with mode: 0644]
src/inc/FCnt_AudioContentInfoImpl.h [new file with mode: 0644]
src/inc/FCnt_ContentDirectoryImpl.h
src/inc/FCnt_ContentInfoImpl.h [new file with mode: 0644]
src/inc/FCnt_ContentManagerImpl.h
src/inc/FCnt_ContentSearchImpl.h
src/inc/FCnt_ContentUtility.h
src/inc/FCnt_ImageContentInfoImpl.h [new file with mode: 0644]
src/inc/FCnt_OtherContentInfoImpl.h [new file with mode: 0644]
src/inc/FCnt_PlayListImpl.h
src/inc/FCnt_VideoContentInfoImpl.h [new file with mode: 0644]

index 5aa4117..61e3319 100644 (file)
@@ -45,6 +45,12 @@ SET (${this_target}_SOURCE_FILES
        src/FCnt_ContentDownloadUserData.cpp
        src/FCnt_DownloadManagerImpl.cpp
        src/FCnt_DownloadRequestImpl.cpp
+       src/FCnt_ContentInfoImpl.cpp
+       src/FCnt_ImageContentInfoImpl.cpp
+       src/FCnt_AudioContentInfoImpl.cpp
+       src/FCnt_VideoContentInfoImpl.cpp
+       src/FCnt_OtherContentInfoImpl.cpp
+       src/FCnt_ContentInfoHelper.cpp
        src/FCntAudioContentInfo.cpp
        src/FCntAudioMetadata.cpp
        src/FCntContentInfo.cpp
index b2982db..642d9d3 100644 (file)
@@ -29,6 +29,7 @@ namespace Tizen { namespace Content
 {
 
 class _AudioContentInfoImpl;
+class _AudioContentData;
 
 /**
  * @class      AudioContentInfo
@@ -266,32 +267,6 @@ public:
        long GetDuration(void) const;
 
 private:
-       class _AudioContentData
-       {
-       public:
-               _AudioContentData()
-                       : bitrate(0)
-                       , releaseYear(0)
-                       , duration(0)
-                       , pTitle(null)
-                       , pAlbumName(null)
-                       , pArtist(null)
-                       , pComposer(null)
-                       , pGenre(null)
-                       , pCopyright(null)
-                       , pTrackInfo(null) {}
-
-               int bitrate;
-               int releaseYear;
-               long duration;
-               Tizen::Base::String* pTitle;
-               Tizen::Base::String* pAlbumName;
-               Tizen::Base::String* pArtist;
-               Tizen::Base::String* pComposer;
-               Tizen::Base::String* pGenre;
-               Tizen::Base::String* pCopyright;
-               Tizen::Base::String* pTrackInfo;
-       };
 
        /**
         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
@@ -303,24 +278,13 @@ private:
         */
        AudioContentInfo& operator =(const AudioContentInfo& rhs);
 
-       result SetAudioContentData(const _AudioContentData* pAudioContentData);
-
-       _AudioContentData* GetAudioContentData(void);
-
 private:
-       _AudioContentData* __pAudioContentData;
-
-       friend class _ContentManagerImpl;
-       friend class _ContentSearchImpl;
-       friend class _ContentDirectoryImpl;
-       friend class _ContentUtility;
-       friend class _PlayListManagerImpl;
-       friend class _PlayListImpl;
 
+       _AudioContentData* __pAudioContentData;
+       _AudioContentInfoImpl* __pAudioContentInfoImpl;
        friend class _AudioContentInfoImpl;
-       _AudioContentInfoImpl* __pImpl;
 
-};  // Class AudioContentInfo
+};  // AudioContentInfo
 
 }}  // Tizen::Content
 
index eef3e55..750d8e9 100644 (file)
 #include <FCntTypes.h>
 #include <FLocCoordinates.h>
 
-namespace Tizen { namespace Locations
-{
-class Coordinates;
-}}
-
 namespace Tizen { namespace Graphics
 {
 class Bitmap;
@@ -167,6 +162,7 @@ public:
         * @since               2.0
         *
         * @return              The content name
+        * @remarks     The content name is not a file name.
         */
        Tizen::Base::String GetContentName(void) const;
 
@@ -208,7 +204,6 @@ public:
         * @param[in]   locationTag                     The new location tag
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 45 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetLocationTag(const Tizen::Base::String& locationTag);
 
@@ -230,7 +225,6 @@ public:
         * @param[in]   rating                          The new rating
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 45 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetRating(const Tizen::Base::String& rating);
 
@@ -252,7 +246,6 @@ public:
         * @param[in]   category                                The new category
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 45 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetCategory(const Tizen::Base::String& category);
 
@@ -274,7 +267,6 @@ public:
         * @param[in]   description                             The new description
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 140 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetDescription(const Tizen::Base::String& description);
 
@@ -302,7 +294,6 @@ public:
         * @return                      A pointer to the thumbnail image
         * @exception   E_SUCCESS                                       The method is successful.
         * @exception   E_DATA_NOT_FOUND                The thumbnail image does not exist.
-        * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
         * @remarks     The specific error code can be accessed using the GetLastResult() method.
         */
        Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
@@ -345,7 +336,6 @@ public:
         * @param[in]   contentName                     The new content name
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 45 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetContentName(const Tizen::Base::String& contentName);
 
@@ -358,7 +348,6 @@ public:
         * @param[in]   keyword                                 The new keyword
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 45 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetKeyword(const Tizen::Base::String& keyword);
 
@@ -371,7 +360,6 @@ public:
         * @param[in]   author                                  The new author
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 45 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetAuthor(const Tizen::Base::String& author);
 
@@ -393,7 +381,6 @@ public:
         * @param[in]   provider                                        The new content provider
         * @exception   E_SUCCESS           The method is successful.
         * @exception   E_INVALID_ARG           The length of the input data exceeds the maximum limit of 45 characters.
-        * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
         */
        result SetProvider(const Tizen::Base::String& provider);
 
@@ -416,6 +403,7 @@ public:
        Tizen::Base::String GetMediaFormat(void) const;
 
 protected:
+
        //
        // This class is for internal use only.
        // Using this class can cause behavioral, security-related, and consistency-related issues in the application.
@@ -488,6 +476,7 @@ protected:
        result SetContentData(const _ContentData* pContentData);
 
 private:
+
        /**
         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
         */
@@ -498,23 +487,14 @@ private:
         */
        ContentInfo& operator =(const ContentInfo& rhs);
 
-       _ContentData* GetContentData(void);
-
 private:
-       _ContentData* __pContentData;
-       mutable Tizen::Locations::Coordinates coordinates;
-
-       friend class _ContentManagerImpl;
-       friend class _ContentSearchImpl;
-       friend class _ContentDirectoryImpl;
-       friend class _ContentUtility;
-       friend class _PlayListManagerImpl;
-       friend class _PlayListImpl;
+       _ContentInfoImpl* __pContentInfoImpl;
+       mutable Tizen::Locations::Coordinates __coordinates;
 
        friend class _ContentInfoImpl;
-       _ContentInfoImpl* __pImpl;
+       friend class _ContentInfoHelper;
 
-};  // class ContentInfo
+};  // ContentInfo
 
 }}  // Tizen::Content
 
index da25691..ff2458c 100644 (file)
@@ -45,6 +45,8 @@ 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.
  *
@@ -152,7 +154,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);
@@ -171,7 +172,6 @@ public:
         *                                                      the specified format is 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_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
@@ -212,7 +212,6 @@ public:
         * @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.
@@ -256,7 +255,6 @@ public:
         * @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.
@@ -297,7 +295,6 @@ public:
         * @exception   E_INVALID_ARG                           The specified input parameter is invalid, or
         *                                          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_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
@@ -317,7 +314,6 @@ public:
         * @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_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
@@ -338,7 +334,6 @@ public:
         *                                          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_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_SERVICE_BUSY                  The database is busy.
@@ -362,7 +357,7 @@ public:
        result AddContentUpdateEventListener(IContentUpdateEventListener& listener);
 
        /**
-        * Removes a listener.
+        * Removes a listener which is registered to receive the database change notification.
         *
         * @since           2.1
         *
@@ -376,7 +371,7 @@ public:
 
 
        /**
-        * Requests to scan a file.
+        * Requests to synchronize a specified file to the database.
         *
         * @since                       2.1
         * @privlevel           public
@@ -393,7 +388,7 @@ public:
        static result ScanFile(const Tizen::Base::String& contentPath);
 
        /**
-        * Requests to scan a directory.
+        * Requests to synchronize files in the specified directory to the database.
         *
         * @since                       2.1
         * @privlevel           public
@@ -427,9 +422,9 @@ private:
 
 private:
        friend class _ContentManagerImpl;
-       _ContentManagerImpl* __pImpl;
+       _ContentManagerImpl* __pContentManagerImpl;
 
-};  // Class ContentManager
+};  // ContentManager
 
 }}  // Tizen::Content
 
index 00930d7..1dfbbfc 100644 (file)
@@ -59,22 +59,24 @@ public:
         *                                                                                      The following exceptions are given through this parameter.
         * @exception                   E_SUCCESS                       The method is successful.
         * @exception                   E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @remarks                     This listener method doesn't be called when the scan for a directory is completed.
         */
        virtual void OnContentFileCreated(ContentId contentId, ContentType contentType, result r) = 0;
 
-    /**
-    * Called when the content is updated.
-    *
-    * @since                           2.1
-    *
-    * @param[in]                       contentId                       The content ID
-    * @param[in]                       contentType             The content type
-    * @param[in]                       r                                       An error code @n
-    *                                                                                  The following exceptions are given through this parameter.
-    * @exception                       E_SUCCESS                       The method is successful.
-    * @exception                       E_SYSTEM                        The method cannot proceed due to a severe system error.
-    */
-    virtual void OnContentFileUpdated(ContentId contentId, ContentType contentType, result r) = 0;
+       /**
+        * Called when the content is updated.
+        *
+        * @since                               2.1
+        *
+        * @param[in]                   contentId                       The content ID
+        * @param[in]                   contentType             The content type
+        * @param[in]                   r                                       An error code @n
+        *                                                                                      The following exceptions are given through this parameter.
+        * @exception                   E_SUCCESS                       The method is successful.
+        * @exception                   E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @remarks                     This listener method doesn't be called when the scan for a directory is completed.
+        */
+       virtual void OnContentFileUpdated(ContentId contentId, ContentType contentType, result r) = 0;
 
        /**
         * Called when the content is deleted.
@@ -87,6 +89,7 @@ public:
         *                                                                                      The following exceptions are given through this parameter.
         * @exception                   E_SUCCESS                       The method is successful.
         * @exception                   E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @remarks                     This listener method doesn't be called when the scan for a directory is completed.
         */
        virtual void OnContentFileDeleted(ContentId contentId, ContentType contentType, result r) = 0;
 
@@ -154,7 +157,7 @@ protected:
        //
        virtual void IContentUpdateEventListener_Reserved5(void) {}
 
-};  // class IContentUpdateEventListener
+};  // IContentUpdateEventListener
 
 }} // Tizen::Content
 
index a32c6e4..074078e 100644 (file)
@@ -29,6 +29,7 @@ namespace Tizen { namespace Content
 {
 
 class _ImageContentInfoImpl;
+class _ImageContentData;
 
 /**
  * @class      ImageContentInfo
@@ -207,20 +208,6 @@ public:
        ImageOrientationType GetOrientation(void) const;
 
 private:
-       class _ImageContentData
-       {
-       public:
-               _ImageContentData()
-                       : width(0)
-                       , height(0)
-                       , orientationType(IMAGE_ORIENTATION_TYPE_UNKNOWN)
-                       , title(L"") {}
-
-               int width;
-               int height;
-               ImageOrientationType orientationType;
-               Tizen::Base::String title;
-       };
 
        /**
         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
@@ -232,24 +219,13 @@ private:
         */
        ImageContentInfo& operator =(const ImageContentInfo& rhs);
 
-       result SetImageContentData(const _ImageContentData* pImageContentData);
-
-       _ImageContentData* GetImageContentData(void);
-
 private:
-       _ImageContentData* __pImageContentData;
-
-       friend class _ContentManagerImpl;
-       friend class _ContentSearchImpl;
-       friend class _ContentDirectoryImpl;
-       friend class _ContentUtility;
-       friend class _PlayListManagerImpl;
-       friend class _PlayListImpl;
 
+       _ImageContentData* __pImageContentData;
+       _ImageContentInfoImpl* __pImageContentInfoImpl;
        friend class _ImageContentInfoImpl;
-       _ImageContentInfoImpl* __pImpl;
 
-};  // Class ImageContentInfo
+};  // ImageContentInfo
 
 }}  // Tizen::Content
 
index 777c654..a4df345 100644 (file)
@@ -185,9 +185,9 @@ private:
        bool __isCreated;
 
        friend class _OtherContentInfoImpl;
-       _OtherContentInfoImpl* __pImpl;
+       _OtherContentInfoImpl* __pOtherContentInfoImpl;
 
-};  // class OtherContentInfo
+};  // OtherContentInfo
 
 }}  // Tizen::Content
 
index 52e52dd..64e0d23 100644 (file)
@@ -29,6 +29,7 @@ namespace Tizen { namespace Content
 {
 
 class _VideoContentInfoImpl;
+class _VideoContentData;
 
 /**
  * @class      VideoContentInfo
@@ -280,32 +281,6 @@ public:
        long GetDuration(void) const;
 
 private:
-       class _VideoContentData
-       {
-       public:
-               _VideoContentData()
-                       : width(0)
-                       , height(0)
-                       , framerate(0)
-                       , audioBitrate(0)
-                       , videoBitrate(0)
-                       , duration(0)
-                       , pArtist(null)
-                       , pGenre(null)
-                       , pTitle(null)
-                       , pAlbumName(null) {}
-
-               int width;
-               int height;
-               int framerate;
-               int audioBitrate;
-               int videoBitrate;
-               long duration;
-               Tizen::Base::String* pArtist;
-               Tizen::Base::String* pGenre;
-               Tizen::Base::String* pTitle;
-               Tizen::Base::String* pAlbumName;
-       };
 
        /**
         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
@@ -317,26 +292,11 @@ private:
         */
        VideoContentInfo& operator =(const VideoContentInfo& rhs);
 
-       result SetVideoContentData(const _VideoContentData* pVideoContentData);
-
-       _VideoContentData* GetVideoContentData(void);
-
-       result GetVideoMetadata(void) const;
-
-private:
        _VideoContentData* __pVideoContentData;
-
-       friend class _ContentManagerImpl;
-       friend class _ContentSearchImpl;
-       friend class _ContentDirectoryImpl;
-       friend class _ContentUtility;
-       friend class _PlayListManagerImpl;
-       friend class _PlayListImpl;
-
+       _VideoContentInfoImpl* __pVideoContentInfoImpl;
        friend class _VideoContentInfoImpl;
-       _VideoContentInfoImpl* __pImpl;
 
-};  // Class VideoContentInfo
+};  // VideoContentInfo
 
 }}  // Tizen::Content
 
index 1176c54..da9483c 100644 (file)
 
 #include <FBaseSysLog.h>
 #include <FCntAudioContentInfo.h>
-#include <FIoFile.h>
-#include <FIoDirectory.h>
-#include <FSysEnvironment.h>
-#include <FIo_FileImpl.h>
-#include <FApp_AppInfo.h>
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
 
 using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Locations;
-using namespace Tizen::App;
-using namespace Tizen::System;
-using namespace std;
 
 namespace Tizen { namespace Content
 {
 
 AudioContentInfo::AudioContentInfo(void)
-       : ContentInfo()
-       , __pAudioContentData(null)
-       , __pImpl(null)
+       : __pAudioContentData(null)
+       , __pAudioContentInfoImpl(null)
 {
 
 }
 
 AudioContentInfo::~AudioContentInfo(void)
 {
-       if (__pAudioContentData != null)
-       {
-               if (__pAudioContentData->pTitle != null)
-               {
-                       delete __pAudioContentData->pTitle;
-                       __pAudioContentData->pTitle = null;
-               }
-               if (__pAudioContentData->pAlbumName != null)
-               {
-                       delete __pAudioContentData->pAlbumName;
-                       __pAudioContentData->pAlbumName = null;
-               }
-               if (__pAudioContentData->pArtist != null)
-               {
-                       delete __pAudioContentData->pArtist;
-                       __pAudioContentData->pArtist = null;
-               }
-               if (__pAudioContentData->pComposer != null)
-               {
-                       delete __pAudioContentData->pComposer;
-                       __pAudioContentData->pComposer = null;
-               }
-               if (__pAudioContentData->pGenre != null)
-               {
-                       delete __pAudioContentData->pGenre;
-                       __pAudioContentData->pGenre = null;
-               }
-               if (__pAudioContentData->pCopyright != null)
-               {
-                       delete __pAudioContentData->pCopyright;
-                       __pAudioContentData->pCopyright = null;
-               }
-               if (__pAudioContentData->pTrackInfo != null)
-               {
-                       delete __pAudioContentData->pTrackInfo;
-                       __pAudioContentData->pTrackInfo = null;
-               }
-
-               delete __pAudioContentData;
-               __pAudioContentData = null;
-       }
+       delete __pAudioContentInfoImpl;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
- */
 result
 AudioContentInfo::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
 {
-       ClearLastResult();
-
-       SysAssertf(__pAudioContentData == null,
-                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
-
        result r = E_SUCCESS;
-       _ContentData contentData;
-       int contentLength = 0;
-       FileAttributes attribute;
-
-       // checks parameters
-       contentLength = contentPath.GetLength();
-       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
-                       "The contentPath should start with /Media or /Storagecard/Media.");
-       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
-                       "The file corresponding to contentPath could not be found.");
 
-       if (!thumbnailPath.IsEmpty())
-       {
-               SysLog(NID_CNT,
-                               "The thumbnailPath is not supported but you can get the thumbnail managed by Tizen from ContentInfo::GetThumbnailN().");
-       }
+       SysAssertf(__pAudioContentInfoImpl == null,
+                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
-       if (setGps)
-       {
-               SysLog(NID_CNT, "The setGps is not supported.");
-       }
+       _AudioContentInfoImpl* pAudioContentInfoImpl = new (std::nothrow) _AudioContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
 
-       // Sets the content path
-       contentData.contentPath = contentPath;
+       r = pAudioContentInfoImpl->Construct(contentPath, thumbnailPath, setGps);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       // Sets the content type
-       contentData.contentType = CONTENT_TYPE_AUDIO;
+       _ContentInfoHelper::SetContentInfoImpl(this, pAudioContentInfoImpl);
 
-       // E_INVALID_ARG, E_OUT_OF_MEMORY
-       r = SetContentData(&contentData);
-       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
+       __pAudioContentInfoImpl = pAudioContentInfoImpl;
 
-       _AudioContentData* pAudioContentData = new (nothrow) _AudioContentData();
-       SysTryReturnResult(NID_CNT, pAudioContentData != null, E_OUT_OF_MEMORY, "Construct() failed.");
+       return r;
 
-       __pAudioContentData = pAudioContentData;
+CATCH:
+       delete pAudioContentInfoImpl;
 
        return r;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
- * - E_SYSTEM
- */
 result
 AudioContentInfo::Construct(const String* pContentPath)
 {
-       ClearLastResult();
+       result r = E_SUCCESS;
 
-       SysAssertf(__pAudioContentData == null,
+       SysAssertf(__pAudioContentInfoImpl == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
-       result r = E_SUCCESS;
-       _ContentData contentData;
-
-       if (pContentPath != null)
-       {
-               if (!_AppInfo::IsOspCompat())
-               {
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0) || pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] /Media/ and /Storagecard/Media/ are not supported from Tizen 2.0.");
-                               return E_INVALID_ARG;
-                       }
-                       if (!(pContentPath->StartsWith(Environment::GetMediaPath(), 0)
-                               || pContentPath->StartsWith(Environment::GetExternalStoragePath(), 0)))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] %ls is not supported.", pContentPath->GetPointer());
-                               return E_INVALID_ARG;
-                       }
-               }
-               else
-               {
-                       // prior to 2.0
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0))
-                       {
-                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
-                               // it should be converted in 2.0.
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else if (pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
-                               return E_INVALID_ARG;
-                       }
-               }
-
-               int length = pContentPath->GetLength();
-               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
-                               "The length of pContentPath is 0.");
-               SysTryReturnResult(NID_CNT, File::IsFileExist(*pContentPath), E_FILE_NOT_FOUND,
-                               "The file corresponding to pContentPath could not be found.");
-
-               // Sets the content path
-               contentData.contentPath = *pContentPath;
-
-               // Sets the content type
-               contentData.contentType = CONTENT_TYPE_AUDIO;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-       else
-       {
-               contentData.contentType = CONTENT_TYPE_AUDIO;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-
-       _AudioContentData* pAudioContentData = new (nothrow) _AudioContentData();
-       SysTryReturnResult(NID_CNT, pAudioContentData != null, E_OUT_OF_MEMORY, "Construct() failed.");
-
-       __pAudioContentData = pAudioContentData;
+       _AudioContentInfoImpl* pAudioContentInfoImpl = new (std::nothrow) _AudioContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
+
+       r = pAudioContentInfoImpl->Construct(pContentPath);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       _ContentInfoHelper::SetContentInfoImpl(this, pAudioContentInfoImpl);
+
+       __pAudioContentInfoImpl = pAudioContentInfoImpl;
 
        return r;
-}
 
-/**
- * E_SUCCESS
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- */
-result
-AudioContentInfo::SetAudioContentData(const _AudioContentData* pAudioContentData)
-{
-       ClearLastResult();
-
-       SysTryReturnResult(NID_CNT, pAudioContentData != null, E_INVALID_ARG, "pAudioContentData is null.");
-
-       if (__pAudioContentData == null)
-       {
-               __pAudioContentData = new (nothrow) _AudioContentData;
-               SysTryReturnResult(NID_CNT, __pAudioContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-
-       __pAudioContentData->bitrate = pAudioContentData->bitrate;
-       __pAudioContentData->releaseYear = pAudioContentData->releaseYear;
-       __pAudioContentData->duration = pAudioContentData->duration;
-
-       if (pAudioContentData->pTitle != null)
-       {
-               __pAudioContentData->pTitle = new (nothrow) String(*(pAudioContentData->pTitle));
-               SysTryReturnResult(NID_CNT, __pAudioContentData->pTitle != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pAudioContentData->pAlbumName != null)
-       {
-               __pAudioContentData->pAlbumName = new (nothrow) String(*(pAudioContentData->pAlbumName));
-               SysTryReturnResult(NID_CNT, __pAudioContentData->pAlbumName != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pAudioContentData->pArtist != null)
-       {
-               __pAudioContentData->pArtist = new (nothrow) String(*(pAudioContentData->pArtist));
-               SysTryReturnResult(NID_CNT, __pAudioContentData->pArtist != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pAudioContentData->pComposer != null)
-       {
-               __pAudioContentData->pComposer = new (nothrow) String(*(pAudioContentData->pComposer));
-               SysTryReturnResult(NID_CNT, __pAudioContentData->pComposer != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pAudioContentData->pGenre != null)
-       {
-               __pAudioContentData->pGenre = new (nothrow) String(*(pAudioContentData->pGenre));
-               SysTryReturnResult(NID_CNT, __pAudioContentData->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pAudioContentData->pCopyright != null)
-       {
-               __pAudioContentData->pCopyright = new (nothrow) String(*(pAudioContentData->pCopyright));
-               SysTryReturnResult(NID_CNT, __pAudioContentData->pCopyright != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pAudioContentData->pTrackInfo != null)
-       {
-               __pAudioContentData->pTrackInfo = new (nothrow) String(*(pAudioContentData->pTrackInfo));
-               SysTryReturnResult(NID_CNT, __pAudioContentData->pTrackInfo != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-
-       return E_SUCCESS;
-}
+CATCH:
+       delete pAudioContentInfoImpl;
 
-AudioContentInfo::_AudioContentData*
-AudioContentInfo::GetAudioContentData(void)
-{
-       if (__pAudioContentData == null)
-       {
-               __pAudioContentData = new (nothrow) AudioContentInfo::_AudioContentData;
-               SysTryReturn(NID_CNT, __pAudioContentData != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-       }
-       return __pAudioContentData;
+       return r;
 }
 
 String
 AudioContentInfo::GetGenre(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       if (__pAudioContentData->pGenre == null)
-       {
-               SysLog(NID_CNT, "GetGenre() failed.");
-               return String(L"Unknown");
-       }
-
-       return *(__pAudioContentData->pGenre);
+       return __pAudioContentInfoImpl->GetGenre();
 }
 
 String
 AudioContentInfo::GetArtist(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pAudioContentData->pArtist == null)
-       {
-               SysLog(NID_CNT, "GetArtist() failed.");
-               return String(L"Unknown");
-       }
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return *(__pAudioContentData->pArtist);
+       return __pAudioContentInfoImpl->GetArtist();
 }
 
 String
 AudioContentInfo::GetComposer(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       if (__pAudioContentData->pComposer == null)
-       {
-               SysLog(NID_CNT, "GetComposer() failed.");
-               return String(L"Unknown");
-       }
-
-       return *(__pAudioContentData->pComposer);
+       return __pAudioContentInfoImpl->GetComposer();
 }
 
 String
 AudioContentInfo::GetAlbumName(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pAudioContentData->pAlbumName == null)
-       {
-               SysLog(NID_CNT, "GetAlbumName() failed.");
-               return String(L"Unknown");
-       }
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return *(__pAudioContentData->pAlbumName);
+       return __pAudioContentInfoImpl->GetAlbumName();
 }
 
 int
 AudioContentInfo::GetReleaseYear(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pAudioContentData->releaseYear;
+       return __pAudioContentInfoImpl->GetReleaseYear();
 }
 
 int
 AudioContentInfo::GetBitrate(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pAudioContentData->bitrate;
+       return __pAudioContentInfoImpl->GetBitrate();
 }
 
 String
 AudioContentInfo::GetTitle(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       if (__pAudioContentData->pTitle == null)
-       {
-               SysLog(NID_CNT, "GetTitle() failed.");
-               return String(L"Unknown");
-       }
-
-       return *(__pAudioContentData->pTitle);
+       return __pAudioContentInfoImpl->GetTitle();
 }
 
 String
 AudioContentInfo::GetCopyright(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pAudioContentData->pCopyright == null)
-       {
-               SysLog(NID_CNT, "GetCopyright() failed.");
-               return String(L"Unknown");
-       }
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return *(__pAudioContentData->pCopyright);
+       return __pAudioContentInfoImpl->GetCopyright();
 }
 
 String
 AudioContentInfo::GetTrackInfo(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pAudioContentData->pTrackInfo == null)
-       {
-               SysLog(NID_CNT, "GetTrackInfo() failed.");
-               return String(L"Unknown");
-       }
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return *(__pAudioContentData->pTrackInfo);
+       return __pAudioContentInfoImpl->GetTrackInfo();
 }
 
 long
 AudioContentInfo::GetDuration(void) const
 {
-       SysAssertf(__pAudioContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pAudioContentData->duration;
+       return __pAudioContentInfoImpl->GetDuration();
 }
 
 }}
index 4cf33dc..f46a323 100644 (file)
  * This file contains implementation of the %ContentInfo class.
  */
 
+#include <new>
 #include <FBaseSysLog.h>
 #include <FCntContentInfo.h>
-#include <FCntAudioMetadata.h>
-#include <FCntContentManagerUtil.h>
-#include <FIoFile.h>
 #include <FGrpBitmap.h>
-#include <FMediaImage.h>
 #include <FApp_AppInfo.h>
+#include "FCnt_ContentInfoImpl.h"
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_VideoContentInfoImpl.h"
+#include "FCnt_OtherContentInfoImpl.h"
 
+using namespace std;
 using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Locations;
 using namespace Tizen::Graphics;
-using namespace Tizen::Media;
-using namespace Tizen::App;
-using namespace std;
+using namespace Tizen::Locations;
 
 namespace Tizen { namespace Content
 {
 
-static const int THUMBNAIL_IMAGE_WIDTH = 80;
-static const int THUMBNAIL_IMAGE_HEIGHT = 60;
-static const int MAX_CUSTOM_FIELD_COMMON = 45;
-static const int MAX_CUSTOM_FIELD_DESCRIPTION = 140;
-static const double DEFAULT_COORDINATE = -200.0;
+static const int _MAX_CUSTOM_FIELD_COMMON = 45;
+static const int _MAX_CUSTOM_FIELD_DESCRIPTION = 140;
 
 ContentInfo::ContentInfo(void)
-       : Object()
-       , __pContentData(null)
-       , __pImpl(null)
+       : __pContentInfoImpl(null)
 {
 
 }
 
 ContentInfo::~ContentInfo(void)
 {
-       if (__pContentData != null)
-       {
-               if (__pContentData->pThumbnailPath != null)
-               {
-                       delete __pContentData->pThumbnailPath;
-                       __pContentData->pThumbnailPath = null;
-               }
-               if (__pContentData->pAuthor != null)
-               {
-                       delete __pContentData->pAuthor;
-                       __pContentData->pAuthor = null;
-               }
-               if (__pContentData->pCategory != null)
-               {
-                       delete __pContentData->pCategory;
-                       __pContentData->pCategory = null;
-               }
-               if (__pContentData->pContentName)
-               {
-                       delete __pContentData->pContentName;
-                       __pContentData->pContentName = null;
-               }
-               if (__pContentData->pDescription != null)
-               {
-                       delete __pContentData->pDescription;
-                       __pContentData->pDescription = null;
-               }
-               if (__pContentData->pKeyword != null)
-               {
-                       delete __pContentData->pKeyword;
-                       __pContentData->pKeyword = null;
-               }
-               if (__pContentData->pLocationTag != null)
-               {
-                       delete __pContentData->pLocationTag;
-                       __pContentData->pLocationTag = null;
-               }
-               if (__pContentData->pProvider != null)
-               {
-                       delete __pContentData->pProvider;
-                       __pContentData->pProvider = null;
-               }
-               if (__pContentData->pRating != null)
-               {
-                       delete __pContentData->pRating;
-                       __pContentData->pRating = null;
-               }
-
-               delete __pContentData;
-               __pContentData = null;
-       }
-}
-
-result
-ContentInfo::SetContentData(const _ContentData* pContentData)
-{
-       ClearLastResult();
-
-       SysTryReturnResult(NID_CNT, pContentData != null, E_INVALID_ARG, "pContentData is null.");
-
-       if (__pContentData == null)
-       {
-               __pContentData = new (nothrow) _ContentData();
-               SysTryReturnResult(NID_CNT, __pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-
-       __pContentData->contentId = pContentData->contentId;
-       __pContentData->storageType = pContentData->storageType;
-       __pContentData->contentType = pContentData->contentType;
-       __pContentData->contentSize = pContentData->contentSize;
-       __pContentData->contentPath = pContentData->contentPath;
-       __pContentData->dateTime = pContentData->dateTime;
-       __pContentData->latitude = pContentData->latitude;
-       __pContentData->longitude = pContentData->longitude;
-       __pContentData->altitude = pContentData->altitude;
-       __pContentData->isDrm = pContentData->isDrm;
-
-       if (pContentData->pThumbnailPath != null)
-       {
-               __pContentData->pThumbnailPath = new (nothrow) String(*(pContentData->pThumbnailPath));
-               SysTryReturnResult(NID_CNT, __pContentData->pThumbnailPath != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pAuthor != null)
-       {
-               __pContentData->pAuthor = new (nothrow) String(*(pContentData->pAuthor));
-               SysTryReturnResult(NID_CNT, __pContentData->pAuthor != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pCategory != null)
-       {
-               __pContentData->pCategory = new (nothrow) String(*(pContentData->pCategory));
-               SysTryReturnResult(NID_CNT, __pContentData->pCategory != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pContentName != null)
-       {
-               __pContentData->pContentName = new (nothrow) String(*(pContentData->pContentName));
-               SysTryReturnResult(NID_CNT, __pContentData->pContentName != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pDescription != null)
-       {
-               __pContentData->pDescription = new (nothrow) String(*(pContentData->pDescription));
-               SysTryReturnResult(NID_CNT, __pContentData->pDescription != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pKeyword != null)
-       {
-               __pContentData->pKeyword = new (nothrow) String(*(pContentData->pKeyword));
-               SysTryReturnResult(NID_CNT, __pContentData->pKeyword != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pLocationTag != null)
-       {
-               __pContentData->pLocationTag = new (nothrow) String(*(pContentData->pLocationTag));
-               SysTryReturnResult(NID_CNT, __pContentData->pLocationTag != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pProvider != null)
-       {
-               __pContentData->pProvider = new (nothrow) String(*(pContentData->pProvider));
-               SysTryReturnResult(NID_CNT, __pContentData->pProvider != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pContentData->pRating != null)
-       {
-               __pContentData->pRating = new (nothrow) String(*(pContentData->pRating));
-               SysTryReturnResult(NID_CNT, __pContentData->pRating != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-
-       return E_SUCCESS;
-}
 
-ContentInfo::_ContentData*
-ContentInfo::GetContentData(void)
-{
-       if (__pContentData == null)
-       {
-               __pContentData = new (nothrow) ContentInfo::_ContentData;
-               SysTryReturn(NID_CNT, __pContentData != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-       }
-       return __pContentData;
 }
 
 ContentId
 ContentInfo::GetContentId(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->contentId == UuId::GetInvalidUuId())
-       {
-               SysLog(NID_CNT, "GetContentId() failed.");
-               return UuId::GetInvalidUuId();
-       }
-       return __pContentData->contentId;
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetContentId();
 }
 
 ContentType
 ContentInfo::GetContentType(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       return __pContentData->contentType;
+       return __pContentInfoImpl->GetContentType();
 }
 
 DateTime
 ContentInfo::GetDateTime(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       return __pContentData->dateTime;
+       return __pContentInfoImpl->GetDateTime();
 }
 
 String
 ContentInfo::GetMimeType(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       return __pContentData->mimeType;
+       return __pContentInfoImpl->GetMimeType();
 }
 
 unsigned long
 ContentInfo::GetContentSize(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       return __pContentData->contentSize;
+       return __pContentInfoImpl->GetContentSize();
 }
 
 String
 ContentInfo::GetContentName(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pContentName == null)
-       {
-               SysLog(NID_CNT, "GetContentName() failed.");
-               return String();
-       }
-       return *(__pContentData->pContentName);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetContentName();
 }
 
 String
 ContentInfo::GetContentPath(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       return __pContentData->contentPath;
+       return __pContentInfoImpl->GetContentPath();
 }
 
 const Coordinates&
 ContentInfo::GetCoordinates(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       result r = E_SUCCESS;
-
-       if (Double::Compare(__pContentData->latitude, DEFAULT_COORDINATE) == 0 ||
-               Double::Compare(__pContentData->longitude, DEFAULT_COORDINATE) == 0)
-       {
-               SysLog(NID_CNT, "Invalid latitude or longitude");
-               return coordinates;
-       }
-
-       if (Double::Compare(__pContentData->altitude, DEFAULT_COORDINATE) == 0)
-       {
-               r = coordinates.SetLatitude(__pContentData->latitude);
-               if (IsFailed(r))
-               {
-                       SysLog(NID_CNT, "GetCoordinates() failed.");
-                       return coordinates;
-               }
-
-               r = coordinates.SetLongitude(__pContentData->longitude);
-               if (IsFailed(r))
-               {
-                       SysLog(NID_CNT, "GetCoordinates() failed.");
-                       return coordinates;
-               }
-       }
-       else
-       {
-               r = coordinates.Set(__pContentData->latitude, __pContentData->longitude, __pContentData->altitude);
-               if (IsFailed(r))
-               {
-                       SysLog(NID_CNT, "GetCoordinates() failed.");
-                       return coordinates;
-               }
-       }
-
-       return coordinates;
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       __coordinates = __pContentInfoImpl->GetCoordinates();
+
+       return __coordinates;
 }
 
 result
 ContentInfo::SetCoordinates(const Coordinates& coordinates)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       double latitude = coordinates.GetLatitude();
-       double longitude = coordinates.GetLongitude();
-       double altitude = coordinates.GetAltitude();
-
-       if (!Double::IsNaN(latitude))
-       {
-               __pContentData->latitude = latitude;
-       }
-       if (!Double::IsNaN(longitude))
-       {
-               __pContentData->longitude = longitude;
-       }
-       if (!Double::IsNaN(altitude))
-       {
-               __pContentData->altitude = altitude;
-       }
+       __pContentInfoImpl->SetCoordinates(coordinates);
 
        return E_SUCCESS;
 }
@@ -332,23 +132,12 @@ ContentInfo::SetCoordinates(const Coordinates& coordinates)
 result
 ContentInfo::SetLocationTag(const String& locationTag)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       ClearLastResult();
-
-       SysTryReturnResult(NID_CNT, locationTag.GetLength() <= MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, locationTag.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
                        "The max input length is 45 characters.");
 
-       if (__pContentData->pLocationTag != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pLocationTag;
-               __pContentData->pLocationTag = null;
-       }
-
-       __pContentData->pLocationTag = new (nothrow) String(locationTag);
-       SysTryReturnResult(NID_CNT, __pContentData->pLocationTag != null, E_OUT_OF_MEMORY,
-                       "The memory is insufficient.");
+       __pContentInfoImpl->SetLocationTag(locationTag);
 
        return E_SUCCESS;
 }
@@ -356,36 +145,20 @@ ContentInfo::SetLocationTag(const String& locationTag)
 String
 ContentInfo::GetLocationTag(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pLocationTag == null)
-       {
-               SysLog(NID_CNT, "GetLocationTag() failed.");
-               return String();
-       }
-       return *(__pContentData->pLocationTag);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetLocationTag();
 }
 
 result
 ContentInfo::SetRating(const String& rating)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       SysTryReturnResult(NID_CNT, rating.GetLength() <= MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, rating.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
                        "The max input length is 45 characters.");
 
-       if (__pContentData->pRating != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pRating;
-               __pContentData->pRating = null;
-       }
-
-       __pContentData->pRating = new (nothrow) String(rating);
-       SysTryReturnResult(NID_CNT, __pContentData->pRating != null, E_OUT_OF_MEMORY,
-                       "The memory is insufficient.");
+       __pContentInfoImpl->SetRating(rating);
 
        return E_SUCCESS;
 }
@@ -393,36 +166,20 @@ ContentInfo::SetRating(const String& rating)
 String
 ContentInfo::GetRating(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pRating == null)
-       {
-               SysLog(NID_CNT, "GetRating() failed.");
-               return String();
-       }
-       return *(__pContentData->pRating);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetRating();
 }
 
 result
 ContentInfo::SetCategory(const String& category)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       SysTryReturnResult(NID_CNT, category.GetLength() <= MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, category.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
                        "The max input length is 45 characters.");
 
-       if (__pContentData->pCategory != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pCategory;
-               __pContentData->pCategory = null;
-       }
-
-       __pContentData->pCategory = new (nothrow) String(category);
-       SysTryReturnResult(NID_CNT, __pContentData->pCategory != null, E_OUT_OF_MEMORY,
-                       "The memory is insufficient.");
+       __pContentInfoImpl->SetCategory(category);
 
        return E_SUCCESS;
 }
@@ -430,36 +187,20 @@ ContentInfo::SetCategory(const String& category)
 String
 ContentInfo::GetCategory(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pCategory == null)
-       {
-               SysLog(NID_CNT, "GetCategory() failed.");
-               return String();
-       }
-       return *(__pContentData->pCategory);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetCategory();
 }
 
 result
 ContentInfo::SetDescription(const String& description)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       ClearLastResult();
-
-       SysTryReturnResult(NID_CNT, description.GetLength() <= MAX_CUSTOM_FIELD_DESCRIPTION, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, description.GetLength() <= _MAX_CUSTOM_FIELD_DESCRIPTION, E_INVALID_ARG,
                        "The max input length is 140 characters.");
 
-       if (__pContentData->pDescription != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pDescription;
-               __pContentData->pDescription = null;
-       }
-
-       __pContentData->pDescription = new (nothrow) String(description);
-       SysTryReturnResult(NID_CNT, __pContentData->pDescription != null, E_OUT_OF_MEMORY,
-                       "The memory is insufficient.");
+       __pContentInfoImpl->SetDescription(description);
 
        return E_SUCCESS;
 }
@@ -467,66 +208,21 @@ ContentInfo::SetDescription(const String& description)
 String
 ContentInfo::GetDescription(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pDescription == null)
-       {
-               SysLog(NID_CNT, "GetDescription() failed.");
-               return String();
-       }
-       return *(__pContentData->pDescription);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetDescription();
 }
 
 Bitmap*
 ContentInfo::GetThumbnailN(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
        ClearLastResult();
 
-       result r = E_SUCCESS;
-       Image image;
-       Bitmap* pBitmap = null;
-
-       SysTryReturn(NID_CNT, __pContentData->pThumbnailPath != null, null, E_DATA_NOT_FOUND,
-                       "[E_DATA_NOT_FOUND] GetThumbnailN() failed.");
-
-       if (__pContentData->contentType == CONTENT_TYPE_IMAGE || __pContentData->contentType == CONTENT_TYPE_AUDIO
-               || __pContentData->contentType == CONTENT_TYPE_VIDEO)
-       {
-               r = image.Construct();
-               SysTryReturn(NID_CNT, !IsFailed(r), null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetThumbnailN() failed.");
-
-               if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
-               {
-                       pBitmap = image.DecodeN(*(__pContentData->pThumbnailPath), BITMAP_PIXEL_FORMAT_ARGB8888, THUMBNAIL_IMAGE_WIDTH, THUMBNAIL_IMAGE_HEIGHT);
-               }
-               else
-               {
-                       pBitmap = image.DecodeN(*(__pContentData->pThumbnailPath), BITMAP_PIXEL_FORMAT_ARGB8888);
-               }
-
-               if (pBitmap == null)
-               {
-                       r = GetLastResult();
-
-                       if (r == E_OUT_OF_MEMORY)
-                       {
-                               SysLogException(NID_CNT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] GetThumbnailN() failed.");
-                               return null;
-                       }
-                       else
-                       {
-                               SysLogException(NID_CNT, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetThumbnailN() failed.");
-                               return null;
-                       }
-               }
-       }
-       else
-       {
-               SysLogException(NID_CNT, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetThumbnailN() failed.");
-               return null;
-       }
+       Bitmap* pBitmap = __pContentInfoImpl->GetThumbnailN();
+       result r = GetLastResult();
+       SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] GetThumbnailN() failed.", GetErrorMessage(r));
 
        return pBitmap;
 }
@@ -534,44 +230,28 @@ ContentInfo::GetThumbnailN(void) const
 bool
 ContentInfo::IsDrmProtected(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       return __pContentData->isDrm;
+       return __pContentInfoImpl->IsDrmProtected();
 }
 
 String
 ContentInfo::GetKeyword(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pKeyword == null)
-       {
-               SysLog(NID_CNT, "GetKeyword() failed.");
-               return String();
-       }
-       return *(__pContentData->pKeyword);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetKeyword();
 }
 
 result
 ContentInfo::SetContentName(const String& contentName)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       SysTryReturnResult(NID_CNT, contentName.GetLength() <= MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, contentName.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
                        "The max input length is 45 characters.");
 
-       if (__pContentData->pContentName != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pContentName;
-               __pContentData->pContentName = null;
-       }
-
-       __pContentData->pContentName = new (nothrow) String(contentName);
-       SysTryReturnResult(NID_CNT, __pContentData->pContentName != null, E_OUT_OF_MEMORY,
-                       "The memory is insufficient.");
+       __pContentInfoImpl->SetContentName(contentName);
 
        return E_SUCCESS;
 }
@@ -579,23 +259,12 @@ ContentInfo::SetContentName(const String& contentName)
 result
 ContentInfo::SetKeyword(const String& keyword)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       SysTryReturnResult(NID_CNT, keyword.GetLength() <= MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, keyword.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
                        "The max input length is 45 characters.");
 
-       if (__pContentData->pKeyword != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pKeyword;
-               __pContentData->pKeyword = null;
-       }
-
-       __pContentData->pKeyword = new (nothrow) String(keyword);
-       SysTryReturnResult(NID_CNT, __pContentData->pKeyword != null, E_OUT_OF_MEMORY,
-                       "SetKeyword() failed.");
+       __pContentInfoImpl->SetKeyword(keyword);
 
        return E_SUCCESS;
 }
@@ -603,23 +272,12 @@ ContentInfo::SetKeyword(const String& keyword)
 result
 ContentInfo::SetAuthor(const String& author)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       SysTryReturnResult(NID_CNT, author.GetLength() <= MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, author.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
                        "The max input length is 45 characters.");
 
-       if (__pContentData->pAuthor != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pAuthor;
-               __pContentData->pAuthor = null;
-       }
-
-       __pContentData->pAuthor = new (nothrow) String(author);
-       SysTryReturnResult(NID_CNT, __pContentData->pAuthor != null, E_OUT_OF_MEMORY,
-                       "SetAuthor() failed.");
+       __pContentInfoImpl->SetAuthor(author);
 
        return E_SUCCESS;
 }
@@ -627,36 +285,20 @@ ContentInfo::SetAuthor(const String& author)
 String
 ContentInfo::GetAuthor(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pAuthor == null)
-       {
-               SysLog(NID_CNT, "GetAuthor() failed.");
-               return String();
-       }
-       return *(__pContentData->pAuthor);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetAuthor();
 }
 
 result
 ContentInfo::SetProvider(const String& provider)
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       SysTryReturnResult(NID_CNT, provider.GetLength() <= MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
+       SysTryReturnResult(NID_CNT, provider.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
                        "The max input length is 45 characters.");
 
-       if (__pContentData->pProvider != null)
-       {
-               // Deletes previous data
-               delete __pContentData->pProvider;
-               __pContentData->pProvider = null;
-       }
-
-       __pContentData->pProvider = new (nothrow) String(provider);
-       SysTryReturnResult(NID_CNT, __pContentData->pProvider != null, E_OUT_OF_MEMORY,
-                       "SetProvider() failed.");
+       __pContentInfoImpl->SetProvider(provider);
 
        return E_SUCCESS;
 }
@@ -664,22 +306,17 @@ ContentInfo::SetProvider(const String& provider)
 String
 ContentInfo::GetProvider(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pContentData->pProvider == null)
-       {
-               SysLog(NID_CNT, "GetProvider() failed.");
-               return String();
-       }
-       return *(__pContentData->pProvider);
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
+
+       return __pContentInfoImpl->GetProvider();
 }
 
 String
 ContentInfo::GetMediaFormat(void) const
 {
-       SysAssertf(__pContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
 
-       return File::GetFileExtension(__pContentData->contentPath);
+       return __pContentInfoImpl->GetMediaFormat();
 }
 
 }}
index 12864fa..4956e00 100644 (file)
@@ -20,6 +20,7 @@
  * This file contains implementation of the %ContentManager class.
  */
 
+#include <new>
 #include <FBaseSysLog.h>
 #include <FBaseByteBuffer.h>
 #include <FCntContentManager.h>
@@ -27,8 +28,8 @@
 #include <FCntAudioContentInfo.h>
 #include <FCntVideoContentInfo.h>
 #include <FCntOtherContentInfo.h>
-#include <FCnt_ContentManagerImpl.h>
 #include <FSec_AccessController.h>
+#include "FCnt_ContentManagerImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Security;
@@ -37,43 +38,36 @@ namespace Tizen { namespace Content
 {
 
 ContentManager::ContentManager(void)
-       : Object()
-       , __pImpl(null)
+       : __pContentManagerImpl(null)
 {
 
 }
 
 ContentManager::~ContentManager(void)
 {
-       if (__pImpl != null)
-       {
-               delete __pImpl;
-               __pImpl = null;
-       }
+       delete __pContentManagerImpl;
 }
 
 result
 ContentManager::Construct(void)
 {
-       ClearLastResult();
        result r = E_SUCCESS;
 
-       SysAssertf(__pImpl == null,
+       SysAssertf(__pContentManagerImpl == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
        _ContentManagerImpl* pContentManagerImpl = new (std::nothrow) _ContentManagerImpl();
        SysTryReturn(NID_CNT, pContentManagerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
 
        r = pContentManagerImpl->Construct();
-       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%S] Propagating.", GetErrorMessage(r));
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       __pImpl = pContentManagerImpl;
+       __pContentManagerImpl = pContentManagerImpl;
 
        return r;
 
 CATCH:
        delete pContentManagerImpl;
-       pContentManagerImpl = null;
 
        return r;
 }
@@ -89,9 +83,9 @@ ContentManager::CreateContent(const ContentInfo& contentInfo)
        SysTryReturn(NID_CNT, r == E_SUCCESS, UuId::GetInvalidUuId(), E_PRIVILEGE_DENIED,
                        "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       ContentId contentId = __pImpl->CreateContent(contentInfo);
+       ContentId contentId = __pContentManagerImpl->CreateContent(contentInfo);
        r = GetLastResult();
        SysTryReturn(NID_CNT, contentId != UuId::GetInvalidUuId(), UuId::GetInvalidUuId(), r, "[%s] CreateContent failed.", GetErrorMessage(r));
 
@@ -109,9 +103,9 @@ ContentManager::CreateContent(const ByteBuffer& byteBuffer, const String& destin
        SysTryReturn(NID_CNT, r == E_SUCCESS, UuId::GetInvalidUuId(), E_PRIVILEGE_DENIED,
                        "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       ContentId contentId = __pImpl->CreateContent(byteBuffer, destinationPath, pContentInfo);
+       ContentId contentId = __pContentManagerImpl->CreateContent(byteBuffer, destinationPath, pContentInfo);
        r = GetLastResult();
        SysTryReturn(NID_CNT, contentId != UuId::GetInvalidUuId(), UuId::GetInvalidUuId(), r, "[%s] CreateContent failed.", GetErrorMessage(r));
 
@@ -130,9 +124,9 @@ ContentManager::CreateContent(const String& sourcePath, const String& destinatio
        SysTryReturn(NID_CNT, r == E_SUCCESS, UuId::GetInvalidUuId(), E_PRIVILEGE_DENIED,
                        "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       ContentId contentId = __pImpl->CreateContent(sourcePath, destinationPath, deleteSource, pContentInfo);
+       ContentId contentId = __pContentManagerImpl->CreateContent(sourcePath, destinationPath, deleteSource, pContentInfo);
        r = GetLastResult();
        SysTryReturn(NID_CNT, contentId != UuId::GetInvalidUuId(), UuId::GetInvalidUuId(), r, "[%s] CreateContent failed.", GetErrorMessage(r));
 
@@ -157,56 +151,13 @@ ContentManager::GetContentInfoN(const ContentId& contentId) const
        SysTryReturn(NID_CNT, r == E_SUCCESS, null, E_PRIVILEGE_DENIED,
                        "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       pContentInfo = __pImpl->GetContentInfoN(contentId);
+       pContentInfo = __pContentManagerImpl->GetContentInfoN(contentId);
        r = GetLastResult();
-       SysTryCatch(NID_CNT, pContentInfo != null, , r, "[%s] GetContentInfoN failed.", GetErrorMessage(r));
-
-       contentType = pContentInfo->GetContentType();
-
-       if (contentType == CONTENT_TYPE_IMAGE)
-       {
-               pImageContentInfo = dynamic_cast <ImageContentInfo*>(pContentInfo);
-               SysTryCatch(NID_CNT, pImageContentInfo != null, , E_SYSTEM, "[E_SYSTEM] GetContentInfoN failed.");
-
-               return pImageContentInfo;
-       }
-       else if (contentType == CONTENT_TYPE_AUDIO)
-       {
-               pAudioContentInfo = dynamic_cast <AudioContentInfo*>(pContentInfo);
-               SysTryCatch(NID_CNT, pAudioContentInfo != null, , E_SYSTEM, "[E_SYSTEM] GetContentInfoN failed.");
-
-               return pAudioContentInfo;
-       }
-       else if (contentType == CONTENT_TYPE_VIDEO)
-       {
-               pVideoContentInfo = dynamic_cast <VideoContentInfo*>(pContentInfo);
-               SysTryCatch(NID_CNT, pVideoContentInfo != null, , E_SYSTEM, "[E_SYSTEM] GetContentInfoN failed.");
-
-               return pVideoContentInfo;
-       }
-       else if (contentType == CONTENT_TYPE_OTHER)
-       {
-               pOtherContentInfo = dynamic_cast <OtherContentInfo*>(pContentInfo);
-               SysTryCatch(NID_CNT, pOtherContentInfo != null, , E_SYSTEM, "[E_SYSTEM] GetContentInfoN failed.");
-
-               return pOtherContentInfo;
-       }
-       else
-       {
-               SysLogException(NID_CNT, E_SYSTEM, "[E_SYSTEM] contentType is CONTENT_TYPE_UNKNOWN.");
-               goto CATCH;
-       }
-
-CATCH:
-       if (pContentInfo != null)
-       {
-               delete pContentInfo;
-               pContentInfo = null;
-       }
+       SysTryReturn(NID_CNT, pContentInfo != null, null, r, "[%s] GetContentInfoN failed.", GetErrorMessage(r));
 
-       return null;
+       return pContentInfo;
 }
 
 result
@@ -220,9 +171,9 @@ ContentManager::UpdateContent(const ContentInfo& contentInfo)
        SysTryReturn(NID_CNT, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
                        "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       r = __pImpl->UpdateContent(contentInfo);
+       r = __pContentManagerImpl->UpdateContent(contentInfo);
        SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] UpdateContent failed.", GetErrorMessage(r));
 
        return r;
@@ -239,9 +190,9 @@ ContentManager::DeleteContent(const ContentId& contentId)
        SysTryReturn(NID_CNT, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
                        "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       r = __pImpl->DeleteContent(contentId);
+       r = __pContentManagerImpl->DeleteContent(contentId);
        SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] DeleteContent failed.", GetErrorMessage(r));
 
        return r;
@@ -253,9 +204,9 @@ ContentManager::AddContentUpdateEventListener(IContentUpdateEventListener& liste
        ClearLastResult();
        result r = E_SUCCESS;
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       r = __pImpl->AddContentUpdateEventListener(listener);
+       r = __pContentManagerImpl->AddContentUpdateEventListener(listener);
        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "[%s] AddContentUpdateEventListener failed.", GetErrorMessage(r));
 
        return r;
@@ -267,9 +218,9 @@ ContentManager::RemoveContentUpdateEventListener(IContentUpdateEventListener& li
        ClearLastResult();
        result r = E_SUCCESS;
 
-       SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pContentManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       r = __pImpl->RemoveContentUpdateEventListener(listener);
+       r = __pContentManagerImpl->RemoveContentUpdateEventListener(listener);
        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "[%s] RemoveContentUpdateEventListener failed.", GetErrorMessage(r));
 
        return r;
index a156d26..6eb1164 100644 (file)
@@ -48,7 +48,6 @@ DownloadManager::~DownloadManager(void)
 DownloadManager*
 DownloadManager::GetInstance(void)
 {
-       result r = E_SUCCESS;
        static DownloadManager* pManager = null;
 
        if (pManager == null)
index 4abbe01..489abd6 100644 (file)
 
 #include <FBaseSysLog.h>
 #include <FCntImageContentInfo.h>
-#include <FIoFile.h>
-#include <FIoDirectory.h>
-#include <FSysEnvironment.h>
-#include <FIo_FileImpl.h>
-#include <FApp_AppInfo.h>
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
 
 using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Locations;
-using namespace Tizen::App;
-using namespace Tizen::System;
-using namespace std;
 
 namespace Tizen { namespace Content
 {
 
 ImageContentInfo::ImageContentInfo(void)
-       : ContentInfo()
-       , __pImageContentData(null)
-       , __pImpl(null)
+       : __pImageContentData(null)
+       , __pImageContentInfoImpl(null)
 {
 
 }
 
 ImageContentInfo::~ImageContentInfo(void)
 {
-       if (__pImageContentData != null)
-       {
-               delete __pImageContentData;
-               __pImageContentData = null;
-       }
+       delete __pImageContentInfoImpl;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
- */
 result
 ImageContentInfo::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
 {
-       ClearLastResult();
-
-       SysAssertf(__pImageContentData == null,
-                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
-
        result r = E_SUCCESS;
-       _ContentData contentData;
-       int contentLength = 0;
-       FileAttributes attribute;
-
-       // checks parameters
-       contentLength = contentPath.GetLength();
-       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
-                       "The contentPath should start with /Media or /Storagecard/Media.");
-       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
-                       "The file corresponding to contentPath could not be found.");
 
-       if (!thumbnailPath.IsEmpty())
-       {
-               SysLog(NID_CNT,
-                               "The thumbnailPath is not supported but you can get the thumbnail managed by Tizen from ContentInfo::GetThumbnailN().");
-       }
+       SysAssertf(__pImageContentInfoImpl == null,
+                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
-       if (setGps)
-       {
-               SysLog(NID_CNT, "The setGps is not supported.");
-       }
+       _ImageContentInfoImpl* pImageContentInfoImpl = new (std::nothrow) _ImageContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pImageContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
 
-       // Sets the content path
-       contentData.contentPath = contentPath;
+       r = pImageContentInfoImpl->Construct(contentPath, thumbnailPath, setGps);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       // Sets the content type
-       contentData.contentType = CONTENT_TYPE_IMAGE;
+       _ContentInfoHelper::SetContentInfoImpl(this, pImageContentInfoImpl);
 
-       // E_INVALID_ARG, E_OUT_OF_MEMORY
-       r = SetContentData(&contentData);
-       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
+       __pImageContentInfoImpl = pImageContentInfoImpl;
 
-       _ImageContentData* pImageContentData = new (nothrow) _ImageContentData();
-       SysTryReturnResult(NID_CNT, pImageContentData != null, E_OUT_OF_MEMORY, "Construct() failed.");
+       return r;
 
-       __pImageContentData = pImageContentData;
+CATCH:
+       delete pImageContentInfoImpl;
 
        return r;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
- * - E_SYSTEM
- */
 result
 ImageContentInfo::Construct(const String* pContentPath)
 {
-       ClearLastResult();
+       result r = E_SUCCESS;
 
-       SysAssertf(__pImageContentData == null,
+       SysAssertf(__pImageContentInfoImpl == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
-       result r = E_SUCCESS;
-       _ContentData contentData;
-
-       if (pContentPath != null)
-       {
-               if (!_AppInfo::IsOspCompat())
-               {
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0) || pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] /Media/ and /Storagecard/Media/ are not supported from Tizen 2.0.");
-                               return E_INVALID_ARG;
-                       }
-                       if (!(pContentPath->StartsWith(Environment::GetMediaPath(), 0)
-                               || pContentPath->StartsWith(Environment::GetExternalStoragePath(), 0)))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] %ls is not supported.", pContentPath->GetPointer());
-                               return E_INVALID_ARG;
-                       }
-               }
-               else
-               {
-                       // prior to 2.0
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0))
-                       {
-                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
-                               // it should be converted in 2.0.
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else if (pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
-                               return E_INVALID_ARG;
-                       }
-               }
-
-               int length = pContentPath->GetLength();
-               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
-                               "The length of pContentPath is 0.");
-               SysTryReturnResult(NID_CNT, File::IsFileExist(*pContentPath), E_FILE_NOT_FOUND,
-                               "The file corresponding to pContentPath could not be found.");
-
-               // Sets the content path
-               contentData.contentPath = *pContentPath;
-
-               // Sets the content type
-               contentData.contentType = CONTENT_TYPE_IMAGE;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-       else
-       {
-               contentData.contentType = CONTENT_TYPE_IMAGE;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-
-       _ImageContentData* pImageContentData = new (nothrow) _ImageContentData();
-       SysTryReturnResult(NID_CNT, pImageContentData != null, E_OUT_OF_MEMORY, "Construct() failed.");
-
-       __pImageContentData = pImageContentData;
-
-       return r;
-}
+       _ImageContentInfoImpl* pImageContentInfoImpl = new (std::nothrow) _ImageContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pImageContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
 
-result
-ImageContentInfo::SetImageContentData(const _ImageContentData* pImageContentData)
-{
-       ClearLastResult();
+       r = pImageContentInfoImpl->Construct(pContentPath);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       SysTryReturnResult(NID_CNT, pImageContentData != null, E_INVALID_ARG, "pImageContentData is null.");
+       _ContentInfoHelper::SetContentInfoImpl(this, pImageContentInfoImpl);
 
-       // _ContentManagerImpl::GetContentInfoN makes an instance of this class. at that time it does not call Construct().
-       // Because __pImageContentData is created in Construct(), If there is no codes for allocation, crash will occur.
-       if (__pImageContentData == null)
-       {
-               __pImageContentData = new (nothrow) _ImageContentData;
-               SysTryReturnResult(NID_CNT, __pImageContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
+       __pImageContentInfoImpl = pImageContentInfoImpl;
 
-       __pImageContentData->width = pImageContentData->width;
-       __pImageContentData->height = pImageContentData->height;
-       __pImageContentData->orientationType = pImageContentData->orientationType;
-       __pImageContentData->title = pImageContentData->title;
+       return r;
 
-       return E_SUCCESS;
-}
+CATCH:
+       delete pImageContentInfoImpl;
 
-ImageContentInfo::_ImageContentData*
-ImageContentInfo::GetImageContentData(void)
-{
-       if (__pImageContentData == null)
-       {
-               __pImageContentData = new (nothrow) ImageContentInfo::_ImageContentData;
-               SysTryReturn(NID_CNT, __pImageContentData != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-       }
-       return __pImageContentData;
+       return r;
 }
 
 int
 ImageContentInfo::GetWidth(void) const
 {
-       SysAssertf(__pImageContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pImageContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pImageContentData->width;
+       return __pImageContentInfoImpl->GetWidth();
 }
 
 int
 ImageContentInfo::GetHeight(void) const
 {
-       SysAssertf(__pImageContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pImageContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pImageContentData->height;
+       return __pImageContentInfoImpl->GetHeight();
 }
 
 ImageOrientationType
 ImageContentInfo::GetOrientation(void) const
 {
-       SysAssertf(__pImageContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pImageContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pImageContentData->orientationType;
+       return __pImageContentInfoImpl->GetOrientation();
 }
 
 String
 ImageContentInfo::GetTitle(void) const
 {
-       SysAssertf(__pImageContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if ((__pImageContentData->title).IsEmpty())
-       {
-               return String(L"Unknown");
-       }
+       SysAssertf(__pImageContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pImageContentData->title;
+       return __pImageContentInfoImpl->GetTitle();
 }
 
 }}
index dc4a993..41da4d4 100644 (file)
 
 #include <FBaseSysLog.h>
 #include <FCntOtherContentInfo.h>
-#include <FIoFile.h>
-#include <FIoDirectory.h>
-#include <FSysEnvironment.h>
-#include <FIo_FileImpl.h>
-#include <FApp_AppInfo.h>
+#include "FCnt_OtherContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
 
 using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Locations;
-using namespace Tizen::App;
-using namespace Tizen::System;
 
 namespace Tizen { namespace Content
 {
 
 OtherContentInfo::OtherContentInfo(void)
-       : ContentInfo()
-       , __isCreated(false)
-       , __pImpl(null)
+       : __isCreated(false)
+       , __pOtherContentInfoImpl(null)
 {
 
 }
 
 OtherContentInfo::~OtherContentInfo(void)
 {
-
+       delete __pOtherContentInfoImpl;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
-  */
 result
 OtherContentInfo::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
 {
-       ClearLastResult();
+       result r = E_SUCCESS;
 
-       SysAssertf(!__isCreated, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+       SysAssertf(__pOtherContentInfoImpl == null,
+                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+       _OtherContentInfoImpl* pOtherContentInfoImpl = new (std::nothrow) _OtherContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pOtherContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
+
+       r = pOtherContentInfoImpl->Construct(contentPath, thumbnailPath, setGps);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       _ContentInfoHelper::SetContentInfoImpl(this, pOtherContentInfoImpl);
+
+       __pOtherContentInfoImpl = pOtherContentInfoImpl;
+
+       return r;
+
+CATCH:
+       delete pOtherContentInfoImpl;
 
-       result r = E_SUCCESS;
-       _ContentData contentData;
-       int contentLength = 0;
-       FileAttributes attribute;
-
-       // checks parameters
-       contentLength = contentPath.GetLength();
-       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
-                       "The contentPath should start with /Media or /Storagecard/Media.");
-       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
-                       "The file corresponding to contentPath could not be found.");
-
-       if (thumbnailPath.GetLength() > 0)
-       {
-               SysLog(NID_CNT, "The thumbnailPath is not supported.");
-       }
-
-       if (setGps)
-       {
-               SysLog(NID_CNT, "The setGps is not supported.");
-       }
-
-       // Sets the content path
-       contentData.contentPath = contentPath;
-
-       // Sets the content type
-       contentData.contentType = CONTENT_TYPE_OTHER;
-
-       // E_INVALID_ARG, E_OUT_OF_MEMORY
-       r = SetContentData(&contentData);
-       SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-
-       __isCreated = true;
        return r;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
- * - E_SYSTEM
- */
 result
 OtherContentInfo::Construct(const String* pContentPath)
 {
-       ClearLastResult();
-
        result r = E_SUCCESS;
-       _ContentData contentData;
 
-       SysAssertf(!__isCreated,
+       SysAssertf(__pOtherContentInfoImpl == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
-       if (pContentPath != null)
-       {
-               if (!_AppInfo::IsOspCompat())
-               {
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0) || pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] /Media/ and /Storagecard/Media/ are not supported from Tizen 2.0.");
-                               return E_INVALID_ARG;
-                       }
-                       if (!(pContentPath->StartsWith(Environment::GetMediaPath(), 0)
-                               || pContentPath->StartsWith(Environment::GetExternalStoragePath(), 0)))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] %ls is not supported.", pContentPath->GetPointer());
-                               return E_INVALID_ARG;
-                       }
-               }
-               else
-               {
-                       // prior to 2.0
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0))
-                       {
-                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
-                               // it should be converted in 2.0.
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else if (pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
-                               return E_INVALID_ARG;
-                       }
-               }
-
-               int length = pContentPath->GetLength();
-               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG, "The length of pContentPath is 0.");
-               SysTryReturnResult(NID_CNT, File::IsFileExist(*pContentPath), E_FILE_NOT_FOUND, "The file corresponding to pContentPath could not be found.");
-
-               // Sets the content path
-               contentData.contentPath = *pContentPath;
-
-               // Sets the content type
-               contentData.contentType = CONTENT_TYPE_OTHER;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-       else
-       {
-               contentData.contentType = CONTENT_TYPE_OTHER;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-
-       __isCreated = true;
+       _OtherContentInfoImpl* pOtherContentInfoImpl = new (std::nothrow) _OtherContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pOtherContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
+
+       r = pOtherContentInfoImpl->Construct(pContentPath);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       _ContentInfoHelper::SetContentInfoImpl(this, pOtherContentInfoImpl);
+
+       __pOtherContentInfoImpl = pOtherContentInfoImpl;
+
+       return r;
+
+CATCH:
+       delete pOtherContentInfoImpl;
+
        return r;
 }
 
index 488335d..6d8079b 100644 (file)
 
 #include <FBaseSysLog.h>
 #include <FCntVideoContentInfo.h>
-#include <FCntContentManagerUtil.h>
-#include <FCntVideoMetadata.h>
-#include <FIoFile.h>
-#include <FIoDirectory.h>
-#include <FSysEnvironment.h>
-#include <FIo_FileImpl.h>
-#include <FApp_AppInfo.h>
+#include "FCnt_VideoContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
 
 using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Locations;
-using namespace Tizen::App;
-using namespace Tizen::System;
-using namespace std;
 
 namespace Tizen { namespace Content
 {
 
 VideoContentInfo::VideoContentInfo(void)
-       : ContentInfo()
-       , __pVideoContentData(null)
-       , __pImpl(null)
+       : __pVideoContentData(null)
+       , __pVideoContentInfoImpl(null)
 {
 
 }
 
 VideoContentInfo::~VideoContentInfo(void)
 {
-       if (__pVideoContentData != null)
-       {
-               if (__pVideoContentData->pArtist != null)
-               {
-                       delete __pVideoContentData->pArtist;
-                       __pVideoContentData->pArtist = null;
-               }
-               if (__pVideoContentData->pGenre != null)
-               {
-                       delete __pVideoContentData->pGenre;
-                       __pVideoContentData->pGenre = null;
-               }
-               if (__pVideoContentData->pTitle != null)
-               {
-                       delete __pVideoContentData->pTitle;
-                       __pVideoContentData->pTitle = null;
-               }
-               if (__pVideoContentData->pAlbumName != null)
-               {
-                       delete __pVideoContentData->pAlbumName;
-                       __pVideoContentData->pAlbumName = null;
-               }
-               delete __pVideoContentData;
-               __pVideoContentData = null;
-       }
+       delete __pVideoContentInfoImpl;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
- */
+
 result
 VideoContentInfo::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
 {
-       SysAssertf(__pVideoContentData == null,
+       SysAssertf(__pVideoContentInfoImpl == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
-       ClearLastResult();
-
        result r = E_SUCCESS;
-       _ContentData contentData;
-       int contentLength = 0;
-       FileAttributes attribute;
-
-       // checks parameters
-       contentLength = contentPath.GetLength();
-       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
-                       "The contentPath should start with /Media or /Storagecard/Media.");
-       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
-                       "The file corresponding to contentPath could not be found.");
 
-       if (!thumbnailPath.IsEmpty())
-       {
-               SysLog(NID_CNT,
-                               "The thumbnailPath is not supported but you can get the thumbnail managed by Tizen from ContentInfo::GetThumbnailN().");
-       }
+       _VideoContentInfoImpl* pVideoContentInfoImpl = new (std::nothrow) _VideoContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
 
-       if (setGps)
-       {
-               SysLog(NID_CNT, "The setGps is not supported.");
-       }
+       r = pVideoContentInfoImpl->Construct(contentPath, thumbnailPath, setGps);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       // Sets the content path
-       contentData.contentPath = contentPath;
+       _ContentInfoHelper::SetContentInfoImpl(this, pVideoContentInfoImpl);
 
-       // Sets the content type
-       contentData.contentType = CONTENT_TYPE_VIDEO;
+       __pVideoContentInfoImpl = pVideoContentInfoImpl;
 
-       // E_INVALID_ARG, E_OUT_OF_MEMORY
-       r = SetContentData(&contentData);
-       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-
-       _VideoContentData* pVideoContentData = new (nothrow) _VideoContentData();
-       SysTryReturnResult(NID_CNT, pVideoContentData != null, E_OUT_OF_MEMORY, "Construct() failed.");
+       return r;
 
-       __pVideoContentData = pVideoContentData;
+CATCH:
+       delete pVideoContentInfoImpl;
 
        return r;
 }
 
-/**
- * E_SUCCESS
- * E_FILE_NOT_FOUND
- * E_INVALID_ARG
- * E_OUT_OF_MEMORY
- * - E_IO
- * - E_SYSTEM
- */
 result
 VideoContentInfo::Construct(const String* pContentPath)
 {
-       SysAssertf(__pVideoContentData == null,
+       SysAssertf(__pVideoContentInfoImpl == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
-       ClearLastResult();
-
        result r = E_SUCCESS;
-       _ContentData contentData;
-
-       if (pContentPath != null)
-       {
-               if (!_AppInfo::IsOspCompat())
-               {
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0) || pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] /Media/ and /Storagecard/Media/ are not supported from Tizen 2.0.");
-                               return E_INVALID_ARG;
-                       }
-                       if (!(pContentPath->StartsWith(Environment::GetMediaPath(), 0)
-                               || pContentPath->StartsWith(Environment::GetExternalStoragePath(), 0)))
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] %ls is not supported.", pContentPath->GetPointer());
-                               return E_INVALID_ARG;
-                       }
-               }
-               else
-               {
-                       // prior to 2.0
-                       if (pContentPath->StartsWith(OSP_MEDIA_PHONE, 0))
-                       {
-                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
-                               // it should be converted in 2.0.
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else if (pContentPath->StartsWith(OSP_MEDIA_MMC, 0))
-                       {
-                               r = (const_cast<String*>(pContentPath))->Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
-                       }
-                       else
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
-                               return E_INVALID_ARG;
-                       }
-               }
-
-               int length = pContentPath->GetLength();
-               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
-                               "The length of pContentPath is 0.");
-               SysTryReturnResult(NID_CNT, File::IsFileExist(*pContentPath), E_FILE_NOT_FOUND,
-                                 "The file corresponding to pContentPath could not be found.");
-
-               // Sets the content path
-               contentData.contentPath = *pContentPath;
-
-               // Sets the content type
-               contentData.contentType = CONTENT_TYPE_VIDEO;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-       else
-       {
-               contentData.contentType = CONTENT_TYPE_VIDEO;
-
-               r = SetContentData(&contentData);
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Construct() failed.");
-       }
-
-
-       _VideoContentData* pVideoContentData = new (nothrow) _VideoContentData();
-       SysTryReturnResult(NID_CNT, pVideoContentData != null, E_OUT_OF_MEMORY, "Construct() failed.");
-
-       __pVideoContentData = pVideoContentData;
+
+       _VideoContentInfoImpl* pVideoContentInfoImpl = new (std::nothrow) _VideoContentInfoImpl();
+       SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
+
+       r = pVideoContentInfoImpl->Construct(pContentPath);
+       SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       _ContentInfoHelper::SetContentInfoImpl(this, pVideoContentInfoImpl);
+
+       __pVideoContentInfoImpl = pVideoContentInfoImpl;
 
        return r;
-}
 
-result
-VideoContentInfo::SetVideoContentData(const _VideoContentData* pVideoContentData)
-{
-       ClearLastResult();
-
-       SysTryReturnResult(NID_CNT, pVideoContentData != null, E_INVALID_ARG, "pVideoContentData is null.");
-
-       if (__pVideoContentData == null)
-       {
-               __pVideoContentData = new (nothrow) _VideoContentData;
-               SysTryReturnResult(NID_CNT, __pVideoContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-
-       __pVideoContentData->width = pVideoContentData->width;
-       __pVideoContentData->height = pVideoContentData->height;
-       __pVideoContentData->framerate = pVideoContentData->framerate;
-       __pVideoContentData->audioBitrate = pVideoContentData->audioBitrate;
-       __pVideoContentData->videoBitrate = pVideoContentData->videoBitrate;
-       __pVideoContentData->duration = pVideoContentData->duration;
-
-       if (pVideoContentData->pArtist != null)
-       {
-               __pVideoContentData->pArtist = new (nothrow) String(*(pVideoContentData->pArtist));
-               SysTryReturnResult(NID_CNT, __pVideoContentData->pArtist != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pVideoContentData->pGenre != null)
-       {
-               __pVideoContentData->pGenre = new (nothrow) String(*(pVideoContentData->pGenre));
-               SysTryReturnResult(NID_CNT, __pVideoContentData->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pVideoContentData->pTitle != null)
-       {
-               __pVideoContentData->pTitle = new (nothrow) String(*(pVideoContentData->pTitle));
-               SysTryReturnResult(NID_CNT, __pVideoContentData->pTitle != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-       if (pVideoContentData->pAlbumName != null)
-       {
-               __pVideoContentData->pAlbumName = new (nothrow) String(*(pVideoContentData->pAlbumName));
-               SysTryReturnResult(NID_CNT, __pVideoContentData->pAlbumName != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-       }
-
-       return E_SUCCESS;
-}
+CATCH:
+       delete pVideoContentInfoImpl;
 
-VideoContentInfo::_VideoContentData*
-VideoContentInfo::GetVideoContentData(void)
-{
-       if (__pVideoContentData == null)
-       {
-               __pVideoContentData = new (nothrow) VideoContentInfo::_VideoContentData;
-               SysTryReturn(NID_CNT, __pVideoContentData != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-       }
-       return __pVideoContentData;
+       return r;
 }
 
 String
 VideoContentInfo::GetGenre(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       if (__pVideoContentData->pGenre == null)
-       {
-               SysLog(NID_CNT, "GetGenre() failed.");
-               return String(L"Unknown");
-       }
-
-       return *(__pVideoContentData->pGenre);
+       return __pVideoContentInfoImpl->GetGenre();
 }
 
 String
 VideoContentInfo::GetArtist(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pVideoContentData->pArtist == null)
-       {
-               SysLog(NID_CNT, "GetArtist() failed.");
-               return String(L"Unknown");
-       }
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return *(__pVideoContentData->pArtist);
+       return __pVideoContentInfoImpl->GetArtist();
 }
 
 int
 VideoContentInfo::GetBitrate(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pVideoContentData->audioBitrate == 0)
-       {
-               // The audio bitrate is not managed in video table.
-               if (this->GetVideoMetadata() != E_SUCCESS)
-               {
-                       SysLog(NID_CNT, "GetBitrate() failed.");
-                       return 0;
-               }
-       }
-
-       return __pVideoContentData->audioBitrate;
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return __pVideoContentInfoImpl->GetBitrate();
 }
 
 int
 VideoContentInfo::GetAudioBitrate(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pVideoContentData->audioBitrate == 0)
-       {
-               // The audio bitrate is not managed in video table.
-               if (this->GetVideoMetadata() != E_SUCCESS)
-               {
-                       SysLog(NID_CNT, "GetAudioBitrate() failed.");
-                       return 0;
-               }
-       }
-
-       return __pVideoContentData->audioBitrate;
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return __pVideoContentInfoImpl->GetAudioBitrate();
 }
 
 int
 VideoContentInfo::GetVideoBitrate(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pVideoContentData->videoBitrate == 0)
-       {
-               // The video bitrate is not managed in video table.
-               if (this->GetVideoMetadata() != E_SUCCESS)
-               {
-                       SysLog(NID_CNT, "GetVideoBitrate() failed.");
-                       return 0;
-               }
-       }
-
-       return __pVideoContentData->videoBitrate;
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return __pVideoContentInfoImpl->GetVideoBitrate();
 }
 
 int
 VideoContentInfo::GetFramerate(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pVideoContentData->framerate == 0)
-       {
-               // The framerate is not managed in video table.
-               if (this->GetVideoMetadata() != E_SUCCESS)
-               {
-                       SysLog(NID_CNT, "GetFramerate() failed.");
-                       return 0;
-               }
-       }
-
-       return __pVideoContentData->framerate;
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return __pVideoContentInfoImpl->GetFramerate();
 }
 
 int
 VideoContentInfo::GetWidth(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pVideoContentData->width;
+       return __pVideoContentInfoImpl->GetWidth();
 }
 
 int
 VideoContentInfo::GetHeight(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pVideoContentData->height;
+       return __pVideoContentInfoImpl->GetHeight();
 }
 
 String
 VideoContentInfo::GetTitle(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pVideoContentData->pTitle == null)
-       {
-               SysLog(NID_CNT, "GetTitle() failed.");
-               return String(L"Unknown");
-       }
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return *(__pVideoContentData->pTitle);
+       return __pVideoContentInfoImpl->GetTitle();
 }
 
 String
 VideoContentInfo::GetAlbumName(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
-
-       if (__pVideoContentData->pAlbumName == null)
-       {
-               SysLog(NID_CNT, "GetAlbumName() failed.");
-               return String(L"Unknown");
-       }
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return *(__pVideoContentData->pAlbumName);
+       return __pVideoContentInfoImpl->GetAlbumName();
 }
 
 long
 VideoContentInfo::GetDuration(void) const
 {
-       SysAssertf(__pVideoContentData != null, "Not yet constructed. Construct() should be called before use.");
+       SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       return __pVideoContentData->duration;
+       return __pVideoContentInfoImpl->GetDuration();
 }
 
-result
-VideoContentInfo::GetVideoMetadata(void) const
-{
-       ClearLastResult();
-
-       result r = E_SUCCESS;
-
-       VideoMetadata* pVideoMetadata = ContentManagerUtil::GetVideoMetaN(this->GetContentPath());
-       r = GetLastResult();
-       SysTryReturn(NID_CNT, pVideoMetadata != null, r, r, "[%s] GetVideoMetadata() failed.", GetErrorMessage(r));
-
-       // framerate
-       __pVideoContentData->framerate = pVideoMetadata->GetFramerate();
-
-       // audioBitrate
-       __pVideoContentData->audioBitrate = pVideoMetadata->GetAudioBitrate();
-
-       // videoBitrate
-       __pVideoContentData->videoBitrate = pVideoMetadata->GetVideoBitrate();
-
-       delete pVideoMetadata;
-
-       return r;
-}
 }}
diff --git a/src/FCnt_AudioContentInfoImpl.cpp b/src/FCnt_AudioContentInfoImpl.cpp
new file mode 100644 (file)
index 0000000..b41f135
--- /dev/null
@@ -0,0 +1,325 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file               FCnt_AudioContentInfoImpl.cpp
+ * @brief              This is the implementation file for the %_AudioContentInfoImpl class.
+ *
+ * This file contains implementation of the %_AudioContentInfoImpl class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FIoFile.h>
+#include <FIoDirectory.h>
+#include <FSysEnvironment.h>
+#include <FIo_FileImpl.h>
+#include <FApp_AppInfo.h>
+#include "FCnt_AudioContentInfoImpl.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Locations;
+using namespace Tizen::System;
+
+namespace Tizen { namespace Content
+{
+
+_AudioContentInfoImpl::_AudioContentInfoImpl(void)
+       : __bitrate(0)
+       , __releaseYear(0)
+       , __duration(0)
+       , __title(L"")
+       , __albumName(L"")
+       , __artist(L"")
+       , __composer(L"")
+       , __genre(L"")
+       , __copyright(L"")
+       , __trackInfo(L"")
+{
+
+}
+
+_AudioContentInfoImpl::~_AudioContentInfoImpl(void)
+{
+
+}
+
+_AudioContentInfoImpl*
+_AudioContentInfoImpl::GetInstance(AudioContentInfo& audioContentInfo)
+{
+       return audioContentInfo.__pAudioContentInfoImpl;
+}
+
+const _AudioContentInfoImpl*
+_AudioContentInfoImpl::GetInstance(const AudioContentInfo& audioContentInfo)
+{
+       return audioContentInfo.__pAudioContentInfoImpl;
+}
+
+result
+_AudioContentInfoImpl::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
+{
+       result r = E_SUCCESS;
+       int contentLength = 0;
+       FileAttributes attribute;
+
+       // checks parameters
+       contentLength = contentPath.GetLength();
+       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
+                       "The contentPath should start with /Media or /Storagecard/Media.");
+       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                       "The file corresponding to contentPath could not be found.");
+
+       if (!thumbnailPath.IsEmpty())
+       {
+               SysLog(NID_CNT,
+                               "The thumbnailPath is not supported but you can get the thumbnail managed by Tizen from ContentInfo::GetThumbnailN().");
+       }
+
+       if (setGps)
+       {
+               SysLog(NID_CNT, "The setGps is not supported.");
+       }
+
+       SetContentPath(contentPath);
+       SetContentType(CONTENT_TYPE_AUDIO);
+
+       return r;
+}
+
+result
+_AudioContentInfoImpl::Construct(const String* pContentPath)
+{
+       result r = E_SUCCESS;
+
+       if (pContentPath != null)
+       {
+               String contentPath(*pContentPath);
+
+               if (!_AppInfo::IsOspCompat())
+               {
+                       if (!(contentPath.StartsWith(Environment::GetMediaPath(), 0)
+                               || contentPath.StartsWith(Environment::GetExternalStoragePath(), 0)))
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] The path is not supported.");
+                               return E_INVALID_ARG;
+                       }
+               }
+               else
+               {
+                       // prior to 2.0
+                       if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
+                       {
+                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
+                               // it should be converted in 2.0.
+                               r = contentPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
+                       {
+                               r = contentPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG,
+                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
+                               return E_INVALID_ARG;
+                       }
+               }
+
+               int length = contentPath.GetLength();
+               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
+                               "The length of pContentPath is 0.");
+               SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                               "The file corresponding to pContentPath could not be found.");
+
+               SetContentPath(contentPath);
+               SetContentType(CONTENT_TYPE_AUDIO);
+       }
+       else
+       {
+               SetContentType(CONTENT_TYPE_AUDIO);
+       }
+
+       return r;
+}
+
+String
+_AudioContentInfoImpl::GetGenre(void) const
+{
+       if (__genre.IsEmpty())
+       {
+               SysLog(NID_CNT, "Genre is empty.");
+               return String(L"Unknown");
+       }
+
+       return __genre;
+}
+
+String
+_AudioContentInfoImpl::GetArtist(void) const
+{
+       if (__artist.IsEmpty())
+       {
+               SysLog(NID_CNT, "Artist is empty.");
+               return String(L"Unknown");
+       }
+
+       return __artist;
+}
+
+String
+_AudioContentInfoImpl::GetComposer(void) const
+{
+       if (__composer.IsEmpty())
+       {
+               SysLog(NID_CNT, "Composer is empty.");
+               return String(L"Unknown");
+       }
+
+       return __composer;
+}
+
+String
+_AudioContentInfoImpl::GetAlbumName(void) const
+{
+       if (__albumName.IsEmpty())
+       {
+               SysLog(NID_CNT, "AlbumName is empty.");
+               return String(L"Unknown");
+       }
+
+       return __albumName;
+}
+
+int
+_AudioContentInfoImpl::GetReleaseYear(void) const
+{
+       return __releaseYear;
+}
+
+int
+_AudioContentInfoImpl::GetBitrate(void) const
+{
+       return __bitrate;
+}
+
+String
+_AudioContentInfoImpl::GetTitle(void) const
+{
+       if (__title.IsEmpty())
+       {
+               SysLog(NID_CNT, "Title is empty.");
+               return String(L"Unknown");
+       }
+
+       return __title;
+}
+
+String
+_AudioContentInfoImpl::GetCopyright(void) const
+{
+       if (__copyright.IsEmpty())
+       {
+               SysLog(NID_CNT, "Copyright is empty.");
+               return String(L"Unknown");
+       }
+
+       return __copyright;
+}
+
+String
+_AudioContentInfoImpl::GetTrackInfo(void) const
+{
+       if (__trackInfo.IsEmpty())
+       {
+               SysLog(NID_CNT, "TrackInfo is empty.");
+               return String(L"Unknown");
+       }
+
+       return __trackInfo;
+}
+
+long
+_AudioContentInfoImpl::GetDuration(void) const
+{
+       return __duration;
+}
+
+void
+_AudioContentInfoImpl::SetGenre(const Tizen::Base::String& genre)
+{
+       __genre = genre;
+}
+
+void
+_AudioContentInfoImpl::SetArtist(const Tizen::Base::String& artist)
+{
+       __artist = artist;
+}
+
+void
+_AudioContentInfoImpl::SetComposer(const Tizen::Base::String& composer)
+{
+       __composer = composer;
+}
+
+void
+_AudioContentInfoImpl::SetAlbumName(const Tizen::Base::String& albumName)
+{
+       __albumName = albumName;
+}
+
+void
+_AudioContentInfoImpl::SetReleaseYear(int releaseYear)
+{
+       __releaseYear = releaseYear;
+}
+
+void
+_AudioContentInfoImpl::SetBitrate(int bitrate)
+{
+       __bitrate = bitrate;
+}
+
+void
+_AudioContentInfoImpl::SetTitle(const Tizen::Base::String& title)
+{
+       __title = title;
+}
+
+void
+_AudioContentInfoImpl::SetCopyright(const Tizen::Base::String& copyright)
+{
+       __copyright = copyright;
+}
+
+void
+_AudioContentInfoImpl::SetTrackInfo(const Tizen::Base::String& trackInfo)
+{
+       __trackInfo = trackInfo;
+}
+
+void
+_AudioContentInfoImpl::SetDuration(long duration)
+{
+       __duration = duration;
+}
+
+}}
index e52ad21..424d392 100644 (file)
@@ -20,6 +20,7 @@
  * This file contains implementation of the %_ContentDirectoryImpl class.
  */
 
+#include <new>
 #include <FBaseSysLog.h>
 #include <FBaseInteger.h>
 #include <FBaseLongLong.h>
 #include <FCntContentSearchResult.h>
 #include <FSysEnvironment.h>
 #include <FBase_StringConverter.h>
-#include <FCnt_ContentUtility.h>
-#include <FCnt_ContentDirectoryImpl.h>
+#include "FCnt_ContentUtility.h"
+#include "FCnt_ContentDirectoryImpl.h"
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_VideoContentInfoImpl.h"
+#include "FCnt_OtherContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -46,8 +52,7 @@ bool MediaFoldersCb(media_folder_h folder, void* pUserdata);
 bool MediaFolderItemsCb(media_info_h media, void* pUserdata);
 
 _ContentDirectoryImpl::_ContentDirectoryImpl(void)
-       : Object()
-       , __pFilterHandle(null)
+       : __pFilterHandle(null)
        , __pFinalOutList(null)
        , __contentType(CONTENT_TYPE_UNKNOWN)
        , __isMultiContentType(false)
@@ -266,7 +271,7 @@ _ContentDirectoryImpl::GetContentDirectoryCount(void) const
        SysTryReturnResult(NID_CNT, !IsFailed(r), E_SYSTEM, "Propagating for CreateFolderFilter.");
 
        ret = media_folder_get_folder_count_from_db(__pFilterHandle.get(), &directoryCount);
-       r = MapCoreErrorToNativeResult(ret);
+       r = MapCoreErrorToDirectoryCountNativeResult(ret);
        SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "Failed to perform media_folder_get_folder_count_from_db operation.");
 
        SysLog(NID_CNT, "directoryCount is [%d].", directoryCount);
@@ -435,7 +440,7 @@ _ContentDirectoryImpl::GetSlpColumnName(String& inputCol, String sortCol) const
        String          columnName(sortCol);
        result          r = E_SUCCESS;
        int             maxCols = MAX_QUERY_COLUMNS;
-       
+
        if(!__isMultiContentType)
        {
                switch (__contentType)
@@ -638,7 +643,7 @@ _ContentDirectoryImpl::GetContentDirectoryItemListN(const Tizen::Base::String& c
                r = E_INVALID_ARG;
                SysTryReturn(NID_CNT, !(IsFailed(r)), null, r, "[E_INVALID_ARG] (pageNo > 1) and (totalcount = 0).");
        }
-       
+
        SetLastResult(r);
        return __pFinalOutList.release();
 }
@@ -651,16 +656,16 @@ _ContentDirectoryImpl::FillFinalOutList(char* pFolderId) const
        GList* pTempList = NULL;
        std::unique_ptr<media_info_s, MediaHandleDeleter> pMediaHandle;
 
-       ContentInfo::_ContentData*                      pContentData = null;
-       ImageContentInfo::_ImageContentData*            pImageContentData = null;
-       AudioContentInfo::_AudioContentData*            pAudioContentData = null;
-       VideoContentInfo::_VideoContentData*            pVideoContentData = null;
-
        std::unique_ptr<ImageContentInfo> pImageContentInfo;
        std::unique_ptr<AudioContentInfo> pAudioContentInfo;
        std::unique_ptr<VideoContentInfo> pVideoContentInfo;
        std::unique_ptr<OtherContentInfo> pOtherContentInfo;
 
+       _ImageContentInfoImpl* pImageContentInfoImpl = null;
+       _AudioContentInfoImpl* pAudioContentInfoImpl = null;
+       _VideoContentInfoImpl* pVideoContentInfoImpl = null;
+       _OtherContentInfoImpl* pOtherContentInfoImpl = null;
+
        ret = media_folder_foreach_media_from_db(pFolderId, __pFilterHandle.get(), MediaFolderItemsCb, &pTempList);
        r = MapCoreErrorToNativeResult(ret);
        SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform media_folder_foreach_media_from_db operation.");
@@ -680,18 +685,35 @@ _ContentDirectoryImpl::FillFinalOutList(char* pFolderId) const
                r = MapCoreErrorToNativeResult(ret);
                SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_info_get_media_type operation.");
 
+               std::unique_ptr<char, UtilCharDeleter> pMediaPath;
+               char* pTempPath = null;
+
+               ret = media_info_get_file_path(pMediaHandle.get(), &pTempPath);
+               r = MapCoreErrorToNativeResult(ret);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_info_get_file_path operation.");
+
+               pMediaPath.reset(pTempPath);
+               String contentPath(pMediaPath.get());
+
                switch (mediaType)
                {
                case MEDIA_CONTENT_TYPE_OTHERS:
                        pOtherContentInfo = std::unique_ptr<OtherContentInfo>(new (std::nothrow) OtherContentInfo);
                        SysTryReturnResult(NID_CNT, pOtherContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pOtherContentInfo.");
 
-                       pContentData = pOtherContentInfo->GetContentData();
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                       r = pOtherContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to OtherContentInfo.");
+
+                       pOtherContentInfoImpl = null;
+                       pOtherContentInfoImpl = _OtherContentInfoImpl::GetInstance(*(pOtherContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pOtherContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pOtherContentInfoImpl.");
 
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pOtherContentInfoImpl);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
 
+                       _ContentInfoHelper::SetContentInfoImpl(pOtherContentInfo.get(), pOtherContentInfoImpl);
+
                        // Shallow copy, adds just the pointer: not the element
                        r = __pFinalOutList->Add(*(pOtherContentInfo.release()));
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation to pFinalOutList.");
@@ -701,18 +723,22 @@ _ContentDirectoryImpl::FillFinalOutList(char* pFolderId) const
                        pImageContentInfo = std::unique_ptr<ImageContentInfo>(new (std::nothrow) ImageContentInfo);
                        SysTryReturnResult(NID_CNT, pImageContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pImageContentInfo.");
 
-                       pContentData = pImageContentInfo->GetContentData();
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                       r = pImageContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to ImageContentInfo.");
 
-                       pImageContentData = pImageContentInfo->GetImageContentData();
-                       SysTryReturnResult(NID_CNT, pImageContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                       pImageContentInfoImpl = null;
+                       pImageContentInfoImpl = _ImageContentInfoImpl::GetInstance(*(pImageContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pImageContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pImageContentInfoImpl.");
 
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pImageContentInfoImpl);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
 
-                       r = _ContentUtility::FillImageContentData(pMediaHandle.get(), pImageContentData);
+                       r = _ContentUtility::FillImageContentData(pMediaHandle.get(), pImageContentInfoImpl);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform GetDataFromImageTable operation.");
 
+                       _ContentInfoHelper::SetContentInfoImpl(pImageContentInfo.get(), pImageContentInfoImpl);
+
                        // Shallow copy, adds just the pointer: not the element
                        r = __pFinalOutList->Add(*(pImageContentInfo.release()));
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation to __pFinalOutList.");
@@ -724,18 +750,22 @@ _ContentDirectoryImpl::FillFinalOutList(char* pFolderId) const
                        pAudioContentInfo = std::unique_ptr<AudioContentInfo>(new (std::nothrow) AudioContentInfo);
                        SysTryReturnResult(NID_CNT, pAudioContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pAudioContentInfo.");
 
-                       pContentData = pAudioContentInfo->GetContentData();
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                       r = pAudioContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to AudioContentInfo.");
 
-                       pAudioContentData = pAudioContentInfo->GetAudioContentData();
-                       SysTryReturnResult(NID_CNT, pAudioContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                       pAudioContentInfoImpl = null;
+                       pAudioContentInfoImpl = _AudioContentInfoImpl::GetInstance(*(pAudioContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pAudioContentInfoImpl.");
 
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pAudioContentInfoImpl);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
 
-                       r = _ContentUtility::FillAudioContentData(pMediaHandle.get(), pAudioContentData);
+                       r = _ContentUtility::FillAudioContentData(pMediaHandle.get(), pAudioContentInfoImpl);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillAudioContentData operation.");
 
+                       _ContentInfoHelper::SetContentInfoImpl(pAudioContentInfo.get(), pAudioContentInfoImpl);
+
                        // Shallow copy, adds just the pointer: not the element
                        r = __pFinalOutList->Add(*(pAudioContentInfo.release()));
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation to __pFinalOutList.");
@@ -745,18 +775,22 @@ _ContentDirectoryImpl::FillFinalOutList(char* pFolderId) const
                        pVideoContentInfo = std::unique_ptr<VideoContentInfo>(new (std::nothrow) VideoContentInfo);
                        SysTryReturnResult(NID_CNT, pVideoContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pVideoContentInfo.");
 
-                       pContentData = pVideoContentInfo->GetContentData();
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                       r = pVideoContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to VideoContentInfo.");
 
-                       pVideoContentData = pVideoContentInfo->GetVideoContentData();
-                       SysTryReturnResult(NID_CNT, pVideoContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                       pVideoContentInfoImpl = null;
+                       pVideoContentInfoImpl = _VideoContentInfoImpl::GetInstance(*(pVideoContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pVideoContentInfoImpl.");
 
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pVideoContentInfoImpl);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
 
-                       r = _ContentUtility::FillVideoContentData(pMediaHandle.get(), pVideoContentData);
+                       r = _ContentUtility::FillVideoContentData(pMediaHandle.get(), pVideoContentInfoImpl);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillVideoContentData operation.");
 
+                       _ContentInfoHelper::SetContentInfoImpl(pVideoContentInfo.get(), pVideoContentInfoImpl);
+
                        // Shallow copy, adds just the pointer: not the element
                        r = __pFinalOutList->Add(*(pVideoContentInfo.release()));
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation to __pFinalOutList.");
@@ -819,6 +853,45 @@ _ContentDirectoryImpl::MapCoreErrorToNativeResult(int reason) const
                SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_OUT_OF_MEMORY");
                break;
 
+       case MEDIA_CONTENT_ERROR_INVALID_PARAMETER:
+               r = E_INVALID_ARG;
+               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_INVALID_PARAMETER");
+               break;
+
+       default:
+               SysLog(NID_CNT, "default");
+               r = E_SYSTEM;
+               break;
+       }
+       return r;
+}
+
+result
+_ContentDirectoryImpl::MapCoreErrorToDirectoryCountNativeResult(int reason) const
+{
+       result r = E_SUCCESS;
+
+       switch (reason)
+       {
+       case MEDIA_CONTENT_ERROR_NONE:
+               r = E_SUCCESS;
+               break;
+
+       case MEDIA_CONTENT_ERROR_DB_BUSY:
+               r = E_SERVICE_BUSY;
+               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_DB_BUSY");
+               break;
+
+       case MEDIA_CONTENT_ERROR_DB_FAILED:
+               r = E_SYSTEM;
+               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_DB_FAILED");
+               break;
+
+       case MEDIA_CONTENT_ERROR_OUT_OF_MEMORY:
+               r = E_OUT_OF_MEMORY;
+               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_OUT_OF_MEMORY");
+               break;
+
        default:
                SysLog(NID_CNT, "default");
                r = E_SYSTEM;
@@ -827,6 +900,26 @@ _ContentDirectoryImpl::MapCoreErrorToNativeResult(int reason) const
        return r;
 }
 
+result
+_ContentDirectoryImpl::ConvertErrorToResult(result res) const
+{
+       result r = E_SUCCESS;
+
+       switch (res)
+       {
+       case E_FILE_NOT_FOUND:
+               // Fall through
+       case E_IO:
+               r = E_SYSTEM;
+               break;
+
+       default:
+               r = res;
+               break;
+       }
+       return r;
+}
+
 // Callback function registered to each media info details
 // all items are appended to the list
 bool
diff --git a/src/FCnt_ContentInfoHelper.cpp b/src/FCnt_ContentInfoHelper.cpp
new file mode 100644 (file)
index 0000000..6735cae
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCnt_ContentInfoHelper.cpp
+ * @brief              This is the implementation file for the %_ImageContentInfoHelper class.
+ *
+ * This file contains implementation of the %_ImageContentInfoHelper class.
+ */
+
+#include <FBaseSysLog.h>
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_VideoContentInfoImpl.h"
+#include "FCnt_OtherContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
+
+namespace Tizen { namespace Content
+{
+
+void
+_ContentInfoHelper::SetContentInfoImpl(ContentInfo* pContentInfo, _ContentInfoImpl* pContentInfoImpl)
+{
+       pContentInfo->__pContentInfoImpl = pContentInfoImpl;
+}
+
+}}
diff --git a/src/FCnt_ContentInfoHelper.h b/src/FCnt_ContentInfoHelper.h
new file mode 100644 (file)
index 0000000..1e0c57b
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCnt_ContentInfoHelper.h
+ * @brief              This is the header file for the %_ContentInfoHelper class.
+ *
+ * This header file contains the declarations of the %_ContentInfoHelper class.
+ */
+
+#ifndef _FCNT_INTERNAL_CONTENT_INFO_HELPER_H_
+#define _FCNT_INTERNAL_CONTENT_INFO_HELPER_H_
+
+#include <FCntImageContentInfo.h>
+#include <FCntAudioContentInfo.h>
+#include <FCntVideoContentInfo.h>
+#include <FCntOtherContentInfo.h>
+
+namespace Tizen { namespace Content
+{
+
+class _ContentInfoHelper
+{
+public:
+
+       static void SetContentInfoImpl(ContentInfo* pContentInfo, _ContentInfoImpl* pContentInfoImpl);
+
+private:
+       _ContentInfoHelper(void);
+
+       _ContentInfoHelper(const _ContentInfoHelper& rhs);
+
+       virtual ~_ContentInfoHelper(void);
+
+       _ContentInfoHelper& operator =(const _ContentInfoHelper& rhs);
+
+};  // _ContentInfoHelper
+
+}}  // Tizen::Content
+
+#endif  // _FCNT_INTERNAL_CONTENT_INFO_HELPER_H_
diff --git a/src/FCnt_ContentInfoImpl.cpp b/src/FCnt_ContentInfoImpl.cpp
new file mode 100644 (file)
index 0000000..c3874f2
--- /dev/null
@@ -0,0 +1,421 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCnt_ContentInfoImpl.cpp
+ * @brief              This is the implementation file for the %_ContentInfoImpl class.
+ *
+ * This file contains implementation of the %_ContentInfoImpl class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FCntContentInfo.h>
+#include <FCntAudioMetadata.h>
+#include <FCntContentManagerUtil.h>
+#include <FIoFile.h>
+#include <FGrpBitmap.h>
+#include <FMediaImage.h>
+#include <FApp_AppInfo.h>
+#include "FCnt_ContentInfoImpl.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Locations;
+using namespace Tizen::Graphics;
+using namespace Tizen::Media;
+using namespace Tizen::App;
+
+namespace Tizen { namespace Content
+{
+
+static const int _THUMBNAIL_IMAGE_WIDTH = 80;
+static const int _THUMBNAIL_IMAGE_HEIGHT = 60;
+static const double _DEFAULT_COORDINATE = -200.0;
+
+_ContentInfoImpl::_ContentInfoImpl(void)
+       : __contentId(Tizen::Base::UuId::GetInvalidUuId())
+       , __storageType(0)
+       , __contentType(CONTENT_TYPE_UNKNOWN)
+       , __contentSize(0)
+       , __latitude(-200.0)
+       , __longitude(-200.0)
+       , __altitude(-200.0)
+       , __isDrm(false)
+       , __contentPath(L"")
+       , __mimeType(L"")
+       , __thumbnailPath(L"")
+       , __author(L"")
+       , __category(L"")
+       , __contentName(L"")
+       , __description(L"")
+       , __keyword(L"")
+       , __locationTag(L"")
+       , __provider(L"")
+       , __rating(L"")
+       , __mediaFormat(L"")
+{
+
+}
+
+_ContentInfoImpl::~_ContentInfoImpl(void)
+{
+
+}
+
+_ContentInfoImpl*
+_ContentInfoImpl::GetInstance(ContentInfo& contentInfo)
+{
+       return contentInfo.__pContentInfoImpl;
+}
+
+const _ContentInfoImpl*
+_ContentInfoImpl::GetInstance(const ContentInfo& contentInfo)
+{
+       return contentInfo.__pContentInfoImpl;
+}
+
+result
+_ContentInfoImpl::Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath, bool setGps)
+{
+       return E_SUCCESS;
+}
+
+ContentId
+_ContentInfoImpl::GetContentId(void) const
+{
+       return __contentId;
+}
+
+ContentType
+_ContentInfoImpl::GetContentType(void) const
+{
+       return __contentType;
+}
+
+DateTime
+_ContentInfoImpl::GetDateTime(void) const
+{
+       return __dateTime;
+}
+
+String
+_ContentInfoImpl::GetMimeType(void) const
+{
+       return __mimeType;
+}
+
+unsigned long
+_ContentInfoImpl::GetContentSize(void) const
+{
+       return __contentSize;
+}
+
+String
+_ContentInfoImpl::GetContentName(void) const
+{
+       return __contentName;
+}
+
+String
+_ContentInfoImpl::GetContentPath(void) const
+{
+       return __contentPath;
+}
+
+Coordinates
+_ContentInfoImpl::GetCoordinates(void) const
+{
+       return __coordinates;
+}
+
+void
+_ContentInfoImpl::SetCoordinates(const Coordinates& coordinates)
+{
+       double latitude = coordinates.GetLatitude();
+       double longitude = coordinates.GetLongitude();
+       double altitude = coordinates.GetAltitude();
+
+       if (!Double::IsNaN(latitude))
+       {
+               __latitude = latitude;
+       }
+       if (!Double::IsNaN(longitude))
+       {
+               __longitude = longitude;
+       }
+       if (!Double::IsNaN(altitude))
+       {
+               __altitude = altitude;
+       }
+
+       __coordinates = coordinates;
+}
+
+void
+_ContentInfoImpl::SetLocationTag(const String& locationTag)
+{
+       __locationTag = locationTag;
+}
+
+String
+_ContentInfoImpl::GetLocationTag(void) const
+{
+       return __locationTag;
+}
+
+void
+_ContentInfoImpl::SetRating(const String& rating)
+{
+       __rating = rating;
+}
+
+String
+_ContentInfoImpl::GetRating(void) const
+{
+       return __rating;
+}
+
+void
+_ContentInfoImpl::SetCategory(const String& category)
+{
+       __category = category;
+}
+
+String
+_ContentInfoImpl::GetCategory(void) const
+{
+       return __category;
+}
+
+void
+_ContentInfoImpl::SetDescription(const String& description)
+{
+       __description = description;
+}
+
+String
+_ContentInfoImpl::GetDescription(void) const
+{
+       return __description;
+}
+
+Bitmap*
+_ContentInfoImpl::GetThumbnailN(void) const
+{
+       result r = E_SUCCESS;
+       Image image;
+       Bitmap* pBitmap = null;
+
+       SysTryReturn(NID_CNT, !__thumbnailPath.IsEmpty(), null, E_DATA_NOT_FOUND,
+                       "[E_DATA_NOT_FOUND] GetThumbnailN() failed.");
+
+       if (__contentType == CONTENT_TYPE_IMAGE || __contentType == CONTENT_TYPE_AUDIO
+               || __contentType == CONTENT_TYPE_VIDEO)
+       {
+               r = image.Construct();
+               SysTryReturn(NID_CNT, !IsFailed(r), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] GetThumbnailN() failed.");
+
+               if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+               {
+                       pBitmap = image.DecodeN(__thumbnailPath, BITMAP_PIXEL_FORMAT_ARGB8888, _THUMBNAIL_IMAGE_WIDTH, _THUMBNAIL_IMAGE_HEIGHT);
+               }
+               else
+               {
+                       pBitmap = image.DecodeN(__thumbnailPath, BITMAP_PIXEL_FORMAT_ARGB8888);
+               }
+
+               if (pBitmap == null)
+               {
+                       r = GetLastResult();
+
+                       if (r == E_OUT_OF_MEMORY)
+                       {
+                               SysLogException(NID_CNT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] GetThumbnailN() failed.");
+                               return null;
+                       }
+                       else
+                       {
+                               SysLogException(NID_CNT, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetThumbnailN() failed.");
+                               return null;
+                       }
+               }
+       }
+       else
+       {
+               SysLogException(NID_CNT, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetThumbnailN() failed.");
+               return null;
+       }
+
+       return pBitmap;
+}
+
+bool
+_ContentInfoImpl::IsDrmProtected(void) const
+{
+       return __isDrm;
+}
+
+String
+_ContentInfoImpl::GetKeyword(void) const
+{
+       return __keyword;
+}
+
+void
+_ContentInfoImpl::SetContentName(const String& contentName)
+{
+       __contentName = contentName;
+}
+
+void
+_ContentInfoImpl::SetKeyword(const String& keyword)
+{
+       __keyword = keyword;
+}
+
+void
+_ContentInfoImpl::SetAuthor(const String& author)
+{
+       __author = author;
+}
+
+String
+_ContentInfoImpl::GetAuthor(void) const
+{
+       return __author;
+}
+
+void
+_ContentInfoImpl::SetProvider(const String& provider)
+{
+       __provider = provider;
+}
+
+String
+_ContentInfoImpl::GetProvider(void) const
+{
+       return __provider;
+}
+
+String
+_ContentInfoImpl::GetMediaFormat(void) const
+{
+       return File::GetFileExtension(__contentPath);
+}
+
+void
+_ContentInfoImpl::SetContentId(const ContentId& contentId)
+{
+       __contentId = contentId;
+}
+
+void
+_ContentInfoImpl::SetContentType(const ContentType& contentType)
+{
+       __contentType = contentType;
+}
+
+void
+_ContentInfoImpl::SetContentSize(unsigned long contentSize)
+{
+       __contentSize = contentSize;
+}
+
+void
+_ContentInfoImpl::SetMimeType(const Tizen::Base::String& mimeType)
+{
+       __mimeType = mimeType;
+}
+
+void
+_ContentInfoImpl::SetDateTime(const Tizen::Base::DateTime& dateTime)
+{
+       __dateTime = dateTime;
+}
+
+void
+_ContentInfoImpl::SetContentPath(const Tizen::Base::String& contentPath)
+{
+       __contentPath = contentPath;
+}
+
+void
+_ContentInfoImpl::SetMediaFormat(const Tizen::Base::String& mediaFormat)
+{
+       __mediaFormat = mediaFormat;
+}
+
+void
+_ContentInfoImpl::SetDrmProtected(bool isDrm)
+{
+       __isDrm = isDrm;
+}
+
+double
+_ContentInfoImpl::GetLatitude(void) const
+{
+       return __latitude;
+}
+
+double
+_ContentInfoImpl::GetLongitude(void) const
+{
+       return __longitude;
+}
+
+double
+_ContentInfoImpl::GetAltitude(void) const
+{
+       return __altitude;
+}
+
+void
+_ContentInfoImpl::SetLatitude(double latitude)
+{
+       __latitude = latitude;
+}
+
+void
+_ContentInfoImpl::SetLongitude(double longitude)
+{
+       __longitude = longitude;
+}
+
+void
+_ContentInfoImpl::SetAltitude(double altitude)
+{
+       __altitude = altitude;
+}
+
+Tizen::Base::String
+_ContentInfoImpl::GetThumbnailPath(void) const
+{
+       return __thumbnailPath;
+}
+
+void
+_ContentInfoImpl::SetThumbnailPath(const Tizen::Base::String& thumbnailPath)
+{
+       __thumbnailPath = thumbnailPath;
+}
+
+void
+_ContentInfoImpl::SetStorageType(int storageType)
+{
+       __storageType = storageType;
+}
+
+}}
index 2608307..2a77bd0 100644 (file)
  * This file contains implementation of the %_ContentManagerImpl class.
  */
 
+#include <new>
 #include <stdlib.h>
 #include <aul/aul.h>
-#include <FBaseSysLog.h>
 #include <FAppApp.h>
+#include <FBaseSysLog.h>
 #include <FBaseInteger.h>
 #include <FBaseByteBuffer.h>
 #include <FCntContentManager.h>
+#include <FCntContentManagerUtil.h>
 #include <FCntImageContentInfo.h>
 #include <FCntAudioContentInfo.h>
 #include <FCntVideoContentInfo.h>
 #include <FCntIContentUpdateEventListener.h>
 #include <FIoDirectory.h>
 #include <FSysEnvironment.h>
-#include <FCnt_ContentManagerImpl.h>
-#include <FCnt_ContentManagerUtilImpl.h>
+#include <FApp_AppInfo.h>
 #include <FBase_StringConverter.h>
 #include <FIo_FileImpl.h>
-#include <FApp_AppInfo.h>
+#include "FCnt_ContentManagerImpl.h"
+#include "FCnt_ContentManagerUtilImpl.h"
+#include "FCnt_ContentInfoImpl.h"
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_VideoContentInfoImpl.h"
+#include "FCnt_OtherContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
 
+using namespace std;
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Io;
-using namespace Tizen::App;
+using namespace Tizen::Locations;
 using namespace Tizen::System;
-using namespace std;
 
 namespace Tizen { namespace Content
 {
 
-static RequestId requestId = 0;
-
 static const int SYSTEM_TYPE_IMAGE = 0;
 static const int SYSTEM_TYPE_VIDEO = 1;
 static const int SYSTEM_TYPE_SOUND = 2;
@@ -114,11 +121,11 @@ OnScanCompleted(media_content_error_e error, void* user_data)
        String scanPath(L"");
        IContentScanListener* pListener = null;
        RequestId reqId;
-       unique_ptr< ScanResult > pScanResult;
+       unique_ptr< _ScanResult > pScanResult;
 
        SysTryLogCatch(NID_CNT, user_data != null, , "OnScanCompleted failed.");
 
-       pScanResult = unique_ptr< ScanResult >(static_cast< ScanResult* >(user_data));
+       pScanResult = unique_ptr< _ScanResult >(static_cast< _ScanResult* >(user_data));
 
        SysTryLogCatch(NID_CNT, pScanResult != null, , "OnScanCompleted failed.");
        SysTryLogCatch(NID_CNT, pScanResult->pScanListener != null, , "Listener is null. OnScanCompleted succeeded.");
@@ -234,8 +241,7 @@ OnContentUpdateCompleted(media_content_error_e error, int pid, media_content_db_
 }
 
 _ContentManagerImpl::_ContentManagerImpl(void)
-       : Object()
-       , __isConnected(false)
+       : __isConnected(false)
        , __pListener(null)
 {
 
@@ -249,41 +255,27 @@ _ContentManagerImpl::~_ContentManagerImpl(void)
        {
                val = media_content_unset_db_updated_cb();
                SysLog(NID_CNT, "media_content_unset_db_updated_cb result[%d].", val);
-
-               SetListener(null);
        }
 
        val = media_content_disconnect();
        SysLog(NID_CNT, "media_content_disconnect result[%d].", val);
-
-       __isConnected = false;
 }
 
 _ContentManagerImpl*
 _ContentManagerImpl::GetInstance(ContentManager& contentManager)
 {
-       return contentManager.__pImpl;
+       return contentManager.__pContentManagerImpl;
 }
 
 const _ContentManagerImpl*
 _ContentManagerImpl::GetInstance(const ContentManager& contentManager)
 {
-       return contentManager.__pImpl;
+       return contentManager.__pContentManagerImpl;
 }
 
-//
-// E_SUCCESS
-// E_SYSTEM
-// E_OUT_OF_MEMORY(in public)
-//
 result
 _ContentManagerImpl::Construct(void)
 {
-       SysAssertf(!__isConnected,
-                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
-
-       ClearLastResult();
-
        int val = media_content_connect();
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM,
                        "The connection failed[%d].", val);
@@ -295,38 +287,25 @@ _ContentManagerImpl::Construct(void)
        return E_SUCCESS;
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_FILE_NOT_FOUND
-// E_OUT_OF_MEMORY
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-// - E_IO
-//
 ContentId
 _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
 {
-       SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
-
        ClearLastResult();
 
-       // Get common data from ContentInfo class
-       ContentInfo::_ContentData* pContentData = (const_cast <ContentInfo*>(&contentInfo))->GetContentData();
-       SysTryReturn(NID_CNT, pContentData != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
-                       "[E_INVALID_ARG] pContentData is null.");
+       _ContentInfoImpl* pInfoImpl = const_cast< _ContentInfoImpl* >(_ContentInfoImpl::GetInstance(contentInfo));
+       SysTryReturn(NID_CNT, pInfoImpl != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
+                       "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
-       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(pContentData->contentPath, true), UuId::GetInvalidUuId(),
+       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(pInfoImpl->GetContentPath(), true), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] The contentPath is not compatible.");
-       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(pContentData->contentPath), UuId::GetInvalidUuId(), E_FILE_NOT_FOUND,
+       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(pInfoImpl->GetContentPath()), UuId::GetInvalidUuId(), E_FILE_NOT_FOUND,
                        "[E_FILE_NOT_FOUND] The file corresponding to contentInfo could not be found.");
-       SysTryReturn(NID_CNT, pContentData->contentId == UuId::GetInvalidUuId(), UuId::GetInvalidUuId(),
+       SysTryReturn(NID_CNT, pInfoImpl->GetContentId() == UuId::GetInvalidUuId(), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] The contentId is not empty.");
 
        // Compare the type of input parameter and system
-       ContentType inputType = pContentData->contentType;
-       ContentType sysType = _ContentManagerUtilImpl::CheckContentType(pContentData->contentPath, true);
+       ContentType inputType = pInfoImpl->GetContentType();
+       ContentType sysType = _ContentManagerUtilImpl::CheckContentType(pInfoImpl->GetContentPath(), true);
 
        ClearLastResult();
 
@@ -341,22 +320,20 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
        }
 
        // Save data to database with contentPath.
-       unique_ptr<char[]> pStr(_StringConverter::CopyToCharArrayN(pContentData->contentPath));
+       unique_ptr<char[]> pStr(_StringConverter::CopyToCharArrayN(contentInfo.GetContentPath()));
        SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                        "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        media_info_h tempMediaInfo = null;
-       unique_ptr<media_info_s, MediaInfoDeleter> pMediaInfo(null);
+       unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
 
-       // Exception : E_SUCCESS, E_INVALID_ARG, E_OUT_OF_MEMORY, E_SERVICE_BUSY, E_SYSTEM
        int val = media_info_insert_to_db(pStr.get(), &tempMediaInfo);
        SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                        "The registration to database failed[%d].", val);
 
        pMediaInfo.reset(tempMediaInfo);
 
-       // Exception : E_SUCCESS, E_INVALID_ARG, E_OUT_OF_MEMORY, E_SERVICE_BUSY, E_SYSTEM
-       ContentId contentId = SaveDataToDatabase(pMediaInfo.get(), pContentData);
+       ContentId contentId = SaveDataToDatabase(pMediaInfo.get(), pInfoImpl);
        result r = GetLastResult();
        SysTryCatch(NID_CNT, contentId != UuId::GetInvalidUuId(), , r,
                        "[%s] The registration to database failed.", GetErrorMessage(r));
@@ -372,25 +349,10 @@ CATCH:
        return UuId::GetInvalidUuId();
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_STORAGE_FULL
-// E_FILE_ALREADY_EXIST
-// E_ILLEGAL_ACCESS
-// E_MAX_EXCEEDED
-// E_IO
-// E_OUT_OF_MEMORY
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-//
 ContentId
 _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& destinationPath,
                                            const ContentInfo* pContentInfo)
 {
-       SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
-
        ClearLastResult();
 
        // Check parameters(for length)
@@ -408,7 +370,6 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
        SysTryReturn(NID_CNT, pFile != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                        "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-       // Exception : E_SUCCESS, E_OUT_OF_MEMORY, E_INVALID_ARG, E_ILLEGAL_ACCESS, E_MAX_EXCEEDED, E_STORAGE_FULL, E_IO, (E_FILE_NOT_FOUND), E_SYSTEM
        result r = pFile->Construct(destinationPath, L"w+");
        SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r,
                        "[%s] The destination file can not be created.", GetErrorMessage(r));
@@ -417,34 +378,37 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
        SysTryReturn(NID_CNT, pFileImpl != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                        "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-       // Exception : E_SUCCESS, E_INVALID_ARG, E_ILLEGAL_ACCESS, E_STORAGE_FULL, E_IO
        r = pFileImpl->Write(byteBuffer);
        SysTryReturn(NID_CNT, !(IsFailed(r)), UuId::GetInvalidUuId(), r,
                        "[%s] The data can not be written in the destination file.", GetErrorMessage(r));
 
        // for release file pointer
-       delete pFile.release();
+       pFile.reset();
 
        int val = 0;
        ContentId contentId;
-       ContentInfo::_ContentData contentData;
-       ContentInfo::_ContentData* pContentData = null;
+       _ContentInfoImpl* pInfoImpl = null;
+       _ImageContentInfoImpl imageContentInfoImpl;
+       _AudioContentInfoImpl audioContentInfoImpl;
+       _VideoContentInfoImpl videoContentInfoImpl;
+       _OtherContentInfoImpl otherContentInfoImpl;
        media_info_h tempMediaInfo = null;
-       unique_ptr<media_info_s, MediaInfoDeleter> pMediaInfo(null);
+       unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
        unique_ptr<char[]> pStr(null);
 
        if (pContentInfo != null)
        {
-               pContentData = (const_cast <ContentInfo*>(pContentInfo))->GetContentData();
-               SysTryCatch(NID_CNT, pContentData != null, , E_INVALID_ARG, "[E_INVALID_ARG] GetContentData failed.");
+               pInfoImpl = const_cast< _ContentInfoImpl* >(_ContentInfoImpl::GetInstance(*pContentInfo));
+               SysTryCatch(NID_CNT, pInfoImpl != null, , E_INVALID_ARG,
+                               "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
-               SysTryCatch(NID_CNT, pContentData->contentId == UuId::GetInvalidUuId(), , E_INVALID_ARG,
+               SysTryCatch(NID_CNT, pInfoImpl->GetContentId() == UuId::GetInvalidUuId(), , E_INVALID_ARG,
                                "[E_INVALID_ARG] The content already exists in database.");
 
                // Compare the type of input parameter and system
                // CheckContentType() need actual file. so it should be checked after creating the file.
                ContentType sysType = _ContentManagerUtilImpl::CheckContentType(destinationPath, true);
-               ContentType inputType = pContentData->contentType;
+               ContentType inputType = pInfoImpl->GetContentType();
 
                ClearLastResult();
 
@@ -459,15 +423,51 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                }
 
                // Sets the content path
-               (pContentData->contentPath).Clear();
-               pContentData->contentPath = destinationPath;
+               pInfoImpl->SetContentPath(destinationPath);
        }
        else
        {
+               ContentType contentType = _ContentManagerUtilImpl::CheckContentType(destinationPath, true);
+
+               ClearLastResult();
+
                // Set the content path
-               contentData.contentPath = destinationPath;
+               if (contentType == CONTENT_TYPE_IMAGE)
+               {
+                       r = imageContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for ImageContentInfoImpl.");
+
+                       imageContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&imageContentInfoImpl);
+               }
+               else if (contentType == CONTENT_TYPE_AUDIO)
+               {
+                       r = audioContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for AudioContentInfoImpl.");
 
-               pContentData = &contentData;
+                       audioContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&audioContentInfoImpl);
+               }
+               else if (contentType == CONTENT_TYPE_VIDEO)
+               {
+                       r = videoContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for VideoContentInfoImpl.");
+
+                       videoContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&videoContentInfoImpl);
+               }
+               else
+               {
+                       r = otherContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for OtherContentInfoImpl.");
+
+                       otherContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&otherContentInfoImpl);
+               }
        }
 
        // Register the content to database directly.
@@ -480,8 +480,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
 
        pMediaInfo.reset(tempMediaInfo);
 
-       // Exception : E_SUCCESS, E_INVALID_ARG, E_OUT_OF_MEMORY, E_SERVICE_BUSY, E_SYSTEM
-       contentId = SaveDataToDatabase(pMediaInfo.get(), pContentData);
+       contentId = SaveDataToDatabase(pMediaInfo.get(), pInfoImpl);
        r = GetLastResult();
        SysTryCatch(NID_CNT, contentId != UuId::GetInvalidUuId(), , r,
                        "[%s] SaveDataToDatabase failed.", GetErrorMessage(r));
@@ -505,26 +504,10 @@ CATCH:
        return UuId::GetInvalidUuId();
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_FILE_NOT_FOUND
-// E_STORAGE_FULL
-// E_FILE_ALREADY_EXIST
-// E_ILLEGAL_ACCESS
-// E_MAX_EXCEEDED
-// E_IO
-// E_OUT_OF_MEMORY
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-//
 ContentId
 _ContentManagerImpl::CreateContent(const String& sourcePath, const String& destinationPath, bool deleteSource,
                                            const ContentInfo* pContentInfo)
 {
-       SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
-
        ClearLastResult();
 
        // Check parameters(for type)
@@ -542,13 +525,11 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
 
        if (deleteSource) // move
        {
-               //  Exception : E_SUCCESS, E_INVALID_ARG, E_ILLEGAL_ACCESS, E_FILE_NOT_FOUND, E_FILE_ALREADY_EXIST, E_MAX_EXCEEDED, E_STORAGE_FULL, E_IO
                r = _FileImpl::Move(sourcePath, destinationPath);
                SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Moving the file failed.", GetErrorMessage(r));
        }
        else // copy
        {
-               //  Exception : E_SUCCESS, E_INVALID_ARG, E_ILLEGAL_ACCESS, E_FILE_NOT_FOUND, E_FILE_ALREADY_EXIST, E_MAX_EXCEEDED, E_STORAGE_FULL, E_IO
                r = _FileImpl::Copy(sourcePath, destinationPath, true);
                SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Copying the file failed.", GetErrorMessage(r));
 
@@ -557,24 +538,28 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
 
        int val = 0;
        ContentId contentId;
-       ContentInfo::_ContentData contentData;
-       ContentInfo::_ContentData* pContentData = null;
+       _ContentInfoImpl* pInfoImpl = null;
+       _ImageContentInfoImpl imageContentInfoImpl;
+       _AudioContentInfoImpl audioContentInfoImpl;
+       _VideoContentInfoImpl videoContentInfoImpl;
+       _OtherContentInfoImpl otherContentInfoImpl;
        media_info_h tempMediaInfo = null;
-       unique_ptr<media_info_s, MediaInfoDeleter> pMediaInfo(null);
+       unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
        unique_ptr<char[]> pStr(null);
 
        if (pContentInfo != null)
        {
-               pContentData = (const_cast <ContentInfo*>(pContentInfo))->GetContentData();
-               SysTryCatch(NID_CNT, pContentData != null, , E_INVALID_ARG, "[E_INVALID_ARG] GetContentData failed.");
+               pInfoImpl = const_cast< _ContentInfoImpl* >(_ContentInfoImpl::GetInstance(*pContentInfo));
+               SysTryCatch(NID_CNT, pInfoImpl != null, , E_INVALID_ARG,
+                               "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
-               SysTryCatch(NID_CNT, pContentData->contentId == UuId::GetInvalidUuId(), , E_INVALID_ARG,
+               SysTryCatch(NID_CNT, pInfoImpl->GetContentId() == UuId::GetInvalidUuId(), , E_INVALID_ARG,
                                "[E_INVALID_ARG] The content already exists in database.");
 
                // Compare the type of input parameter and system
                // CheckContentType() need actual file. so it should be checked after creating the file.
                ContentType sysType = _ContentManagerUtilImpl::CheckContentType(destinationPath, true);
-               ContentType inputType = pContentData->contentType;
+               ContentType inputType = pInfoImpl->GetContentType();
 
                ClearLastResult();
 
@@ -589,15 +574,51 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                }
 
                // Set the content path
-               (pContentData->contentPath).Clear();
-               pContentData->contentPath = destinationPath;
+               pInfoImpl->SetContentPath(destinationPath);
        }
        else
        {
+               ContentType contentType = _ContentManagerUtilImpl::CheckContentType(destinationPath, true);
+
+               ClearLastResult();
+
                // Set the content path
-               contentData.contentPath = destinationPath;
+               if (contentType == CONTENT_TYPE_IMAGE)
+               {
+                       r = imageContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for ImageContentInfoImpl.");
+
+                       imageContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&imageContentInfoImpl);
+               }
+               else if (contentType == CONTENT_TYPE_AUDIO)
+               {
+                       r = audioContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for AudioContentInfoImpl.");
 
-               pContentData = &contentData;
+                       audioContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&audioContentInfoImpl);
+               }
+               else if (contentType == CONTENT_TYPE_VIDEO)
+               {
+                       r = videoContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for VideoContentInfoImpl.");
+
+                       videoContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&videoContentInfoImpl);
+               }
+               else
+               {
+                       r = otherContentInfoImpl.Construct(&destinationPath);
+                       SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
+                                       "[E_OUT_OF_MEMORY] Failed to perform Construct for OtherContentInfoImpl.");
+
+                       otherContentInfoImpl.SetContentPath(destinationPath);
+                       pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&otherContentInfoImpl);
+               }
        }
 
        pStr.reset(_StringConverter::CopyToCharArrayN(destinationPath));
@@ -609,7 +630,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
 
        pMediaInfo.reset(tempMediaInfo);
 
-       contentId = SaveDataToDatabase(pMediaInfo.get(), pContentData);
+       contentId = SaveDataToDatabase(pMediaInfo.get(), pInfoImpl);
        r = GetLastResult();
        SysTryCatch(NID_CNT, contentId != UuId::GetInvalidUuId(), , r,
                        "[%s] SaveDataToDatabase failed.", GetErrorMessage(r));
@@ -640,20 +661,9 @@ CATCH:
        return UuId::GetInvalidUuId();
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_FILE_NOT_FOUND
-// E_OUT_OF_MEMORY
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-//
 ContentInfo*
 _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
 {
-       SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
-
        ClearLastResult();
 
        SysTryReturn(NID_CNT, contentId != UuId::GetInvalidUuId(), null, E_INVALID_ARG,
@@ -663,7 +673,7 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
        SysTryReturn(NID_CNT, pStr != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        media_info_h tempMediaInfo = null;
-       unique_ptr<media_info_s, MediaInfoDeleter> pMediaInfo(null);
+       unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
        int val = media_info_get_media_from_db(pStr.get(), &tempMediaInfo);
        SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, null, ConvertError(val),
                        "media_info_get_media_from_db failed[%d].", val);
@@ -675,90 +685,95 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
        SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, null, ConvertError(val),
                        "media_info_get_media_type failed[%d].", val);
 
-       char* __pFilePath = null;
-       val = media_info_get_file_path(pMediaInfo.get(), &__pFilePath);
+       char* pTempFilePath = null;
+       val = media_info_get_file_path(pMediaInfo.get(), &pTempFilePath);
        SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, null, ConvertError(val),
                        "media_info_get_file_path failed[%d].", val);
 
-       unique_ptr<char, CharDeleter> pFilePath(__pFilePath);
+       unique_ptr<char, CharDeleter> pFilePath(pTempFilePath);
+       String contentPath(pFilePath.get());
 
-       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(String(pFilePath.get())), null, E_FILE_NOT_FOUND,
+       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_FILE_NOT_FOUND,
                        "[E_FILE_NOT_FOUND] The file corresponding to contentId could not be found.");
 
        result r = E_SUCCESS;
 
        if (systemType == SYSTEM_TYPE_IMAGE)
        {
-               unique_ptr<ImageContentInfo> pImageContentInfo(new (nothrow) ImageContentInfo);
+               unique_ptr< ImageContentInfo > pImageContentInfo(new (nothrow) ImageContentInfo);
                SysTryReturn(NID_CNT, pImageContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               // Get custom data
-               ContentInfo::_ContentData* pContentData = pImageContentInfo->GetContentData();
-               SysTryReturn(NID_CNT, pContentData != null, null, E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+               r = pImageContentInfo->Construct(&contentPath);
+               r = ConvertErrorToResult(r);
+               SysTryReturn(NID_CNT, !IsFailed(r), null, r,
+                               "[%s] Failed to perform Construct operation to ImageContentInfo.", GetErrorMessage(r));
 
-               // Get image metadata
-               ImageContentInfo::_ImageContentData* pImageContentData = pImageContentInfo->GetImageContentData();
-               SysTryReturn(NID_CNT, pImageContentData != null, null, E_OUT_OF_MEMORY,
+               _ImageContentInfoImpl* pImageContentInfoImpl = _ImageContentInfoImpl::GetInstance(*(pImageContentInfo.get()));
+               SysTryReturn(NID_CNT, pImageContentInfoImpl != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               // Set data
-               // Exception : E_SUCCESS, E_INVALID_ARG, E_OUT_OF_MEMORY, E_SERVICE_BUSY, E_SYSTEM
-               r = MakeContentInfo(pMediaInfo.get(), pContentData, systemType, pImageContentData);
+               r = MakeContentInfo(pMediaInfo.get(), systemType, pImageContentInfoImpl);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] MakeContentInfo failed.", GetErrorMessage(r));
 
                return pImageContentInfo.release();
        }
        else if (systemType == SYSTEM_TYPE_SOUND || systemType == SYSTEM_TYPE_MUSIC)
        {
-               unique_ptr<AudioContentInfo> pAudioContentInfo(new (nothrow) AudioContentInfo);
+               unique_ptr< AudioContentInfo > pAudioContentInfo(new (nothrow) AudioContentInfo);
                SysTryReturn(NID_CNT, pAudioContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               ContentInfo::_ContentData* pContentData = pAudioContentInfo->GetContentData();
-               SysTryReturn(NID_CNT, pContentData != null, null, E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+               r = pAudioContentInfo->Construct(&contentPath);
+               r = ConvertErrorToResult(r);
+               SysTryReturn(NID_CNT, !IsFailed(r), null, r,
+                               "[%s] Failed to perform Construct operation to AudioContentInfo.", GetErrorMessage(r));
 
-               AudioContentInfo::_AudioContentData* pAudioContentData = pAudioContentInfo->GetAudioContentData();
-               SysTryReturn(NID_CNT, pAudioContentData != null, null, E_OUT_OF_MEMORY,
+               _AudioContentInfoImpl* pAudioContentInfoImpl = _AudioContentInfoImpl::GetInstance(*(pAudioContentInfo.get()));
+               SysTryReturn(NID_CNT, pAudioContentInfoImpl != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = MakeContentInfo(pMediaInfo.get(), pContentData, systemType, pAudioContentData);
+               r = MakeContentInfo(pMediaInfo.get(), systemType, pAudioContentInfoImpl);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] MakeContentInfo failed.", GetErrorMessage(r));
 
                return pAudioContentInfo.release();
        }
        else if (systemType == SYSTEM_TYPE_VIDEO)
        {
-               unique_ptr<VideoContentInfo> pVideoContentInfo(new (nothrow) VideoContentInfo);
+               unique_ptr< VideoContentInfo > pVideoContentInfo(new (nothrow) VideoContentInfo);
                SysTryReturn(NID_CNT, pVideoContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               ContentInfo::_ContentData* pContentData = pVideoContentInfo->GetContentData();
-               SysTryReturn(NID_CNT, pContentData != null, null, E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+               r = pVideoContentInfo->Construct(&contentPath);
+               r = ConvertErrorToResult(r);
+               SysTryReturn(NID_CNT, !IsFailed(r), null, r,
+                               "[%s] Failed to perform Construct operation to VideoContentInfo.", GetErrorMessage(r));
 
-               VideoContentInfo::_VideoContentData* pVideoContentData = pVideoContentInfo->GetVideoContentData();
-               SysTryReturn(NID_CNT, pVideoContentData != null, null, E_OUT_OF_MEMORY,
+               _VideoContentInfoImpl* pVideoContentInfoImpl = _VideoContentInfoImpl::GetInstance(*(pVideoContentInfo.get()));
+               SysTryReturn(NID_CNT, pVideoContentInfoImpl != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = MakeContentInfo(pMediaInfo.get(), pContentData, systemType, pVideoContentData);
+               r = MakeContentInfo(pMediaInfo.get(), systemType, pVideoContentInfoImpl);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] MakeContentInfo failed.", GetErrorMessage(r));
 
                return pVideoContentInfo.release();
        }
        else if (systemType == SYSTEM_TYPE_OTHER)
        {
-               unique_ptr<OtherContentInfo> pOtherContentInfo(new (nothrow) OtherContentInfo);
+               unique_ptr< OtherContentInfo > pOtherContentInfo(new (nothrow) OtherContentInfo);
                SysTryReturn(NID_CNT, pOtherContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               ContentInfo::_ContentData* pContentData = pOtherContentInfo->GetContentData();
-               SysTryReturn(NID_CNT, pContentData != null, null, E_OUT_OF_MEMORY,
+               r = pOtherContentInfo->Construct(&contentPath);
+               r = ConvertErrorToResult(r);
+               SysTryReturn(NID_CNT, !IsFailed(r), null, r,
+                               "[%s] Failed to perform Construct operation to OtherContentInfo.", GetErrorMessage(r));
+
+               _OtherContentInfoImpl* pOtherContentInfoImpl = _OtherContentInfoImpl::GetInstance(*(pOtherContentInfo.get()));
+               SysTryReturn(NID_CNT, pOtherContentInfoImpl != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = MakeContentInfo(pMediaInfo.get(), pContentData, systemType, null);
+               r = MakeContentInfo(pMediaInfo.get(), systemType, pOtherContentInfoImpl);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] MakeContentInfo failed.", GetErrorMessage(r));
 
                return pOtherContentInfo.release();
@@ -770,55 +785,26 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
        }
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_FILE_NOT_FOUND
-// E_OUT_OF_MEMORY
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-//
 result
 _ContentManagerImpl::UpdateContent(const ContentInfo& contentInfo)
 {
-       SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
-
        ContentId contentId = contentInfo.GetContentId();
        SysTryReturnResult(NID_CNT, contentId != UuId::GetInvalidUuId(), E_INVALID_ARG, "The content id is invalid.");
        SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(contentInfo.GetContentPath()), E_FILE_NOT_FOUND,
                        "The file corresponding to contentInfo could not be found.");
 
-       // Get common data from ContentInfo class
-       ContentInfo::_ContentData* pContentData = (const_cast <ContentInfo*>(&contentInfo))->GetContentData();
-       SysTryReturnResult(NID_CNT, pContentData != null, E_INVALID_ARG, "pContentData is null.");
+       const _ContentInfoImpl* pInfoImpl = _ContentInfoImpl::GetInstance(contentInfo);
+       SysTryReturnResult(NID_CNT, pInfoImpl != null, E_INVALID_ARG, "Invalid argument is used. ContentInfo is invalid.");
 
-       // Exception : E_SUCCESS, E_INVALID_ARG, E_OUT_OF_MEMORY, E_SYSTEM, E_SERVICE_BUSY
-       result r = this->UpdateDataToDatabase(pContentData);
+       result r = UpdateDataToDatabase(pInfoImpl);
        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "UpdateDataToDatabase failed.");
 
        return r;
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_FILE_NOT_FOUND
-// E_OUT_OF_MEMORY
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-// - E_ILLEGAL_ACCESS
-//
 result
 _ContentManagerImpl::DeleteContent(const ContentId& contentId)
 {
-       SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
-
-       ClearLastResult();
-
        SysTryReturnResult(NID_CNT, contentId != UuId::GetInvalidUuId(), E_INVALID_ARG, "The contentId is invalid.");
 
        unique_ptr<char[]> pContentId(_StringConverter::CopyToCharArrayN(contentId.ToString()));
@@ -827,7 +813,7 @@ _ContentManagerImpl::DeleteContent(const ContentId& contentId)
        result r = E_SUCCESS;
        int val = 0;
        media_info_h tempMediaInfo = null;
-       unique_ptr<media_info_s, MediaInfoDeleter> pMediaInfo(null);
+       unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
 
        val = media_info_get_media_from_db(pContentId.get(), &tempMediaInfo);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
@@ -835,13 +821,13 @@ _ContentManagerImpl::DeleteContent(const ContentId& contentId)
 
        pMediaInfo.reset(tempMediaInfo);
 
-       char* __pContentPath = null;
+       char* pTempPath = null;
 
-       val = media_info_get_file_path(pMediaInfo.get(), &__pContentPath);
+       val = media_info_get_file_path(pMediaInfo.get(), &pTempPath);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_file_path failed[%d].", val);
 
-       unique_ptr<char, CharDeleter> pContentPath(__pContentPath);
+       unique_ptr<char, CharDeleter> pContentPath(pTempPath);
 
        String contentPath = String(pContentPath.get());
        SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(contentPath), E_FILE_NOT_FOUND,
@@ -857,16 +843,9 @@ _ContentManagerImpl::DeleteContent(const ContentId& contentId)
        return r;
 }
 
-//
-// E_SUCCESS
-// E_OBJ_ALREADY_EXIST
-// E_SYSTEM
-//
 result
 _ContentManagerImpl::AddContentUpdateEventListener(IContentUpdateEventListener& listener)
 {
-       ClearLastResult();
-
        SysTryReturnResult(NID_CNT, GetListener() == null, E_OBJ_ALREADY_EXIST, "IContentUpdateEventListener is already set.");
 
        SetListener(&listener);
@@ -877,16 +856,9 @@ _ContentManagerImpl::AddContentUpdateEventListener(IContentUpdateEventListener&
        return E_SUCCESS;
 }
 
-//
-// E_SUCCESS
-// E_OBJ_NOT_FOUND
-// E_SYSTEM
-//
 result
 _ContentManagerImpl::RemoveContentUpdateEventListener(IContentUpdateEventListener& listener)
 {
-       ClearLastResult();
-
        SysTryReturnResult(NID_CNT, GetListener() == &listener, E_OBJ_NOT_FOUND, "The input listener is not equal to the registered listener.");
 
        int val = media_content_unset_db_updated_cb();
@@ -897,18 +869,9 @@ _ContentManagerImpl::RemoveContentUpdateEventListener(IContentUpdateEventListene
        return E_SUCCESS;
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-//
 result
 _ContentManagerImpl::ScanFile(const Tizen::Base::String& contentPath)
 {
-       ClearLastResult();
-
        SysSecureLog(NID_CNT, "The scan path is [%ls].", contentPath.GetPointer());
 
        unique_ptr<char[]> pContentPath(_StringConverter::CopyToCharArrayN(contentPath));
@@ -918,25 +881,25 @@ _ContentManagerImpl::ScanFile(const Tizen::Base::String& contentPath)
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "The connection failed[%d].", val);
 
        val = media_content_scan_file(pContentPath.get());
-       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val), "media_content_scan_file failed[%d].", val);
+       result r = ConvertError(val);
+       SysTryCatch(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, , r, "[%s] media_content_scan_file failed[%d].", GetErrorMessage(r), val);
 
        val = media_content_disconnect();
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "The disconnection failed[%d].", val);
 
        return E_SUCCESS;
+
+CATCH:
+       val = media_content_disconnect();
+       SysTryLog(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, "The disconnection failed[%d].", val);
+
+       return r;
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_SYSTEM
-// E_SERVICE_BUSY
-// E_PRIVILEGE_DENIED(in public)
-//
 result
 _ContentManagerImpl::ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, IContentScanListener* pListener, RequestId& reqId)
 {
-       ClearLastResult();
+       static RequestId requestId = 0;
 
        SysLog(NID_CNT, "The scan path is [%ls].", directoryPath.GetPointer());
 
@@ -946,7 +909,7 @@ _ContentManagerImpl::ScanDirectory(const Tizen::Base::String& directoryPath, boo
        int val = media_content_connect();
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "The connection failed[%d].", val);
 
-       unique_ptr< ScanResult > pScanResult(new (nothrow) ScanResult);
+       unique_ptr< _ScanResult > pScanResult(new (nothrow) _ScanResult);
        SysTryReturnResult(NID_CNT, pScanResult != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
        reqId = requestId++;
@@ -961,23 +924,14 @@ _ContentManagerImpl::ScanDirectory(const Tizen::Base::String& directoryPath, boo
        return E_SUCCESS;
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-// E_SYSTEM
-// E_SERVICE_BUSY
-//
 result
-_ContentManagerImpl::UpdateDataToDatabase(const ContentInfo::_ContentData* pContentData) const
+_ContentManagerImpl::UpdateDataToDatabase(const _ContentInfoImpl* pContentInfoImpl) const
 {
-       ClearLastResult();
-
-       SysTryReturnResult(NID_CNT, pContentData != null, E_INVALID_ARG, "pContentData is null.");
+       SysTryReturnResult(NID_CNT, pContentInfoImpl != null, E_INVALID_ARG, "pContentInfoImpl is null.");
 
        media_info_h tempMediaInfo = null;
-       unique_ptr<media_info_s, MediaInfoDeleter> pMediaInfo(null);
-       unique_ptr<char[]> pContentId(_StringConverter::CopyToCharArrayN((pContentData->contentId).ToString()));
+       unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
+       unique_ptr<char[]> pContentId(_StringConverter::CopyToCharArrayN((pContentInfoImpl->GetContentId()).ToString()));
        SysTryReturnResult(NID_CNT, pContentId != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
        int val = media_info_get_media_from_db(pContentId.get(), &tempMediaInfo);
@@ -989,92 +943,92 @@ _ContentManagerImpl::UpdateDataToDatabase(const ContentInfo::_ContentData* pCont
        result r = E_SUCCESS;
        unique_ptr<char[]> pValue(null);
 
-       if (pContentData->pAuthor != null)
+       if (!pContentInfoImpl->GetAuthor().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pAuthor)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_author(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_author failed[%d].", val);
        }
-       if (pContentData->pCategory != null)
+       if (!pContentInfoImpl->GetCategory().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pCategory)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_category(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_category failed[%d].", val);
        }
-       if (pContentData->pContentName != null)
+       if (!pContentInfoImpl->GetContentName().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pContentName)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_content_name(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_content_name failed[%d].", val);
        }
-       if (pContentData->pDescription != null)
+       if (!pContentInfoImpl->GetDescription().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pDescription)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_description(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_description failed[%d].", val);
        }
-       if (pContentData->pKeyword != null)
+       if (!pContentInfoImpl->GetKeyword().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pKeyword)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_keyword(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_keyword failed[%d].", val);
        }
-       if (pContentData->pLocationTag != null)
+       if (!pContentInfoImpl->GetLocationTag().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pLocationTag)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_location_tag(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_location_tag failed[%d].", val);
        }
-       if (pContentData->pProvider != null)
+       if (!pContentInfoImpl->GetProvider().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pProvider)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_provider(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_provider failed[%d].", val);
        }
-       if (pContentData->pRating != null)
+       if (!pContentInfoImpl->GetRating().IsEmpty())
        {
-               pValue.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pRating)));
+               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
                SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
                val = media_info_set_age_rating(pMediaInfo.get(), pValue.get());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_age_rating failed[%d].", val);
        }
-       if (Double::Compare(pContentData->latitude, DEFAULT_COORDINATE) != 0 &&
-                       Double::Compare(pContentData->longitude, DEFAULT_COORDINATE) != 0)
+       if (Double::Compare(pContentInfoImpl->GetLatitude(), DEFAULT_COORDINATE) != 0 &&
+                       Double::Compare(pContentInfoImpl->GetLongitude(), DEFAULT_COORDINATE) != 0)
        {
-               val = media_info_set_latitude(pMediaInfo.get(), pContentData->latitude);
+               val = media_info_set_latitude(pMediaInfo.get(), pContentInfoImpl->GetLatitude());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_latitude failed[%d].", val);
 
-               val = media_info_set_longitude(pMediaInfo.get(), pContentData->longitude);
+               val = media_info_set_longitude(pMediaInfo.get(), pContentInfoImpl->GetLongitude());
                SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                "media_info_set_longitude failed[%d].", val);
 
-               if (Double::Compare(pContentData->altitude, DEFAULT_COORDINATE) != 0)
+               if (Double::Compare(pContentInfoImpl->GetAltitude(), DEFAULT_COORDINATE) != 0)
                {
-                       val = media_info_set_altitude(pMediaInfo.get(), pContentData->altitude);
+                       val = media_info_set_altitude(pMediaInfo.get(), pContentInfoImpl->GetAltitude());
                        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                                        "media_info_set_altitude failed[%d].", val);
                }
@@ -1087,24 +1041,17 @@ _ContentManagerImpl::UpdateDataToDatabase(const ContentInfo::_ContentData* pCont
        return r;
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-// E_SERVICE_BUSY
-// E_SYSTEM
-//
 ContentId
 _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
-                                                ContentInfo::_ContentData* pContentData) const
+                                                                                               _ContentInfoImpl* pContentInfoImpl) const
 {
        ClearLastResult();
 
-       SysTryReturn(NID_CNT, pContentData != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
-                       "[E_INVALID_ARG] pContentData is null.");
+       SysTryReturn(NID_CNT, pContentInfoImpl != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
+                       "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
        String mimeType(L"");
-       String extension = _FileImpl::GetFileExtension(pContentData->contentPath);
+       String extension = _FileImpl::GetFileExtension(pContentInfoImpl->GetContentPath());
        result r = GetLastResult();
        if (IsFailed(r))
        {
@@ -1112,7 +1059,7 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
 
                SysLog(NID_CNT, "[%s] Failed to perform GetFileExtension operation.", GetErrorMessage(r));
 
-               unique_ptr<char[]> pTempPath(_StringConverter::CopyToCharArrayN(pContentData->contentPath));
+               unique_ptr<char[]> pTempPath(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentPath()));
                SysTryReturn(NID_CNT, pTempPath != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1132,11 +1079,11 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
        {
                SysLog(NID_CNT, "The format of content is jpg.");
 
-               ImageMetadata* pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(pContentData->contentPath, true);
+               ImageMetadata* pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(pContentInfoImpl->GetContentPath(), true);
                if (pImageMetadata != null)
                {
-                       pContentData->latitude = pImageMetadata->GetLatitude();
-                       pContentData->longitude = pImageMetadata->GetLongitude();
+                       pContentInfoImpl->SetLatitude(pImageMetadata->GetLatitude());
+                       pContentInfoImpl->SetLongitude(pImageMetadata->GetLongitude());
 
                        delete pImageMetadata;
                }
@@ -1147,9 +1094,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
        int val = 0;
        unique_ptr<char[]> pStr(null);
 
-       if (pContentData->pAuthor != null)
+       if (pContentInfoImpl->GetAuthor() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pAuthor)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1157,9 +1104,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_author failed[%d].", val);
        }
-       if (pContentData->pCategory != null)
+       if (pContentInfoImpl->GetCategory() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pCategory)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1167,9 +1114,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_category failed[%d].", val);
        }
-       if (pContentData->pContentName != null)
+       if (pContentInfoImpl->GetContentName() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pContentName)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1177,9 +1124,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_content_name failed[%d].", val);
        }
-       if (pContentData->pDescription != null)
+       if (pContentInfoImpl->GetDescription() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pDescription)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1187,9 +1134,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_description failed[%d].", val);
        }
-       if (pContentData->pKeyword != null)
+       if (pContentInfoImpl->GetKeyword() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pKeyword)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1197,9 +1144,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_keyword failed[%d].", val);
        }
-       if (pContentData->pLocationTag != null)
+       if (pContentInfoImpl->GetLocationTag() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pLocationTag)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1207,9 +1154,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_location_tag failed[%d].", val);
        }
-       if (pContentData->pProvider != null)
+       if (pContentInfoImpl->GetProvider() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pProvider)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1217,9 +1164,9 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_provider failed[%d].", val);
        }
-       if (pContentData->pRating != null)
+       if (pContentInfoImpl->GetRating() != null)
        {
-               pStr.reset(_StringConverter::CopyToCharArrayN(*(pContentData->pRating)));
+               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
                SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1227,20 +1174,20 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_age_rating failed[%d].", val);
        }
-       if (Double::Compare(pContentData->latitude, DEFAULT_COORDINATE) != 0 &&
-                       Double::Compare(pContentData->longitude, DEFAULT_COORDINATE) != 0)
+       if (Double::Compare(pContentInfoImpl->GetLatitude(), DEFAULT_COORDINATE) != 0 &&
+                       Double::Compare(pContentInfoImpl->GetLongitude(), DEFAULT_COORDINATE) != 0)
        {
-               val = media_info_set_latitude(pMediaInfo, pContentData->latitude);
+               val = media_info_set_latitude(pMediaInfo, pContentInfoImpl->GetLatitude());
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_latitude failed[%d].", val);
 
-               val = media_info_set_longitude(pMediaInfo, pContentData->longitude);
+               val = media_info_set_longitude(pMediaInfo, pContentInfoImpl->GetLongitude());
                SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                "media_info_set_longitude failed[%d].", val);
 
-               if (Double::Compare(pContentData->altitude, DEFAULT_COORDINATE) != 0)
+               if (Double::Compare(pContentInfoImpl->GetAltitude(), DEFAULT_COORDINATE) != 0)
                {
-                       val = media_info_set_altitude(pMediaInfo, pContentData->altitude);
+                       val = media_info_set_altitude(pMediaInfo, pContentInfoImpl->GetAltitude());
                        SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                                        "media_info_set_altitude failed[%d].", val);
                }
@@ -1250,13 +1197,13 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
        SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
                        "media_info_update_to_db failed[%d].", val);
 
-       char* __pMediaId = null;
+       char* pTempMediaId = null;
        unique_ptr<char, CharDeleter> pMediaId(null);
 
-       val = media_info_get_media_id(pMediaInfo, &__pMediaId);
-       if (__pMediaId != null)
+       val = media_info_get_media_id(pMediaInfo, &pTempMediaId);
+       if (pTempMediaId != null)
        {
-               pMediaId.reset(__pMediaId);
+               pMediaId.reset(pTempMediaId);
        }
        else
        {
@@ -1264,68 +1211,56 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                                "media_info_get_media_id failed[%d].", val);
        }
 
-       String contentId(pMediaId.get());
+       String tempContentId(pMediaId.get());
+       ContentId contentId;
 
-       r = UuId::Parse(contentId, pContentData->contentId);
+       r = UuId::Parse(tempContentId, contentId);
        SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), E_INVALID_ARG,
                        "[E_INVALID_ARG] UuId::Parse failed.");
 
-       return pContentData->contentId;
+       return contentId;
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-// E_SERVICE_BUSY
-// E_SYSTEM
-//
 result
-_ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, ContentInfo::_ContentData* pContentData,
-                                             int systemType, void* pMetadata) const
+_ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, int systemType, void* pInfoImpl) const
 {
-       ClearLastResult();
+       SysTryReturnResult(NID_CNT, pMediaInfo != null && pInfoImpl != null, E_INVALID_ARG,
+                       "The specified parameter is invalid.");
 
-       if (systemType != SYSTEM_TYPE_OTHER)
-       {
-               SysTryReturnResult(NID_CNT, pMediaInfo != null && pContentData != null && pMetadata != null, E_INVALID_ARG,
-                               "The specified parameter is invalid.");
-       }
-       else // There is no metadata in Other type
-       {
-               SysTryReturnResult(NID_CNT, pMediaInfo != null && pContentData != null, E_INVALID_ARG,
-                               "The specified parameter is invalid.");
-       }
+       _ContentInfoImpl* pContentInfoImpl = static_cast< _ContentInfoImpl* >(pInfoImpl);
 
        result r = E_SUCCESS;
-       char* __pStrValue = null;
+       char* pTempValue = null;
        unique_ptr<char, CharDeleter> pStrValue(null);
 
        // contentId
-       int val = media_info_get_media_id(pMediaInfo, &__pStrValue);
+       int val = media_info_get_media_id(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_media_id failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
                String strContentId(pStrValue.get());
+               ContentId contentId;
 
-               r = UuId::Parse(strContentId, pContentData->contentId);
+               r = UuId::Parse(strContentId, contentId);
                SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "The content id can not be parsed.");
 
+               pContentInfoImpl->SetContentId(contentId);
+
                SysLog(NID_CNT, "INFO: contentId[%ls]", strContentId.GetPointer());
        }
 
        // contentPath
-       val = media_info_get_file_path(pMediaInfo, &__pStrValue);
+       val = media_info_get_file_path(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_file_path failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
                String strFilePath(pStrValue.get());
 
@@ -1350,23 +1285,23 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, ContentInfo:
                        }
                }
 
-               pContentData->contentPath = strFilePath;
+               pContentInfoImpl->SetContentPath(strFilePath);
 
                SysSecureLog(NID_CNT, "INFO: contentPath[%ls]", strFilePath.GetPointer());
        }
 
        // mimeType
-       val = media_info_get_mime_type(pMediaInfo, &__pStrValue);
+       val = media_info_get_mime_type(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_mime_type failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->mimeType = pStrValue.get();
+               pContentInfoImpl->SetMimeType(pStrValue.get());
 
-               SysLog(NID_CNT, "INFO: mimeType[%ls]", (pContentData->mimeType).GetPointer());
+               SysLog(NID_CNT, "INFO: mimeType[%ls]", (pContentInfoImpl->GetMimeType()).GetPointer());
        }
 
        // contentSize
@@ -1374,7 +1309,7 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, ContentInfo:
        val = media_info_get_size(pMediaInfo, &longlongValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_size failed[%d].", val);
-       pContentData->contentSize = longlongValue;
+       pContentInfoImpl->SetContentSize(longlongValue);
        SysLog(NID_CNT, "INFO: contentSize[%llu]", longlongValue);
 
        // storageType
@@ -1382,153 +1317,164 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, ContentInfo:
        val = media_info_get_storage_type(pMediaInfo, &storageType);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_storage_type failed[%d].", val);
-       pContentData->storageType = storageType;
+       pContentInfoImpl->SetStorageType(storageType);
        SysLog(NID_CNT, "INFO: storageType[%d]", storageType);
 
        // isDrm
-       val = media_info_is_drm(pMediaInfo, &(pContentData->isDrm));
+       bool tempDrm = false;
+
+       val = media_info_is_drm(pMediaInfo, &tempDrm);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_is_drm failed[%d].", val);
-       SysLog(NID_CNT, "INFO: isDrm[%d]", pContentData->isDrm);
+
+       pContentInfoImpl->SetDrmProtected(tempDrm);
+
+       SysLog(NID_CNT, "INFO: isDrm[%d]", pContentInfoImpl->IsDrmProtected());
 
        // dateTime
-       time_t time = 0;
-       val = media_info_get_added_time(pMediaInfo, &time);
+       time_t addedTime = 0;
+       val = media_info_get_added_time(pMediaInfo, &addedTime);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_added_time failed[%d].", val);
-       r = (pContentData->dateTime).SetValue(1970, 1, 1);
-       SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "SetValue failed.");
-       r = (pContentData->dateTime).AddSeconds(time);
-       SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "AddSeconds failed.");
-       SysLog(NID_CNT, "INFO: dateTime[%ls]", ((pContentData->dateTime).ToString()).GetPointer());
+
+       DateTime dt;
+       r = dt.SetValue(1970, 1, 1);
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform datetime.SetValue operation.");
+       r = dt.AddSeconds(addedTime);// need to check addedTime is secs/millisec
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform datetime.AddSeconds operation.");
+
+       pContentInfoImpl->SetDateTime(dt);
+       SysLog(NID_CNT, "INFO: dateTime[%ls]", ((pContentInfoImpl->GetDateTime()).ToString()).GetPointer());
 
        // thumbnailPath
-       val = media_info_get_thumbnail_path(pMediaInfo, &__pStrValue);
+       val = media_info_get_thumbnail_path(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_thumbnail_path failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
+               String thumbnailPath(pStrValue.get());
 
-               pContentData->pThumbnailPath = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetThumbnailPath(thumbnailPath);
 
-               SysLog(NID_CNT, "INFO: thumbnailPath[%ls]", (*pContentData->pThumbnailPath).GetPointer());
+               SysLog(NID_CNT, "INFO: thumbnailPath[%ls]", (pContentInfoImpl->GetThumbnailPath()).GetPointer());
        }
 
        // author
-       val = media_info_get_author(pMediaInfo, &__pStrValue);
+       val = media_info_get_author(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_author failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pAuthor = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetAuthor(String(pStrValue.get()));
 
-               SysLog(NID_CNT, "INFO: author[%ls]", (*pContentData->pAuthor).GetPointer());
+               SysLog(NID_CNT, "INFO: author[%ls]", (pContentInfoImpl->GetAuthor()).GetPointer());
        }
 
        // category
-       val = media_info_get_category(pMediaInfo, &__pStrValue);
+       val = media_info_get_category(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_category failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pCategory = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetCategory(String(pStrValue.get()));
 
-               SysLog(NID_CNT, "INFO: category[%ls]", (*pContentData->pCategory).GetPointer());
+               SysLog(NID_CNT, "INFO: category[%ls]", (pContentInfoImpl->GetCategory()).GetPointer());
        }
 
        // contentName
-       val = media_info_get_content_name(pMediaInfo, &__pStrValue);
+       val = media_info_get_content_name(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_content_name failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pContentName = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetContentName(String(pStrValue.get()));
 
-               SysSecureLog(NID_CNT, "INFO: contentName[%ls]", (*pContentData->pContentName).GetPointer());
+               SysSecureLog(NID_CNT, "INFO: contentName[%ls]", (pContentInfoImpl->GetContentName()).GetPointer());
        }
 
        // description
-       val = media_info_get_description(pMediaInfo, &__pStrValue);
+       val = media_info_get_description(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_description failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pDescription = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetDescription(String(pStrValue.get()));
 
-               SysLog(NID_CNT, "INFO: description[%ls]", (*pContentData->pDescription).GetPointer());
+               SysLog(NID_CNT, "INFO: description[%ls]", (pContentInfoImpl->GetDescription()).GetPointer());
        }
 
        // keyword
-       val = media_info_get_keyword(pMediaInfo, &__pStrValue);
+       val = media_info_get_keyword(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_keyword failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pKeyword = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetKeyword(String(pStrValue.get()));
 
-               SysLog(NID_CNT, "INFO: keyword[%ls]", (*pContentData->pKeyword).GetPointer());
+               SysLog(NID_CNT, "INFO: keyword[%ls]", (pContentInfoImpl->GetKeyword()).GetPointer());
        }
 
        // locationTag
-       val = media_info_get_location_tag(pMediaInfo, &__pStrValue);
+       val = media_info_get_location_tag(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_location_tag failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pLocationTag = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetLocationTag(String(pStrValue.get()));
 
-               SysSecureLog(NID_CNT, "INFO: locationTag[%ls]", (*pContentData->pLocationTag).GetPointer());
+               SysSecureLog(NID_CNT, "INFO: locationTag[%ls]", (pContentInfoImpl->GetLocationTag()).GetPointer());
        }
 
        // provider
-       val = media_info_get_provider(pMediaInfo, &__pStrValue);
+       val = media_info_get_provider(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_provider failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pProvider = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetProvider(String(pStrValue.get()));
 
-               SysLog(NID_CNT, "INFO: provider[%ls]", (*pContentData->pProvider).GetPointer());
+               SysLog(NID_CNT, "INFO: provider[%ls]", (pContentInfoImpl->GetProvider()).GetPointer());
        }
 
        // rating
-       val = media_info_get_age_rating(pMediaInfo, &__pStrValue);
+       val = media_info_get_age_rating(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_get_age_rating failed[%d].", val);
 
-       if (__pStrValue != null)
+       if (pTempValue != null)
        {
-               pStrValue.reset(__pStrValue);
+               pStrValue.reset(pTempValue);
 
-               pContentData->pRating = new (nothrow) String(pStrValue.get());
+               pContentInfoImpl->SetRating(String(pStrValue.get()));
 
-               SysLog(NID_CNT, "INFO: rating[%ls]", (*pContentData->pRating).GetPointer());
+               SysLog(NID_CNT, "INFO: rating[%ls]", (pContentInfoImpl->GetRating()).GetPointer());
        }
 
        // coordinates
+       Coordinates coordinates;
        double doubleValue = 0;
        val = media_info_get_latitude(pMediaInfo, &doubleValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
@@ -1536,9 +1482,10 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, ContentInfo:
 
        if (Double::Compare(doubleValue, DEFAULT_COORDINATE) != 0)
        {
-               pContentData->latitude = doubleValue;
+               pContentInfoImpl->SetLatitude(doubleValue);
+               coordinates.SetLatitude(doubleValue);
        }
-       SysSecureLog(NID_CNT, "INFO: latitude[%f]", pContentData->latitude);
+       SysSecureLog(NID_CNT, "INFO: latitude[%f]", pContentInfoImpl->GetLatitude());
 
        val = media_info_get_longitude(pMediaInfo, &doubleValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
@@ -1546,9 +1493,10 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, ContentInfo:
 
        if (Double::Compare(doubleValue, DEFAULT_COORDINATE) != 0)
        {
-               pContentData->longitude = doubleValue;
+               pContentInfoImpl->SetLongitude(doubleValue);
+               coordinates.SetLongitude(doubleValue);
        }
-       SysSecureLog(NID_CNT, "INFO: longitude[%f]", pContentData->longitude);
+       SysSecureLog(NID_CNT, "INFO: longitude[%f]", pContentInfoImpl->GetLongitude());
 
        val = media_info_get_altitude(pMediaInfo, &doubleValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
@@ -1556,354 +1504,412 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, ContentInfo:
 
        if (Double::Compare(doubleValue, DEFAULT_COORDINATE) != 0)
        {
-               pContentData->altitude = doubleValue;
+               pContentInfoImpl->SetAltitude(doubleValue);
+               coordinates.SetAltitude(doubleValue);
        }
-       SysLog(NID_CNT, "INFO: altitude[%f]", pContentData->altitude);
+       SysLog(NID_CNT, "INFO: altitude[%f]", pContentInfoImpl->GetAltitude());
 
-       int intValue = 0;
+       pContentInfoImpl->SetCoordinates(coordinates);
 
        // contentType and metadata
        if (systemType == SYSTEM_TYPE_IMAGE)
        {
-               image_meta_h __pImageMeta = null;
-               unique_ptr<image_meta_h, ImageMetaDeleter> pImageMeta(null);
+               r = MakeImageContentInfo(pMediaInfo, pInfoImpl);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform MakeImageContentInfo operation.");
+       }
+       else if (systemType == SYSTEM_TYPE_SOUND || systemType == SYSTEM_TYPE_MUSIC)
+       {
+               r = MakeAudioContentInfo(pMediaInfo, pInfoImpl);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform MakeAudioContentInfo operation.");
+       }
+       else if (systemType == MEDIA_CONTENT_TYPE_VIDEO)
+       {
+               r = MakeVideoContentInfo(pMediaInfo, pInfoImpl);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform MakeVideoContentInfo operation.");
+       }
+       else if (systemType == SYSTEM_TYPE_OTHER)
+       {
+               pContentInfoImpl->SetContentType(CONTENT_TYPE_OTHER);
+               SysLog(NID_CNT, "META: ContentType[%d]", pContentInfoImpl->GetContentType());
+       }
 
-               pContentData->contentType = CONTENT_TYPE_IMAGE;
-               SysLog(NID_CNT, "META: ContentType[%d]", pContentData->contentType);
+       return r;
+}
 
-               val = media_info_get_image(pMediaInfo, &__pImageMeta);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_get_image failed[%d].", val);
+result
+_ContentManagerImpl::MakeImageContentInfo(const media_info_h pMediaInfo, void* pInfoImpl) const
+{
+       int intValue = 0;
+       image_meta_h pTempMeta = null;
+       unique_ptr<image_meta_h, _ImageMetaDeleter> pImageMeta(null);
 
-               pImageMeta.reset(&__pImageMeta);
+       SysTryReturnResult(NID_CNT, pInfoImpl != null, E_OUT_OF_MEMORY, "pInfoImpl is null.");
 
-               // width
-               val = image_meta_get_width(*(pImageMeta.get()), &intValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "image_meta_get_width failed[%d].", val);
+       _ContentInfoImpl* pContentInfoImpl = static_cast< _ContentInfoImpl* >(pInfoImpl);
+       SysTryReturnResult(NID_CNT, pContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to perform static cast for _ContentInfoImpl.");
 
-               (static_cast<ImageContentInfo::_ImageContentData*>(pMetadata))->width = intValue;
-               SysLog(NID_CNT, "META: width[%d]", intValue);
+       pContentInfoImpl->SetContentType(CONTENT_TYPE_IMAGE);
+       SysLog(NID_CNT, "META: ContentType[%d]", pContentInfoImpl->GetContentType());
 
-               // height
-               val = image_meta_get_height(*(pImageMeta.get()), &intValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "image_meta_get_height failed[%d].", val);
+       int val = media_info_get_image(pMediaInfo, &pTempMeta);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_get_image failed[%d].", val);
 
-               (static_cast<ImageContentInfo::_ImageContentData*>(pMetadata))->height = intValue;
-               SysLog(NID_CNT, "META: height[%d]", intValue);
+       pImageMeta.reset(&pTempMeta);
 
-               // orientation
-               media_content_orientation_e orientation;
-               val = image_meta_get_orientation(*(pImageMeta.get()), &orientation);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "image_meta_get_orientation failed[%d].", val);
+       _ImageContentInfoImpl* pImageContentInfoImpl = static_cast< _ImageContentInfoImpl* >(pInfoImpl);
+       SysTryReturnResult(NID_CNT, pImageContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to perform static cast for _ImageContentInfoImpl.");
 
-               (static_cast<ImageContentInfo::_ImageContentData*>(pMetadata))->orientationType =
-                               static_cast<ImageOrientationType>(orientation);
-               SysLog(NID_CNT, "META: orientation[%d]", orientation);
+       // width
+       val = image_meta_get_width(*(pImageMeta.get()), &intValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "image_meta_get_width failed[%d].", val);
 
-               // title
-               val = media_info_get_display_name(pMediaInfo, &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_get_display_name failed[%d].", val);
+       pImageContentInfoImpl->SetWidth(intValue);
+       SysLog(NID_CNT, "META: width[%d]", intValue);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       // height
+       val = image_meta_get_height(*(pImageMeta.get()), &intValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "image_meta_get_height failed[%d].", val);
 
-                       int pos = 0;
-                       String fileName;
-                       String strTitle(pStrValue.get());
+       pImageContentInfoImpl->SetHeight(intValue);
+       SysLog(NID_CNT, "META: height[%d]", intValue);
 
-                       r = strTitle.LastIndexOf(L'.', strTitle.GetLength() - 1, pos);
-                       if (r == E_SUCCESS)
-                       {
-                               r = strTitle.SubString(0, pos, fileName);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "The title is invalid.");
-                       }
-                       else
-                       {
-                               // Without extension
-                               r = E_SUCCESS;
-                               fileName = strTitle;
-                       }
+       // orientation
+       media_content_orientation_e orientation;
+       val = image_meta_get_orientation(*(pImageMeta.get()), &orientation);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "image_meta_get_orientation failed[%d].", val);
 
-                       (static_cast<ImageContentInfo::_ImageContentData*>(pMetadata))->title = fileName;
+       pImageContentInfoImpl->SetOrientation(static_cast< ImageOrientationType >(orientation));
+       SysLog(NID_CNT, "META: orientation[%d]", orientation);
 
-                       SysLog(NID_CNT, "META: title[%ls]", fileName.GetPointer());
+       char* pTempValue = null;
+       unique_ptr<char, CharDeleter> pStrValue(null);
+
+       // title
+       val = media_info_get_display_name(pMediaInfo, &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_get_display_name failed[%d].", val);
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+
+               int pos = 0;
+               String fileName;
+               String strTitle(pStrValue.get());
+
+               result r = strTitle.LastIndexOf(L'.', strTitle.GetLength() - 1, pos);
+               if (r == E_SUCCESS)
+               {
+                       r = strTitle.SubString(0, pos, fileName);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "The title is invalid.");
                }
+               else
+               {
+                       // Without extension
+                       r = E_SUCCESS;
+                       fileName = strTitle;
+               }
+
+               pImageContentInfoImpl->SetTitle(fileName);
+
+               SysLog(NID_CNT, "META: title[%ls]", fileName.GetPointer());
        }
-       else if (systemType == SYSTEM_TYPE_SOUND || systemType == SYSTEM_TYPE_MUSIC)
-       {
-               audio_meta_h __pAudioMeta = null;
-               unique_ptr<audio_meta_h, AudioMetaDeleter> pAudioMeta(null);
 
-               pContentData->contentType = CONTENT_TYPE_AUDIO;
-               SysLog(NID_CNT, "META: ContentType[%d]", pContentData->contentType);
+       return E_SUCCESS;
+}
 
-               val = media_info_get_audio(pMediaInfo, &__pAudioMeta);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_get_audio failed[%d].", val);
+result
+_ContentManagerImpl::MakeAudioContentInfo(const media_info_h pMediaInfo, void* pInfoImpl) const
+{
+       int intValue = 0;
+       audio_meta_h pTempMeta = null;
+       unique_ptr<audio_meta_h, _AudioMetaDeleter> pAudioMeta(null);
 
-               pAudioMeta.reset(&__pAudioMeta);
+       SysTryReturnResult(NID_CNT, pInfoImpl != null, E_OUT_OF_MEMORY, "pInfoImpl is null.");
 
-               // bitrate
-               val = audio_meta_get_bit_rate(*(pAudioMeta.get()), &intValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_bit_rate failed[%d].", val);
+       _ContentInfoImpl* pContentInfoImpl = static_cast< _ContentInfoImpl* >(pInfoImpl);
+       SysTryReturnResult(NID_CNT, pContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to perform static cast for _ContentInfoImpl.");
 
-               (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->bitrate = intValue;
-               SysLog(NID_CNT, "META: bitrate[%d]", intValue);
+       pContentInfoImpl->SetContentType(CONTENT_TYPE_AUDIO);
+       SysLog(NID_CNT, "META: ContentType[%d]", pContentInfoImpl->GetContentType());
 
-               // releaseYear
-               val = audio_meta_get_year(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_year failed[%d].", val);
+       int val = media_info_get_audio(pMediaInfo, &pTempMeta);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_get_audio failed[%d].", val);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       pAudioMeta.reset(&pTempMeta);
 
-                       String strYear(pStrValue.get());
+       _AudioContentInfoImpl* pAudioContentInfoImpl = static_cast< _AudioContentInfoImpl* >(pInfoImpl);
+       SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to perform static cast for _AudioContentInfoImpl.");
 
-                       if (strYear.CompareTo(L"Unknown") != 0)
-                       {
-                               r = Integer::Parse(strYear, intValue);
-                               if (IsFailed(r))
-                               {
-                                       // It is one of the metadata. If error occurs, skip it for other metadata.
-                                       intValue = 0;
-                                       r = E_SUCCESS;
-                                       SysLog(NID_CNT, "META: releaseYear - invalid data[%ls]", strYear.GetPointer());
-                               }
-
-                               (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->releaseYear = intValue;
-                               SysLog(NID_CNT, "META: releaseYear[%d]", intValue);
-                       }
-               }
+       // bitrate
+       val = audio_meta_get_bit_rate(*(pAudioMeta.get()), &intValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_bit_rate failed[%d].", val);
 
-               // title
-               val = audio_meta_get_title(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_title failed[%d].", val);
+       pAudioContentInfoImpl->SetBitrate(intValue);
+       SysLog(NID_CNT, "META: bitrate[%d]", intValue);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       char* pTempValue = null;
+       unique_ptr<char, CharDeleter> pStrValue(null);
 
-                       (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->pTitle =
-                                       new (nothrow) String(pStrValue.get());
+       // releaseYear
+       val = audio_meta_get_year(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_year failed[%d].", val);
 
-                       SysLog(NID_CNT, "META: title[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-               // albumName
-               val = audio_meta_get_album(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_album failed[%d].", val);
+               String strYear(pStrValue.get());
 
-               if (__pStrValue != null)
+               if (strYear.CompareTo(L"Unknown") != 0)
                {
-                       pStrValue.reset(__pStrValue);
-
-                       (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->pAlbumName =
-                                       new (nothrow) String(pStrValue.get());
+                       result r = Integer::Parse(strYear, intValue);
+                       if (IsFailed(r))
+                       {
+                               // It is one of the metadata. If error occurs, skip it for other metadata.
+                               intValue = 0;
+                               r = E_SUCCESS;
+                               SysLog(NID_CNT, "META: releaseYear - invalid data[%ls]", strYear.GetPointer());
+                       }
 
-                       SysLog(NID_CNT, "META: albumName[%ls]", (String(pStrValue.get())).GetPointer());
+                       pAudioContentInfoImpl->SetReleaseYear(intValue);
+                       SysLog(NID_CNT, "META: releaseYear[%d]", intValue);
                }
+       }
 
-               // artist
-               val = audio_meta_get_artist(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_artist failed[%d].", val);
+       // title
+       val = audio_meta_get_title(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_title failed[%d].", val);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-                       (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->pArtist =
-                                       new (nothrow) String(pStrValue.get());
+               pAudioContentInfoImpl->SetTitle(String(pStrValue.get()));
 
-                       SysLog(NID_CNT, "META: artist[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+               SysLog(NID_CNT, "META: title[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               // composer
-               val = audio_meta_get_composer(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_composer failed[%d].", val);
+       // albumName
+       val = audio_meta_get_album(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_album failed[%d].", val);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-                       (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->pComposer =
-                                       new (nothrow) String(pStrValue.get());
+               pAudioContentInfoImpl->SetAlbumName(String(pStrValue.get()));
 
-                       SysLog(NID_CNT, "META: composer[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+               SysLog(NID_CNT, "META: albumName[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               // genre
-               val = audio_meta_get_genre(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_genre failed[%d].", val);
+       // artist
+       val = audio_meta_get_artist(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_artist failed[%d].", val);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-                       (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->pGenre =
-                                       new (nothrow) String(pStrValue.get());
+               pAudioContentInfoImpl->SetArtist(String(pStrValue.get()));
 
-                       SysLog(NID_CNT, "META: genre[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+               SysLog(NID_CNT, "META: artist[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               // copyright
-               val = audio_meta_get_copyright(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_copyright failed[%d].", val);
+       // composer
+       val = audio_meta_get_composer(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_composer failed[%d].", val);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-                       (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->pCopyright =
-                                       new (nothrow) String(pStrValue.get());
+               pAudioContentInfoImpl->SetComposer(String(pStrValue.get()));
 
-                       SysLog(NID_CNT, "META: copyright[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+               SysLog(NID_CNT, "META: composer[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               // trackInfo
-               val = audio_meta_get_track_num(*(pAudioMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_track_num failed[%d].", val);
+       // genre
+       val = audio_meta_get_genre(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_genre failed[%d].", val);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-                       (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->pTrackInfo
-                                       = new (nothrow) String(pStrValue.get());
+               pAudioContentInfoImpl->SetGenre(String(pStrValue.get()));
 
-                       SysLog(NID_CNT, "META: trackInfo[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+               SysLog(NID_CNT, "META: genre[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               // duration
-               val = audio_meta_get_duration(*(pAudioMeta.get()), &intValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "audio_meta_get_duration failed[%d].", val);
+       // copyright
+       val = audio_meta_get_copyright(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_copyright failed[%d].", val);
 
-               (static_cast<AudioContentInfo::_AudioContentData*>(pMetadata))->duration = intValue;
-               SysLog(NID_CNT, "META: duration[%d]", intValue);
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+
+               pAudioContentInfoImpl->SetCopyright(String(pStrValue.get()));
 
+               SysLog(NID_CNT, "META: copyright[%ls]", (String(pStrValue.get())).GetPointer());
        }
-       else if (systemType == MEDIA_CONTENT_TYPE_VIDEO)
+
+       // trackInfo
+       val = audio_meta_get_track_num(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_track_num failed[%d].", val);
+
+       if (pTempValue != null)
        {
-               video_meta_h __pVideoMeta = null;
-               unique_ptr<video_meta_h, VideoMetaDeleter> pVideoMeta(null);
+               pStrValue.reset(pTempValue);
 
-               pContentData->contentType = CONTENT_TYPE_VIDEO;
-               SysLog(NID_CNT, "META: ContentType[%d]", pContentData->contentType);
+               pAudioContentInfoImpl->SetTrackInfo(String(pStrValue.get()));
 
-               val = media_info_get_video(pMediaInfo, &__pVideoMeta);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_get_video failed[%d].", val);
+               SysLog(NID_CNT, "META: trackInfo[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               pVideoMeta.reset(&__pVideoMeta);
+       // duration
+       val = audio_meta_get_duration(*(pAudioMeta.get()), &intValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_duration failed[%d].", val);
 
-               // width
-               val = video_meta_get_width(*(pVideoMeta.get()), &intValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "video_meta_get_width failed[%d].", val);
+       pAudioContentInfoImpl->SetDuration(intValue);
+       SysLog(NID_CNT, "META: duration[%d]", intValue);
 
-               (static_cast<VideoContentInfo::_VideoContentData*>(pMetadata))->width = intValue;
-               SysLog(NID_CNT, "META: width[%d]", intValue);
+       return E_SUCCESS;
+}
 
-               // height
-               val = video_meta_get_height(*(pVideoMeta.get()), &intValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "video_meta_get_height failed[%d].", val);
+result
+_ContentManagerImpl::MakeVideoContentInfo(const media_info_h pMediaInfo, void* pInfoImpl) const
+{
+       int intValue = 0;
+       video_meta_h pTempMeta = null;
+       unique_ptr<video_meta_h, _VideoMetaDeleter> pVideoMeta(null);
 
-               (static_cast<VideoContentInfo::_VideoContentData*>(pMetadata))->height = intValue;
-               SysLog(NID_CNT, "META: height[%d]", intValue);
+       SysTryReturnResult(NID_CNT, pInfoImpl != null, E_OUT_OF_MEMORY, "pInfoImpl is null.");
 
-               // Get from metadata extractor (framerate, audio bitrate, video bitrate)
+       _ContentInfoImpl* pContentInfoImpl = static_cast< _ContentInfoImpl* >(pInfoImpl);
+       SysTryReturnResult(NID_CNT, pContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to perform static cast for _ContentInfoImpl.");
 
-               // artist
-               val = video_meta_get_artist(*(pVideoMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "video_meta_get_artist failed[%d].", val);
+       pContentInfoImpl->SetContentType(CONTENT_TYPE_VIDEO);
+       SysLog(NID_CNT, "META: ContentType[%d]", pContentInfoImpl->GetContentType());
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       int val = media_info_get_video(pMediaInfo, &pTempMeta);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_get_video failed[%d].", val);
 
-                       (static_cast<VideoContentInfo::_VideoContentData*>(pMetadata))->pArtist
-                                       = new (nothrow) String(pStrValue.get());
+       pVideoMeta.reset(&pTempMeta);
 
-                       SysLog(NID_CNT, "META: artist[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+       _VideoContentInfoImpl* pVideoContentInfoImpl = static_cast< _VideoContentInfoImpl* >(pInfoImpl);
+       SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to perform static cast for _VideoContentInfoImpl.");
 
-               // genre
-               val = video_meta_get_genre(*(pVideoMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "video_meta_get_genre failed[%d].", val);
+       // width
+       val = video_meta_get_width(*(pVideoMeta.get()), &intValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_width failed[%d].", val);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       pVideoContentInfoImpl->SetWidth(intValue);
+       SysLog(NID_CNT, "META: width[%d]", intValue);
 
-                       (static_cast<VideoContentInfo::_VideoContentData*>(pMetadata))->pGenre
-                                       = new (nothrow) String(pStrValue.get());
+       // height
+       val = video_meta_get_height(*(pVideoMeta.get()), &intValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_height failed[%d].", val);
 
-                       SysLog(NID_CNT, "META: genre[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+       pVideoContentInfoImpl->SetHeight(intValue);
+       SysLog(NID_CNT, "META: height[%d]", intValue);
 
-               // title
-               val = video_meta_get_title(*(pVideoMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "video_meta_get_title failed[%d].", val);
+       char* pTempValue = null;
+       unique_ptr<char, CharDeleter> pStrValue(null);
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       // artist
+       val = video_meta_get_artist(*(pVideoMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_artist failed[%d].", val);
 
-                       (static_cast<VideoContentInfo::_VideoContentData*>(pMetadata))->pTitle
-                                       = new (nothrow) String(pStrValue.get());
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-                       SysLog(NID_CNT, "META: title[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+               pVideoContentInfoImpl->SetArtist(String(pStrValue.get()));
 
-               // albumName
-               val = video_meta_get_album(*(pVideoMeta.get()), &__pStrValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "video_meta_get_album failed[%d].", val);
+               SysLog(NID_CNT, "META: artist[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               if (__pStrValue != null)
-               {
-                       pStrValue.reset(__pStrValue);
+       // genre
+       val = video_meta_get_genre(*(pVideoMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_genre failed[%d].", val);
 
-                       (static_cast<VideoContentInfo::_VideoContentData*>(pMetadata))->pAlbumName
-                                       = new (nothrow) String(pStrValue.get());
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
 
-                       SysLog(NID_CNT, "META: albumName[%ls]", (String(pStrValue.get())).GetPointer());
-               }
+               pVideoContentInfoImpl->SetGenre(String(pStrValue.get()));
 
-               // duration
-               val = video_meta_get_duration(*(pVideoMeta.get()), &intValue);
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "video_meta_get_duration failed[%d].", val);
+               SysLog(NID_CNT, "META: genre[%ls]", (String(pStrValue.get())).GetPointer());
+       }
 
-               (static_cast<VideoContentInfo::_VideoContentData*>(pMetadata))->duration = intValue;
-               SysLog(NID_CNT, "META: duration[%d]", intValue);
+       // title
+       val = video_meta_get_title(*(pVideoMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_title failed[%d].", val);
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+
+               pVideoContentInfoImpl->SetTitle(String(pStrValue.get()));
+
+               SysLog(NID_CNT, "META: title[%ls]", (String(pStrValue.get())).GetPointer());
        }
-       else if (systemType == SYSTEM_TYPE_OTHER)
+
+       // albumName
+       val = video_meta_get_album(*(pVideoMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_album failed[%d].", val);
+
+       if (pTempValue != null)
        {
-               pContentData->contentType = CONTENT_TYPE_OTHER;
-               SysLog(NID_CNT, "META: ContentType[%d]", pContentData->contentType);
+               pStrValue.reset(pTempValue);
+
+               pVideoContentInfoImpl->SetAlbumName(String(pStrValue.get()));
+
+               SysLog(NID_CNT, "META: albumName[%ls]", (String(pStrValue.get())).GetPointer());
        }
 
-       return r;
+       // duration
+       val = video_meta_get_duration(*(pVideoMeta.get()), &intValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_duration failed[%d].", val);
+
+       pVideoContentInfoImpl->SetDuration(intValue);
+       SysLog(NID_CNT, "META: duration[%d]", intValue);
+
+       // Get from metadata extractor (framerate, audio bitrate, video bitrate)
+       VideoMetadata* pVideoMetadata = ContentManagerUtil::GetVideoMetaN(pVideoContentInfoImpl->GetContentPath());
+       result r = GetLastResult();
+       SysTryReturnResult(NID_CNT, pVideoMetadata != null, r, "GetVideoMetadata() failed.");
+
+       pVideoContentInfoImpl->SetFramerate(pVideoMetadata->GetFramerate());
+       pVideoContentInfoImpl->SetAudioBitrate(pVideoMetadata->GetAudioBitrate());
+       pVideoContentInfoImpl->SetVideoBitrate(pVideoMetadata->GetVideoBitrate());
+
+       return E_SUCCESS;
 }
 
 bool
@@ -1956,15 +1962,17 @@ _ContentManagerImpl::VerifyMediaFilePathCompatibility(const String& contentPath,
        }
        else
        {
+               String tempPath(contentPath);
+
                // prior to 2.0
                if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
                {
-                       r = (const_cast<String*>(&contentPath))->Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
+                       r = tempPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
                        SysTryReturn(NID_CNT, !IsFailed(r), false, E_INVALID_ARG, "[E_INVALID_ARG] Replace failed.");
                }
                else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
                {
-                       r = (const_cast<String*>(&contentPath))->Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
+                       r = tempPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
                        SysTryReturn(NID_CNT, !IsFailed(r), false, E_INVALID_ARG, "[E_INVALID_ARG] Replace failed.");
                }
                else
@@ -1995,4 +2003,22 @@ _ContentManagerImpl::GetListener(void) const
        return __pListener;
 }
 
+result
+_ContentManagerImpl::ConvertErrorToResult(result res) const
+{
+       result r = E_SUCCESS;
+
+       switch (res)
+       {
+       case E_IO:
+               r = E_SYSTEM;
+               break;
+
+       default:
+               r = res;
+               break;
+       }
+       return r;
+}
+
 }}
index a640f99..086a6e2 100644 (file)
-//\r
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//     http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-/**\r
- * @file               FCnt_ContentSearchImpl.cpp\r
- * @brief              This is the implementation file for the %_ContentSearchImpl class.\r
- *\r
- * This file contains implementation of the %_ContentSearchImpl class.\r
- */\r
-\r
-#include <time.h>\r
-#include <FBaseSysLog.h>\r
-#include <FBaseInteger.h>\r
-#include <FBaseLongLong.h>\r
-#include <FBaseFloat.h>\r
-#include <FBaseColIList.h>\r
-#include <FBaseUtilStringTokenizer.h>\r
-#include <FCntContentSearch.h>\r
-#include <FCntContentSearchResult.h>\r
-#include <FBase_StringConverter.h>\r
-#include <FBase_LocalizedNumParser.h>\r
-#include <FCnt_ContentUtility.h>\r
-#include <FCnt_ContentSearchImpl.h>\r
-\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Base::Collection;\r
-using namespace Tizen::Base::Utility;\r
-using namespace Tizen::Io;\r
-\r
-namespace Tizen { namespace Content\r
-{\r
-\r
-static const int QUERY_LENGTH = 4096;\r
-\r
-// Declaration for Callback function registered to each media info details\r
-bool MediaItemCb(media_info_h media, void* pUserdata);\r
-// Declaration for Callback function registered to each column details\r
-bool GroupItemCb(const char* pGroupName, void* pUserdata);\r
-// Declaration for Callback function registered to each album details\r
-bool AlbumItemCb(media_album_h album, void* pUserdata);\r
-\r
-// Default constructor\r
-_ContentSearchImpl::_ContentSearchImpl(void)\r
-       : Object()\r
-       , __contentType(CONTENT_TYPE_UNKNOWN)\r
-       , __pFinalOutList(NULL)\r
-       , __inputExpr(L"")\r
-       , __inputColumnName(L"")\r
-       , __inputSortOrder(SORT_ORDER_NONE)\r
-       , __pFilterHandle(NULL)\r
-{\r
-       SysLog(NID_CNT, "Enter\n");\r
-}\r
-\r
-\r
-// Default destructor (disconnects the DB connection)\r
-_ContentSearchImpl::~_ContentSearchImpl(void)\r
-{\r
-       SysLog(NID_CNT, "Enter\n");\r
-\r
-       int ret = MEDIA_CONTENT_ERROR_NONE;\r
-       result r = E_SUCCESS;\r
-\r
-       ret = media_content_disconnect();\r
-       r = MapCoreErrorToNativeResult(ret);\r
-       SysTryLog(NID_CNT, r == E_SUCCESS, "[%s] Propagated in ~_ContentSearchImpl", GetErrorMessage(r));\r
-}\r
-\r
- _ContentSearchImpl*\r
- _ContentSearchImpl::GetInstance(ContentSearch& contentSearch)\r
-{\r
-       return contentSearch.__pImpl;\r
-}\r
-\r
-const _ContentSearchImpl*\r
-_ContentSearchImpl::GetInstance(const ContentSearch& contentSearch)\r
-{\r
-       return contentSearch.__pImpl;\r
-}\r
-\r
-//make a connection to DB\r
-result\r
-_ContentSearchImpl::Construct(ContentType type)\r
-{\r
-       SysLog(NID_CNT, "Enter\n");\r
-\r
-       result r = E_SUCCESS;\r
-       int ret = MEDIA_CONTENT_ERROR_NONE;\r
-\r
-       ret = media_content_connect();\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS , E_SYSTEM, "Failed to perform media_content_connect operation.");\r
-\r
-       __contentType = type;\r
-\r
-       return r;\r
-}\r
-\r
-// Creates a filter for the input query string along with content type\r
-// Initializes filter handle\r
-// Image - MEDIA_TYPE=0\r
-// Vide0 - MEDIA_TYPE=1\r
-// Audio - MEDIA_TYPE=2 or MEDIA_TYPE=3\r
-// Others - MEDIA_TYPE=4\r
-// All - none\r
-// Appends MEDIA_TYPE with "AND" (if the input expression is not empty and content type is not ALL) and  input expression\r
-// Sets the condition and order.\r
-// If any argument is not proper E_INVALID_ARG is returned\r
-result\r
-_ContentSearchImpl::CreateQueryFilter(bool isAndAppendReq) const\r
-{\r
-       int ret  = MEDIA_CONTENT_ERROR_NONE;\r
-       result r = E_SUCCESS;\r
-\r
-       std::unique_ptr<char[]> pInputCond;\r
-       std::unique_ptr<char[]> pSortCol;\r
-\r
-       String inputCondition;\r
-       String slpColumn;\r
-\r
-       filter_h tempFilter = NULL;\r
-\r
-       ret = media_filter_create(&tempFilter);\r
-       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_create operation.");\r
-\r
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCnt_ContentSearchImpl.cpp
+ * @brief              This is the implementation file for the %_ContentSearchImpl class.
+ *
+ * This file contains implementation of the %_ContentSearchImpl class.
+ */
+
+#include <new>
+#include <time.h>
+#include <FBaseSysLog.h>
+#include <FBaseInteger.h>
+#include <FBaseLongLong.h>
+#include <FBaseFloat.h>
+#include <FBaseColIList.h>
+#include <FBaseUtilStringTokenizer.h>
+#include <FCntContentSearch.h>
+#include <FCntContentSearchResult.h>
+#include <FBase_StringConverter.h>
+#include <FBase_LocalizedNumParser.h>
+#include "FCnt_ContentUtility.h"
+#include "FCnt_ContentSearchImpl.h"
+#include "FCnt_ContentInfoImpl.h"
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_VideoContentInfoImpl.h"
+#include "FCnt_OtherContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Io;
+
+namespace Tizen { namespace Content
+{
+
+static const int QUERY_LENGTH = 4096;
+
+// Declaration for Callback function registered to each media info details
+bool MediaItemCb(media_info_h media, void* pUserdata);
+// Declaration for Callback function registered to each column details
+bool GroupItemCb(const char* pGroupName, void* pUserdata);
+// Declaration for Callback function registered to each album details
+bool AlbumItemCb(media_album_h album, void* pUserdata);
+
+// Default constructor
+_ContentSearchImpl::_ContentSearchImpl(void)
+       : __contentType(CONTENT_TYPE_UNKNOWN)
+       , __pFinalOutList(NULL)
+       , __inputExpr(L"")
+       , __inputColumnName(L"")
+       , __inputSortOrder(SORT_ORDER_NONE)
+       , __pFilterHandle(NULL)
+{
+       SysLog(NID_CNT, "Enter\n");
+}
+
+
+// Default destructor (disconnects the DB connection)
+_ContentSearchImpl::~_ContentSearchImpl(void)
+{
+       SysLog(NID_CNT, "Enter\n");
+
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       result r = E_SUCCESS;
+
+       ret = media_content_disconnect();
+       r = MapCoreErrorToNativeResult(ret);
+       SysTryLog(NID_CNT, r == E_SUCCESS, "[%s] Propagated in ~_ContentSearchImpl", GetErrorMessage(r));
+}
+
+ _ContentSearchImpl*
+ _ContentSearchImpl::GetInstance(ContentSearch& contentSearch)
+{
+       return contentSearch.__pImpl;
+}
+
+const _ContentSearchImpl*
+_ContentSearchImpl::GetInstance(const ContentSearch& contentSearch)
+{
+       return contentSearch.__pImpl;
+}
+
+//make a connection to DB
+result
+_ContentSearchImpl::Construct(ContentType type)
+{
+       SysLog(NID_CNT, "Enter\n");
+
+       result r = E_SUCCESS;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       ret = media_content_connect();
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS , E_SYSTEM, "Failed to perform media_content_connect operation.");
+
+       __contentType = type;
+
+       return r;
+}
+
+// Creates a filter for the input query string along with content type
+// Initializes filter handle
+// Image - MEDIA_TYPE=0
+// Vide0 - MEDIA_TYPE=1
+// Audio - MEDIA_TYPE=2 or MEDIA_TYPE=3
+// Others - MEDIA_TYPE=4
+// All - none
+// Appends MEDIA_TYPE with "AND" (if the input expression is not empty and content type is not ALL) and  input expression
+// Sets the condition and order.
+// If any argument is not proper E_INVALID_ARG is returned
+result
+_ContentSearchImpl::CreateQueryFilter(bool isAndAppendReq) const
+{
+       int ret  = MEDIA_CONTENT_ERROR_NONE;
+       result r = E_SUCCESS;
+
+       std::unique_ptr<char[]> pInputCond;
+       std::unique_ptr<char[]> pSortCol;
+
+       String inputCondition;
+       String slpColumn;
+
+       filter_h tempFilter = NULL;
+
+       ret = media_filter_create(&tempFilter);
+       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_create operation.");
+
        std::unique_ptr<filter_s, SearchFilterHandleDeleter> pFilterHandle(tempFilter);
-       SysTryReturnResult(NID_CNT, pFilterHandle != null, E_OUT_OF_MEMORY, "pFilterHandle is null.");\r
-\r
-       switch (__contentType)\r
-       {\r
-               // Image-0,video-1,sound-2,music-3,other-4\r
-       case CONTENT_TYPE_OTHER:\r
-               inputCondition = "MEDIA_TYPE=4 ";\r
-               break;\r
-       case CONTENT_TYPE_IMAGE:\r
-               inputCondition = "MEDIA_TYPE=0 ";\r
-               break;\r
-       case CONTENT_TYPE_AUDIO:\r
-               inputCondition = "(MEDIA_TYPE=2 or MEDIA_TYPE=3) ";\r
-               break;\r
-       case CONTENT_TYPE_VIDEO:\r
-               inputCondition = "MEDIA_TYPE=1 ";\r
-               break;\r
-       case CONTENT_TYPE_ALL:\r
-               //If content type is CONTENT_TYPE_ALL, then MEDIA_TYPE is empty\r
-               break;\r
-       default:\r
-               break;\r
-       }\r
-\r
-       if (!__inputExpr.IsEmpty())\r
-       {\r
-               if (isAndAppendReq && (!inputCondition.IsEmpty())) //For CONTENT_TYPE_ALL inputCondition is empty\r
-               {\r
-                       r = inputCondition.Append("AND ");\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform append operation.");\r
-               }\r
-\r
-               r = inputCondition.Append(__inputExpr);\r
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform append operation.");\r
-       }\r
-\r
-       if (!inputCondition.IsEmpty())\r
-       {\r
-               //CopyToCharArrayN: utility function, converts a osp string to char*\r
-               pInputCond = std::unique_ptr<char[]>(_StringConverter::CopyToCharArrayN(inputCondition));\r
-               SysTryReturnResult(NID_CNT, pInputCond, E_OUT_OF_MEMORY, "pInputCond is NULL.");\r
-\r
-               SysLog(NID_CNT, "pInputCond = %s", pInputCond.get());\r
-\r
-               ret = media_filter_set_condition(pFilterHandle.get(), pInputCond.get(), MEDIA_CONTENT_COLLATE_DEFAULT);\r
-               SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_set_condition operation.");\r
-       }\r
-\r
-       if (!__inputColumnName.IsEmpty()) // SortColumn is optional in case of SearchN\r
-       {\r
-               //__inputColumnName (osp column name) is replaced with slpColumn (slp column name).\r
-               r = GetSlpColumnName(slpColumn);\r
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform GetSlpColumnName operation.");\r
-\r
-               //CopyToCharArrayN: utility function, converts a osp string to char*\r
-\r
-               pSortCol = std::unique_ptr<char[]>(_StringConverter::CopyToCharArrayN(slpColumn));\r
-               SysTryReturnResult(NID_CNT, pSortCol, E_OUT_OF_MEMORY, "pSortCol is NULL.");\r
-\r
-               if (__inputSortOrder == SORT_ORDER_ASCENDING)\r
-               {\r
-                       ret = media_filter_set_order(pFilterHandle.get(), MEDIA_CONTENT_ORDER_ASC, pSortCol.get(), MEDIA_CONTENT_COLLATE_NOCASE);\r
-                       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_set_order operation.");\r
-               }\r
-               else if (__inputSortOrder == SORT_ORDER_DESCENDING)\r
-               {\r
-                       ret = media_filter_set_order(pFilterHandle.get(), MEDIA_CONTENT_ORDER_DESC, pSortCol.get(), MEDIA_CONTENT_COLLATE_NOCASE);\r
-                       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_set_order operation.");\r
-               }\r
-       }\r
-\r
-       __pFilterHandle.reset(pFilterHandle.release());\r
-\r
-       return r;\r
-}\r
-\r
-// Osp column names are mapped with slp column names\r
-// CONTENT_TYPE_OTHER and CONTENT_TYPE_IMAGE (0 - 13 ) are valid columns\r
-// CONTENT_TYPE_VIDEO  (0 - 16 ) are valid columns\r
-// CONTENT_TYPE_ALL and  CONTENT_TYPE_VIDEO (0 - 18 ) are valid columns\r
-// if the given osp column is out of the specified range of the type, E_INVALID_ARG is retuned.\r
-result\r
-_ContentSearchImpl::GetSlpColumnName(String& inputCol) const\r
-{\r
-       String          ospColumnName(L"");\r
-       String          slpColumnName(L"");\r
-       String          columnName(__inputColumnName);\r
-       result          r = E_SUCCESS;\r
-       int             maxCols = 0;\r
-       switch (__contentType)\r
-       {\r
-       case CONTENT_TYPE_OTHER:\r
-               //fall through\r
-       case CONTENT_TYPE_IMAGE:\r
-               maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;\r
-               break;\r
-       case CONTENT_TYPE_VIDEO:\r
-               maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;\r
-               break;\r
-       case CONTENT_TYPE_AUDIO:\r
-               //fall through\r
-       case CONTENT_TYPE_ALL:\r
-               maxCols = MAX_QUERY_COLUMNS;\r
-               break;\r
-       default:\r
-               break;\r
-       }\r
-       for (int colIndex = 0; colIndex < maxCols; colIndex++)\r
-       {\r
-               ospColumnName.Clear();\r
-               slpColumnName.Clear();\r
-\r
-               ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;\r
-               slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;\r
-\r
-               ospColumnName.ToUpper();\r
-               columnName.ToUpper();\r
-               if (columnName == ospColumnName)\r
-               {\r
-                       inputCol = slpColumnName;\r
-                       return r;\r
-               }\r
-       }\r
-       return E_INVALID_ARG;\r
-}\r
-\r
-//If the input expression contains any osp column name, it will be replaced with slp column name.\r
-// only CONTENT_TYPE_AUDIO and CONTENT_TYPE_ALL allowed to use all given columns\r
-// so, check for invalid column for CONTENT_TYPE_OTHER,CONTENT_TYPE_IMAGE and CONTENT_TYPE_VIDEO.\r
-// all the osp columns in the expression should be replaced with slp column names.\r
-// ' is used as a delimeter in parsing user query. so, \\' is saved as a special@apostrophe string.\r
-// \\' is replaced with '', which considers ' as normal character.\r
-\r
-result\r
-_ContentSearchImpl::ReplaceOspColumnNameWithSlp(void) const\r
-{\r
-       String          ospColumnName(L"");\r
-       String          slpColumnName(L"");\r
-       String          splApostrophe(L"special@apostrophe");\r
-       result          r = E_SUCCESS;\r
-       int             maxCols = 0;\r
-\r
-       int indexOf = 0;\r
-       \r
-       String strToBeReplaced(L"\\'");\r
-       int strLen = strToBeReplaced.GetLength();\r
-       int startIndex = 0;\r
-\r
-       while(E_SUCCESS == __inputExpr.IndexOf(strToBeReplaced,startIndex,indexOf))\r
-       {\r
-               int lenAfterSubStr = indexOf + strLen;\r
-               while ((lenAfterSubStr < __inputExpr.GetLength()) && (__inputExpr[lenAfterSubStr] == ' '))\r
-               {\r
-                       lenAfterSubStr++;\r
-               }\r
-               if ((lenAfterSubStr < __inputExpr.GetLength()) && ((__inputExpr[lenAfterSubStr] == '\'') ||\r
-                               ((!__inputExpr.StartsWith(L"AND ", lenAfterSubStr)) && (!__inputExpr.StartsWith(L"OR ", lenAfterSubStr)))))\r
-               {\r
-                       r = __inputExpr.Remove(indexOf,strLen);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "Failed to perform Remove operation.");\r
-                       r = __inputExpr.Insert(splApostrophe,indexOf);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "Failed to perform Insert operation.");\r
-                       startIndex = indexOf + splApostrophe.GetLength();\r
-               }\r
-               else\r
-               {\r
-                       startIndex = lenAfterSubStr;\r
-               }\r
-       }\r
-\r
-       SysLog(NID_CNT, "__inputExpr after splApostrophe append = %ls", __inputExpr.GetPointer());\r
-\r
-       switch (__contentType)\r
-       {\r
-       case CONTENT_TYPE_OTHER:\r
-               //fall through\r
-       case CONTENT_TYPE_IMAGE:\r
-               r = CheckInvalidColumnInQuery();\r
-               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_INVALID_ARG, "Invalid Column In QueryString.");\r
-               maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;\r
-               break;\r
-       case CONTENT_TYPE_VIDEO:\r
-               r = CheckInvalidColumnInQuery();\r
-               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_INVALID_ARG, "Invalid Column In QueryString.");\r
-               maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;\r
-               break;\r
-       case CONTENT_TYPE_AUDIO:\r
-               //fall through\r
-       case CONTENT_TYPE_ALL:\r
-               maxCols = MAX_QUERY_COLUMNS;\r
-               break;\r
-       default:\r
-               break;\r
-       }\r
-       for (int colIndex = 0; colIndex < maxCols; colIndex++)\r
-       {\r
-               ospColumnName.Clear();\r
-               slpColumnName.Clear();\r
-\r
-               ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;\r
-               slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;\r
-\r
-               ReplaceString(ospColumnName,slpColumnName);\r
-       }\r
-\r
-       // Append ESCAPE '\' for LIKE query\r
-       r = AppendEscapeKeywordForLikeQuery();\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "AppendEscapeKeywordForLikeQuery failed.");\r
-\r
-       r = ReplaceDateTimeStringWithInt();\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_INVALID_ARG, "ReplaceDateTimeStringWithInt failed.");\r
-\r
-       // replace splApostrophe string with actual\r
-       r = __inputExpr.Replace(splApostrophe, "''");\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string Replace failed.");\r
-\r
-       return r;\r
-}\r
-\r
-//This function is to appened ESCAPE keyword for _ and % special characters in LIKE query.\r
-\r
-result\r
-_ContentSearchImpl::AppendEscapeKeywordForLikeQuery(void) const\r
-{\r
-       String  delim = L"'"; //Delimeters  is  ' .\r
-       result r = E_SUCCESS;\r
-       bool isCol = true;\r
-       bool isAppendEscape = false;\r
-       String token;\r
-       String tokenUpper;\r
-       String inputExpr = __inputExpr;\r
-\r
-       // Create a StringTokenizer instance\r
-       StringTokenizer  strTok(inputExpr, delim);\r
-\r
-       inputExpr.Clear();\r
-\r
-       while (strTok.HasMoreTokens())\r
-       {\r
-               r = strTok.GetNextToken(token);\r
-               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "GetNextToken failed.");\r
-               if (isCol) //column name\r
-               {\r
-                       isCol = false;\r
-                       tokenUpper = token;\r
-                       tokenUpper.ToUpper();\r
-                       if (tokenUpper.Contains(" LIKE"))\r
-                       {\r
-                               isAppendEscape = true;\r
-                       }\r
-                       else\r
-                       {\r
-                               isAppendEscape = false;\r
-                       }\r
-                       r = inputExpr.Append(token);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-               }\r
-               else // value of the column\r
-               {\r
-                       isCol = true;\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                       r = inputExpr.Append(token);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-\r
-                       if (isAppendEscape)\r
-                       {\r
-                               if (token.Contains("\\_") || token.Contains("\\%"))\r
-                               {\r
-                                       r = inputExpr.Append("ESCAPE'\\'  ");\r
-                                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       __inputExpr.Clear();\r
-       r = __inputExpr.Insert(inputExpr, 0);\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string insert failed.");\r
-\r
-       return r;\r
-}\r
-\r
-//This function is to replace DateTime value(osp datetime type is string) which is string with int.(SLP dateTime column type is int)\r
-\r
-result\r
-_ContentSearchImpl::ReplaceDateTimeStringWithInt(void) const\r
-{\r
-       String  delim = L"'"; //Delimeters  is  ' .\r
-       result r = E_SUCCESS;\r
-       bool isCol = true;\r
-       bool isConvertReq = false;\r
-       bool isBetweenExistsInDateTimeQuery = false;\r
-       String token;\r
-       String tokenUpper;\r
-       String inputExpr = __inputExpr;\r
-\r
-       if(!inputExpr.Contains("MEDIA_ADDED_TIME"))\r
-       {\r
-               return r;\r
-       }\r
-\r
-       // Create a StringTokenizer instance\r
-       StringTokenizer  strTok(inputExpr, delim);\r
-\r
-       inputExpr.Clear();\r
-\r
-       while (strTok.HasMoreTokens())\r
-       {\r
-               r = strTok.GetNextToken(token);\r
-               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "GetNextToken failed.");\r
-               if (isCol) //column name\r
-               {\r
-                       isCol = false;\r
-                       tokenUpper = token;\r
-                       tokenUpper.ToUpper();\r
-                       if(isBetweenExistsInDateTimeQuery)\r
-                       {\r
-                               isBetweenExistsInDateTimeQuery = false;\r
-                               isConvertReq = true;\r
-                       }\r
-                       else\r
-                       {\r
-                               if (tokenUpper.Contains("MEDIA_ADDED_TIME"))\r
-                               {\r
-                                       if (tokenUpper.Contains("BETWEEN"))\r
-                                       {\r
-                                               isBetweenExistsInDateTimeQuery = true;\r
-                                       }\r
-                                       isConvertReq = true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       isConvertReq = false;\r
-                               }\r
-                       }\r
-\r
-                       r = inputExpr.Append(token);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");\r
-               }\r
-               else // value of the column\r
-               {\r
-                       isCol = true;\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");\r
-\r
-                       if (isConvertReq)\r
-                       {\r
-                               Tizen::Base::DateTime dt;\r
-                               r = Tizen::Base::DateTime::Parse(token, dt);\r
-                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to parse DateTime.");\r
-\r
-                               int year = dt.GetYear();\r
-                               int month = dt.GetMonth(); \r
-                               int day = dt.GetDay();\r
-                               int hour = dt.GetHour();\r
-                               int minute = dt.GetMinute(); \r
-                               int second = dt.GetSecond();\r
-                               \r
-                               time_t rawTime;\r
-                               struct tm* timeInfo;\r
-\r
-                               time(&rawTime);\r
-                               timeInfo = localtime(&rawTime);\r
-                               timeInfo->tm_year = year - 1900;\r
-                               timeInfo->tm_mon = month - 1;\r
-                               timeInfo->tm_mday = day;\r
-                               timeInfo->tm_hour = hour;\r
-                               timeInfo->tm_min = minute;\r
-                               timeInfo->tm_sec = second;\r
-\r
-                               time_t seconds = mktime(timeInfo);\r
-                               SysTryReturnResult(NID_CNT, seconds != -1, E_INVALID_ARG, "Failed to convert DateTime to broken-down time.");\r
-\r
-                               long long ticksInSeconds = (long long)seconds;\r
-\r
-                               r = inputExpr.Append(ticksInSeconds);\r
-                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");\r
-                       }\r
-                       else\r
-                       {\r
-                               r = inputExpr.Append(token);\r
-                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");\r
-                       }\r
-\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");\r
-               }\r
-       }\r
-\r
-       __inputExpr.Clear();\r
-       r = __inputExpr.Insert(inputExpr, 0);\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string insert failed.");\r
-\r
-       return r;\r
-}\r
-\r
-// CONTENT_TYPE_OTHER and CONTENT_TYPE_IMAGE (0 - 13 ) are valid columns\r
-// CONTENT_TYPE_VIDEO  (0 - 16 ) are valid columns\r
-// CONTENT_TYPE_ALL and  CONTENT_TYPE_VIDEO (0 - 18 ) are valid columns\r
-// This functions checks for invalid column in the given input string (only allowed columns should be used by content type other wise\r
-// E_INVALID_ARG is returned)\r
-// StringTokenizer is used to parse input expression, by using delimater "'", to differentiate column and value.\r
-// As values may also contain column names\r
-// Ex: 1. where author = syam_author_01 2. where album = jalsa_album_name_01.\r
-\r
-result\r
-_ContentSearchImpl::CheckInvalidColumnInQuery(void) const\r
-{\r
-       result r = E_SUCCESS;\r
-       int tokenNo = 0;\r
-       String  delim = L"'"; //Delimeters  is  ' .\r
-        bool isColReplaceReq = true;\r
-       String token;\r
-       String inputExpr = __inputExpr;\r
-\r
-       // Create a StringTokenizer instance\r
-       StringTokenizer  strTok(inputExpr, delim);\r
-\r
-       inputExpr.Clear();\r
-\r
-       while (strTok.HasMoreTokens())\r
-       {\r
-               r = strTok.GetNextToken(token);\r
-               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "strTok GetNextToken failed.");\r
-\r
-               SysLog(NID_CNT, "In CheckInvalidColumnInQuery token[%d] = %ls", ++tokenNo, token.GetPointer());\r
-\r
-               if (isColReplaceReq)\r
-               {\r
-                       isColReplaceReq = false;\r
-                       r = inputExpr.Append(token);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                       token.ToUpper();\r
-                       switch (__contentType)\r
-                       {\r
-                       case CONTENT_TYPE_OTHER:\r
-                               //fall through\r
-                       case CONTENT_TYPE_IMAGE:\r
-                               if ((token.Contains("TITLE")) || (token.Contains("ARTIST")) || (token.Contains("GENRE")))\r
-                               {\r
-                                       SysLog(NID_CNT, "Title or Artist or Genre are not valid cloumns for this content type");\r
-                                       return E_INVALID_ARG;\r
-                               }\r
-                               //fall through\r
-                       case CONTENT_TYPE_VIDEO:\r
-                               if ((token.Contains("COMPOSER")) || (token.Contains("ALBUM")))\r
-                               {\r
-                                       SysLog(NID_CNT, "Composer or Album  are not valid cloumns for this content type");\r
-                                       return E_INVALID_ARG;\r
-                               }\r
-                               break;\r
-                       default:\r
-                               break;\r
-                       }\r
-               }\r
-               else\r
-               {\r
-                       isColReplaceReq = true;\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                       r = inputExpr.Append(token);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-               }\r
-       }\r
-       return r;\r
-}\r
-\r
-// It replaces osp column name with slp column name.\r
-// StringTokenizer is used to parse input expression, by using delimater "'", to differentiate column and value.\r
-// As values may also contain column names\r
-// Only column names are replaced but not values(values may contain column names)\r
-// Ex: 1. where author = syam_author_01 2. where album = jalsa_album_name_01.\r
-\r
-result\r
-_ContentSearchImpl::ReplaceString(String ospColumnName, String slpColumnName) const\r
-{\r
-       String  delim = L"'"; //Delimeters  is  ' .\r
-       result r = E_SUCCESS;\r
-        bool isColReplaceReq = true;\r
-       String token;\r
-       String inputExpr = __inputExpr;\r
-\r
-       // Create a StringTokenizer instance\r
-       StringTokenizer  strTok(inputExpr, delim);\r
-\r
-       inputExpr.Clear();\r
-\r
-       while (strTok.HasMoreTokens())\r
-       {\r
-               r = strTok.GetNextToken(token);         // Osp, StringTokenizer, Sample, code\r
-               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string GetNextToken() failed.");\r
-               if (isColReplaceReq) //column name\r
-               {\r
-                       isColReplaceReq = false;\r
-                       r = token.Replace(ospColumnName, slpColumnName);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string replace() failed.");\r
-                       r = inputExpr.Append(token);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-               }\r
-               else // value of the column\r
-               {\r
-                       isColReplaceReq = true;\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                       r = inputExpr.Append(token);\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-                       r = inputExpr.Append("'");\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");\r
-               }\r
-       }\r
-       __inputExpr.Clear();\r
-       r = __inputExpr.Insert(inputExpr, 0);\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string insert() failed.");\r
-\r
-       return r;\r
-}\r
-\r
-//Retuns list of search result for the given expression and content type.\r
-Collection::IList*\r
-_ContentSearchImpl::SearchN(int pageNo, int countPerPage, int& totalPageCount, int& totalCount, const String& whereExpr, const String& sortColumn, SortOrder sortOrder) const\r
-{\r
-       SysLog(NID_CNT, "pageNo = %d, countPerPage = %d, whereExpr = %ls", pageNo, countPerPage, whereExpr.GetPointer());\r
-\r
-       ClearLastResult();\r
-\r
-       result r        = E_SUCCESS;\r
-       int ret         = MEDIA_CONTENT_ERROR_NONE;\r
-       int offset      = 0;\r
-\r
-       __inputColumnName.Clear();\r
-       __inputExpr.Clear();\r
-       __inputColumnName = sortColumn;\r
-       __inputSortOrder = sortOrder;\r
-       totalPageCount = 0;\r
-       totalCount = 0;\r
-\r
-       if (!whereExpr.IsEmpty()) // copy whereExpr if not empty to class variable __inputExpr\r
-       {\r
-               //r = __inputExpr.Format(QUERY_LENGTH, L"%ls", whereExpr.GetPointer());\r
-               r = __inputExpr.Append(whereExpr);\r
-               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] __inputExpr.Append Failed as whereExpr is not empty.", GetErrorMessage(r));\r
-\r
-               r = ReplaceOspColumnNameWithSlp();\r
-               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] ReplaceOspColumnNameWithSlp for InputExpr Failed.", GetErrorMessage(r));\r
-\r
-               SysLog(NID_CNT, "After replace __inputExpr = %ls", __inputExpr.GetPointer());\r
-       }\r
-       if ((__inputColumnName.IsEmpty()) && ((__inputSortOrder == SORT_ORDER_ASCENDING) || (__inputSortOrder == SORT_ORDER_DESCENDING)))\r
-       {\r
-               SysLog(NID_CNT, "sort column name is empty and sort oder is not none. so,E_INVALID_ARG occured.");\r
-               SetLastResult(E_INVALID_ARG);\r
-               return null;\r
-       }\r
-       else\r
-       {\r
-               std::unique_ptr<ArrayList, AllElementsDeleter> pFinalOutList(new (std::nothrow) ArrayList());\r
-               SysTryReturn(NID_CNT, pFinalOutList.get() != null, NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");\r
-\r
-               r = pFinalOutList->Construct();\r
-               SysTryReturn(NID_CNT, !IsFailed(r), NULL, r, "[%s] Failed to construct ArrayList.", GetErrorMessage(r));\r
-\r
-               __pFinalOutList = std::move(pFinalOutList);\r
-\r
-               r = CreateQueryFilter(true);\r
-               SysTryReturn(NID_CNT, !IsFailed(r), NULL, r, "[%s] Failed to perform CreateQueryFilter operation.", GetErrorMessage(r));\r
-\r
-               ret = media_info_get_media_count_from_db(__pFilterHandle.get(), &totalCount);\r
-               r = MapCoreErrorToNativeResult(ret);\r
-               SysTryReturn(NID_CNT, r == E_SUCCESS , NULL, r, "[%s] Failed to perform media_info_get_media_count_from_db operation.", GetErrorMessage(r));\r
-\r
-               SysLog(NID_CNT, "totalCount is [%d] for media_info_get_media_count_from_db", totalCount);\r
-\r
-               if (totalCount > 0)\r
-               {\r
-                       if ((totalCount % countPerPage) == 0)\r
-                       {\r
-                               totalPageCount = totalCount / countPerPage;\r
-                       }\r
-                       else\r
-                       {\r
-                               totalPageCount = (totalCount / countPerPage) + 1;\r
-                       }\r
-\r
-                       SysTryReturn(NID_CNT, ((pageNo >= 1) && (pageNo <= totalPageCount)) , NULL, E_INVALID_ARG, "[E_INVALID_ARG] (pageNo < 1) || (pageNo > totalPageCount).");\r
-\r
-                       offset = (pageNo * countPerPage) - countPerPage;\r
-\r
-                       SysLog(NID_CNT, " SearchN   totalCount [%d] totalPageCount[%d] __countPerPage[%d] __pageNo[%d] offset[%d]",\r
-                                       totalCount, totalPageCount, countPerPage, pageNo, offset);\r
-\r
-                       ret = media_filter_set_offset(__pFilterHandle.get(), offset, countPerPage);\r
-                       r = MapCoreErrorToNativeResult(ret);\r
-                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r,\r
-                       "[%s] Failed to perform media_filter_set_offset operation.", GetErrorMessage(r));\r
-\r
-                       r = ExecuteAndFillFinalOutList();\r
-                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, E_SYSTEM, "[E_SYSTEM] ExecuteAndFillFinalOutList Failed.");\r
-               }\r
-               else if (pageNo > 1)\r
-               {\r
-                       r = E_INVALID_ARG;\r
-                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[E_INVALID_ARG] (pageNo > 1) and  (totalcount = 0).");\r
-               }\r
-       }\r
-       SetLastResult(r);\r
-       return __pFinalOutList.release();\r
-}\r
-\r
-// Fills final result list\r
-result\r
-_ContentSearchImpl::ExecuteAndFillFinalOutList(void) const\r
-{\r
-       SysLog(NID_CNT, "Enter\n");\r
-\r
-       int ret                                         = MEDIA_CONTENT_ERROR_NONE;\r
-       result r                                        = E_SUCCESS;\r
-\r
-       std::unique_ptr<GList, SearchGListDeleter> pItemList;\r
-       GList* pTemp = NULL;\r
-       std::unique_ptr<media_info_s, SearchMediaHandleDeleter> pMediaHandle;\r
-\r
-       ContentInfo::_ContentData* pContentData = null;\r
-       ImageContentInfo::_ImageContentData* pImageContentData = null;\r
-       AudioContentInfo::_AudioContentData* pAudioContentData = null;\r
-       VideoContentInfo::_VideoContentData* pVideoContentData = null;\r
-\r
-       std::unique_ptr<ImageContentInfo> pImageContentInfo;\r
-       std::unique_ptr<AudioContentInfo> pAudioContentInfo;\r
-       std::unique_ptr<VideoContentInfo> pVideoContentInfo;\r
-       std::unique_ptr<OtherContentInfo> pOtherContentInfo;\r
-\r
-       std::unique_ptr<ContentSearchResult> pContentSearchResult;\r
-\r
-       pTemp = pItemList.get();\r
-\r
-       ret = media_info_foreach_media_from_db(__pFilterHandle.get(), MediaItemCb, &pTemp);\r
-       r = MapCoreErrorToNativeResult(ret);\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform media_info_foreach_media_from_db operation.");\r
-\r
-       SysTryReturnResult(NID_CNT, pTemp != NULL, r, "media_info_foreach_media_from_db pTemp is null.");\r
-\r
-       media_content_type_e mediaType = MEDIA_CONTENT_TYPE_OTHERS;\r
-\r
-       for (int idx = 0; idx < (int)g_list_length(pTemp); idx++)\r
-       {\r
-               pMediaHandle.reset(static_cast<media_info_h>(g_list_nth_data(pTemp, idx)));\r
-\r
-               ret = media_info_get_media_type(pMediaHandle.get(), &mediaType);\r
-               r = MapCoreErrorToNativeResult(ret);\r
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_info_get_media_type.");\r
-\r
-               switch (mediaType)\r
-               {\r
-               case MEDIA_CONTENT_TYPE_OTHERS:\r
-                       //memset(&contentData, 0, sizeof(contentData));\r
-\r
-                       pOtherContentInfo = std::unique_ptr<OtherContentInfo>(new (std::nothrow) OtherContentInfo);\r
-                       SysTryReturnResult(NID_CNT, pOtherContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pOtherContentInfo.");\r
-\r
-                       pContentData = pOtherContentInfo->GetContentData();\r
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
-\r
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");\r
-\r
-\r
-                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);\r
-                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");\r
-\r
-                       pContentSearchResult->SetContentType(CONTENT_TYPE_OTHER);\r
-                       pContentSearchResult->SetContentInfo(pOtherContentInfo.release());\r
-\r
-                       // Shallow copy, adds just the pointer: not the element\r
-\r
-                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");\r
-\r
-                       //pOtherContentInfo = null;\r
-                       //pContentSearchResult = null;\r
-                       //_ContentUtility::DeleteContentData(&contentData);\r
-                       break;\r
-               case MEDIA_CONTENT_TYPE_IMAGE:\r
-                       //memset(&contentData, 0, sizeof(contentData));\r
-                       //memset(&imageContentData, 0, sizeof(imageContentData));\r
-\r
-                       pImageContentInfo = std::unique_ptr<ImageContentInfo>(new (std::nothrow) ImageContentInfo);\r
-                       SysTryReturnResult(NID_CNT, pImageContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pImageContentInfo.");\r
-\r
-                       pContentData = pImageContentInfo->GetContentData();\r
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
-\r
-                       pImageContentData = pImageContentInfo->GetImageContentData();\r
-                       SysTryReturnResult(NID_CNT, pImageContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
-\r
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");\r
-\r
-                       r = _ContentUtility::FillImageContentData(pMediaHandle.get(), pImageContentData);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform GetDataFromImageTable operation.");\r
-\r
-                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);\r
-                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");\r
-\r
-                       pContentSearchResult->SetContentType(CONTENT_TYPE_IMAGE);\r
-                       pContentSearchResult->SetContentInfo(pImageContentInfo.release());\r
-\r
-                       // Shallow copy, adds just the pointer: not the element\r
-\r
-                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");\r
-                       //pImageContentInfo = null;\r
-                       //pContentSearchResult = null;\r
-                       //_ContentUtility::DeleteContentData(&contentData);\r
-                       break;\r
-               case MEDIA_CONTENT_TYPE_MUSIC:\r
-                       //fall through\r
-               case MEDIA_CONTENT_TYPE_SOUND:\r
-                       //memset(&contentData, 0, sizeof(contentData));\r
-                       //memset(&audioContentData, 0, sizeof(audioContentData));\r
-\r
-                       pAudioContentInfo = std::unique_ptr<AudioContentInfo>(new (std::nothrow) AudioContentInfo);\r
-                       SysTryReturnResult(NID_CNT, pAudioContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pAudioContentInfo.");\r
-\r
-                       pContentData = pAudioContentInfo->GetContentData();\r
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
-\r
-                       pAudioContentData = pAudioContentInfo->GetAudioContentData();\r
-                       SysTryReturnResult(NID_CNT, pAudioContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
-\r
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");\r
-\r
-                       r = _ContentUtility::FillAudioContentData(pMediaHandle.get(), pAudioContentData);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillAudioContentData operation.");\r
-\r
-                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);\r
-                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");\r
-\r
-                       pContentSearchResult->SetContentType(CONTENT_TYPE_AUDIO);\r
-                       pContentSearchResult->SetContentInfo(pAudioContentInfo.release());\r
-\r
-                       // Shallow copy, adds just the pointer: not the element\r
-\r
-                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");\r
-\r
-                       //pAudioContentInfo = null;\r
-                       //pContentSearchResult = null;\r
-                       //_ContentUtility::DeleteContentData(&contentData);\r
-                       //_ContentUtility::DeleteAudioContentData(&audioContentData);\r
-                       break;\r
-               case MEDIA_CONTENT_TYPE_VIDEO:\r
-                       //memset(&contentData, 0, sizeof(contentData));\r
-                       //memset(&videoContentData, 0, sizeof(videoContentData));\r
-\r
-                       pVideoContentInfo = std::unique_ptr<VideoContentInfo>(new (std::nothrow) VideoContentInfo);\r
-                       SysTryReturnResult(NID_CNT, pVideoContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pVideoContentInfo.");\r
-\r
-                       pContentData = pVideoContentInfo->GetContentData();\r
-                       SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
-\r
-                       pVideoContentData = pVideoContentInfo->GetVideoContentData();\r
-                       SysTryReturnResult(NID_CNT, pVideoContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
-\r
-                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");\r
-\r
-                       r = _ContentUtility::FillVideoContentData(pMediaHandle.get(), pVideoContentData);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillVideoContentData operation.");\r
-\r
-                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);\r
-                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");\r
-\r
-                       pContentSearchResult->SetContentType(CONTENT_TYPE_VIDEO);\r
-                       pContentSearchResult->SetContentInfo(pVideoContentInfo.release());\r
-\r
-                       // Shallow copy, adds just the pointer: not the element\r
-\r
-                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");\r
-\r
-                       //pVideoContentInfo = null;\r
-                       //pContentSearchResult = null;\r
-                       //_ContentUtility::DeleteContentData(&contentData);\r
-                       //_ContentUtility::DeleteVideoContentData(&videoContentData);\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-       }\r
-       return r;\r
-}\r
-\r
-// returns  given column value list in the requested order\r
-Collection::IList*\r
-_ContentSearchImpl::GetValueListN(const String& sortColumn, SortOrder sortOrder)\r
-{\r
-       SysLog(NID_CNT, "inputColumn = %ls", sortColumn.GetPointer());\r
-       ClearLastResult();\r
-\r
-       result r        = E_SUCCESS;\r
-       int colIndex    = 0;\r
-       int maxCols     = 0;\r
-\r
-       __inputColumnName.Clear();\r
-       __inputExpr.Clear();\r
-\r
-       __inputColumnName = sortColumn;\r
-       __inputSortOrder  = sortOrder;\r
-\r
-       String          ospColumnName(L"");\r
-       String          slpColumnName(L"");\r
-\r
-       String          columnName(__inputColumnName);\r
-\r
-       if ((__inputColumnName.IsEmpty()) && ((__inputSortOrder == SORT_ORDER_ASCENDING) || (__inputSortOrder == SORT_ORDER_DESCENDING)))\r
-       {\r
-               SysLog(NID_CNT, "sort column name is empty and sort oder is not none. so,E_INVALID_ARG occured.");\r
-               SetLastResult(E_INVALID_ARG);\r
-               return null;\r
-       }\r
-       else\r
-       {\r
-               std::unique_ptr<ArrayList, AllElementsDeleter> pFinalOutList(new (std::nothrow) ArrayList());\r
-               SysTryReturn(NID_CNT, pFinalOutList.get() != null, NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");\r
-\r
-               r = pFinalOutList->Construct();\r
-               SysTryReturn(NID_CNT, !IsFailed(r), NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");\r
-\r
-               __pFinalOutList = std::move(pFinalOutList);\r
-\r
-               switch (__contentType)\r
-               {\r
-               case CONTENT_TYPE_OTHER:\r
-                       //fall through\r
-               case CONTENT_TYPE_IMAGE:\r
-                       maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;\r
-                       break;\r
-               case CONTENT_TYPE_VIDEO:\r
-                       maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;\r
-                       break;\r
-               case CONTENT_TYPE_AUDIO:\r
-                       //fall through\r
-               case CONTENT_TYPE_ALL:\r
-                       maxCols = MAX_QUERY_COLUMNS;\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-\r
-               for (colIndex = 0; colIndex < maxCols; colIndex++)\r
-               {\r
-                       ospColumnName.Clear();\r
-                       slpColumnName.Clear();\r
-\r
-                       ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;\r
-                       slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;\r
-\r
-                       ospColumnName.ToUpper();\r
-                       columnName.ToUpper();\r
-                       if (columnName == ospColumnName)\r
-                       {\r
-                               r = FillColumnsList(colIndex);\r
-                               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] FillColumnsList Failed.", GetErrorMessage(r));\r
-                               break;\r
-                       }\r
-               }\r
-               if (colIndex == maxCols)\r
-               {\r
-                       r = E_INVALID_ARG;\r
-                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[E_INVALID_ARG] invalid column.");\r
-               }\r
-       }\r
-       SetLastResult(r);\r
-       return __pFinalOutList.release();\r
-}\r
-\r
-// returns  given column value list in the requested order\r
-Collection::IList*\r
-_ContentSearchImpl::GetValueListN(int pageNo, int countPerPage, int& totalPageCount, int& totalCount, const String& sortColumn, SortOrder sortOrder) const\r
-{\r
-       SysLog(NID_CNT, "pageNo = %d, countPerPage = %d, inputColumn = %ls", pageNo, countPerPage, sortColumn.GetPointer());\r
-\r
-       ClearLastResult();\r
-\r
-       result r        = E_SUCCESS;\r
-       int colIndex    = 0;\r
-       int maxCols     = 0;\r
-\r
-       __inputColumnName.Clear();\r
-       __inputExpr.Clear();\r
-\r
-       __inputColumnName = sortColumn;\r
-       __inputSortOrder  = sortOrder;\r
-\r
-       String          ospColumnName(L"");\r
-       String          slpColumnName(L"");\r
-\r
-       String          columnName(__inputColumnName);\r
-\r
-       if ((__inputColumnName.IsEmpty()) && ((__inputSortOrder == SORT_ORDER_ASCENDING) || (__inputSortOrder == SORT_ORDER_DESCENDING)))\r
-       {\r
-               SysLog(NID_CNT, "sort column name is empty and sort oder is not none. so,E_INVALID_ARG occured.");\r
-               SetLastResult(E_INVALID_ARG);\r
-               return null;\r
-       }\r
-       else\r
-       {\r
-               std::unique_ptr<ArrayList, AllElementsDeleter> pFinalOutList(new (std::nothrow) ArrayList());\r
-               SysTryReturn(NID_CNT, pFinalOutList.get() != null, NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");\r
-\r
-               r = pFinalOutList->Construct();\r
-               SysTryReturn(NID_CNT, !IsFailed(r), NULL, r, "[%s] Failed to construct ArrayList.", GetErrorMessage(r));\r
-\r
-               __pFinalOutList = std::move(pFinalOutList);\r
-\r
-               switch (__contentType)\r
-               {\r
-               case CONTENT_TYPE_OTHER:\r
-                       //fall through\r
-               case CONTENT_TYPE_IMAGE:\r
-                       maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;\r
-                       break;\r
-               case CONTENT_TYPE_VIDEO:\r
-                       maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;\r
-                       break;\r
-               case CONTENT_TYPE_AUDIO:\r
-                       //fall through\r
-               case CONTENT_TYPE_ALL:\r
-                       maxCols = MAX_QUERY_COLUMNS;\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-\r
-               for (colIndex = 0; colIndex < maxCols; colIndex++)\r
-               {\r
-                       ospColumnName.Clear();\r
-                       slpColumnName.Clear();\r
-\r
-                       ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;\r
-                       slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;\r
-\r
-                       ospColumnName.ToUpper();\r
-                       columnName.ToUpper();\r
-                       if (columnName == ospColumnName)\r
-                       {\r
-                               r = FillColumnsList(pageNo, countPerPage, totalPageCount, totalCount, colIndex);\r
-                               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] FillColumnsList Failed.", GetErrorMessage(r));\r
-                               break;\r
-                       }\r
-               }\r
-               if (colIndex == maxCols)\r
-               {\r
-                       r = E_INVALID_ARG;\r
-                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[E_INVALID_ARG] invalid column.");\r
-               }\r
-       }\r
-       SetLastResult(r);\r
-       return __pFinalOutList.release();\r
-}\r
-\r
-// prepares query expression to be used in group api. colIndex is mapped to actual group value.\r
-media_group_e\r
-_ContentSearchImpl::GetIndexAndCreateQueryExp(int colIndex) const\r
-{\r
-       media_group_e groupIndex = MEDIA_CONTENT_GROUP_DISPLAY_NAME;;\r
-       switch (colIndex)\r
-       {\r
-       case 0://"ContentType", "MEDIA_TYPE"\r
-               groupIndex = MEDIA_CONTENT_GROUP_TYPE;\r
-               __inputExpr = "MEDIA_TYPE IS NOT NULL";\r
-               break;\r
-       case 1://"ContentFileName", "MEDIA_DISPLAY_NAME"\r
-               groupIndex = MEDIA_CONTENT_GROUP_DISPLAY_NAME;\r
-               __inputExpr = "MEDIA_DISPLAY_NAME IS NOT NULL";\r
-               break;\r
-       case 2://"ContentName", "MEDIA_CONTENT_NAME"\r
-               groupIndex = MEDIA_CONTENT_GROUP_CONTENT_NAME;\r
-               __inputExpr = "MEDIA_CONTENT_NAME IS NOT NULL";\r
-               break;\r
-       case 3://"Category", "MEDIA_CATEGORY"\r
-               groupIndex = MEDIA_CONTENT_GROUP_CATEGORY;\r
-               __inputExpr = "MEDIA_CATEGORY IS NOT NULL";\r
-               break;\r
-       case 4://"Author", "MEDIA_AUTHOR"\r
-               groupIndex = MEDIA_CONTENT_GROUP_AUTHOR;\r
-               __inputExpr = "MEDIA_AUTHOR IS NOT NULL";\r
-               break;\r
-       case 5://"keyword", "MEDIA_KEYWORD"\r
-               groupIndex = MEDIA_CONTENT_GROUP_KEYWORD;\r
-               __inputExpr = "MEDIA_KEYWORD IS NOT NULL";\r
-               break;\r
-       case 6://"Provider", "MEDIA_PROVIDER"\r
-               groupIndex = MEDIA_CONTENT_GROUP_PROVIDER;\r
-               __inputExpr = "MEDIA_PROVIDER IS NOT NULL";\r
-               break;\r
-       case 7://"Rating", "MEDIA_AGE_RATING"\r
-               groupIndex = MEDIA_CONTENT_GROUP_AGE_RATING;\r
-               __inputExpr = "MEDIA_AGE_RATING IS NOT NULL";\r
-               break;\r
-       case 8://"LocationTag", "MEDIA_LOCATION_TAG"\r
-               groupIndex = MEDIA_CONTENT_GROUP_LOCATION_TAG;\r
-               __inputExpr = "MEDIA_LOCATION_TAG IS NOT NULL";\r
-               break;\r
-       case 9://"ContentSize", "MEDIA_SIZE"\r
-               groupIndex = MEDIA_CONTENT_GROUP_SIZE;\r
-               __inputExpr = "MEDIA_SIZE IS NOT NULL";\r
-               break;\r
-       case 10://"DateTime", "MEDIA_ADDED_TIME"\r
-               groupIndex = MEDIA_CONTENT_GROUP_ADDED_TIME;\r
-               __inputExpr = "MEDIA_ADDED_TIME IS NOT NULL";\r
-               break;\r
-       case 11://"Latitude", "MEDIA_LATITUDE"\r
-               groupIndex = MEDIA_CONTENT_GROUP_LATITUDE;\r
-               __inputExpr = "MEDIA_LATITUDE IS NOT NULL";\r
-               break;\r
-       case 12://"Longitude", "MEDIA_LONGITUDE"\r
-               groupIndex = MEDIA_CONTENT_GROUP_LONGITUDE;\r
-               __inputExpr = "MEDIA_LONGITUDE IS NOT NULL";\r
-               break;\r
-       case 13://"Altitude", "MEDIA_ALTITUDE"\r
-               groupIndex = MEDIA_CONTENT_GROUP_ALTITUDE;\r
-               __inputExpr = "MEDIA_ALTITUDE IS NOT NULL";\r
-               break;\r
-       case 14://"Title", "MEDIA_TITLE"\r
-               groupIndex = MEDIA_CONTENT_GROUP_TITLE;\r
-               __inputExpr = "MEDIA_TITLE IS NOT NULL";\r
-               break;\r
-       case 15://"Artist", "MEDIA_ARTIST"\r
-               groupIndex = MEDIA_CONTENT_GROUP_ARTIST;\r
-               __inputExpr = "MEDIA_ARTIST IS NOT NULL";\r
-               break;\r
-       case 16://"Genre", "MEDIA_GENRE"\r
-               groupIndex = MEDIA_CONTENT_GROUP_GENRE;\r
-               __inputExpr = "MEDIA_GENRE IS NOT NULL";\r
-               break;\r
-       case 17://"Year", "MEDIA_YEAR"\r
-               groupIndex = MEDIA_CONTENT_GROUP_YEAR;\r
-               __inputExpr = "MEDIA_YEAR IS NOT NULL";\r
-               break;\r
-       case 18://"Composer", "MEDIA_COMPOSER"\r
-               groupIndex = MEDIA_CONTENT_GROUP_COMPOSER;\r
-               __inputExpr = "MEDIA_COMPOSER IS NOT NULL";\r
-               break;\r
-       case 19://"Album", "MEDIA_ALBUM"\r
-               __inputExpr = "MEDIA_ALBUM IS NOT NULL";\r
-               break;\r
-       default:\r
-               break;\r
-       }\r
-       return groupIndex;\r
-}\r
-\r
-// Fills  given column value list and destroys filter handle\r
-result\r
-_ContentSearchImpl::FillColumnsList(int colIndex) const\r
-{\r
-       result r        = E_SUCCESS;\r
-       int ret         = MEDIA_CONTENT_ERROR_NONE;\r
-       int totalCount  = 0;\r
-       media_group_e groupIndex = GetIndexAndCreateQueryExp(colIndex);\r
-\r
-       r = CreateQueryFilter(true);\r
-       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "CreateQueryFilter Failed.");\r
-\r
-       if (colIndex == ALBUM_COLUMN_NUM)\r
-       {\r
-               ret = media_album_get_album_count_from_db(__pFilterHandle.get(), &totalCount);\r
-       }\r
-       else\r
-       {\r
-               ret = media_group_get_group_count_from_db(__pFilterHandle.get(), groupIndex, &totalCount);\r
-       }\r
-       r = MapCoreErrorToNativeResult(ret);\r
-       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "Failed to perform media_album/group count_from_db operation.");\r
-\r
-       SysLog(NID_CNT, "totalCount = %d for media_album/group count_from_db", totalCount);\r
-\r
-       if (totalCount > 0)\r
-       {\r
-               if (colIndex == ALBUM_COLUMN_NUM)\r
-               {\r
-                       r = ExecuteAndFillAlbumValues();\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillAlbumValues Failed.");\r
-               }\r
-               else\r
-               {\r
-                       r = ExecuteAndFillGetValueListN(groupIndex, colIndex);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillGetValueListN Failed.");\r
-               }\r
-       }\r
-       return r;\r
-}\r
-\r
-// prepares input expression to be sent for create filter and fills  given column value list\r
-result\r
-_ContentSearchImpl::FillColumnsList(int pageNo, int countPerPage, int& totalPageCount, int& totalCount, int colIndex) const\r
-{\r
-       result r        = E_SUCCESS;\r
-       int ret         = MEDIA_CONTENT_ERROR_NONE;\r
-       int offset      = 0;\r
-       totalPageCount = 0;\r
-       totalCount = 0;\r
-       media_group_e groupIndex = GetIndexAndCreateQueryExp(colIndex);\r
-\r
-       r = CreateQueryFilter(true);\r
-       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "CreateQueryFilter Failed.");\r
-\r
-       if (colIndex == ALBUM_COLUMN_NUM)\r
-       {\r
-               ret = media_album_get_album_count_from_db(__pFilterHandle.get(), &totalCount);\r
-       }\r
-       else\r
-       {\r
-               ret = media_group_get_group_count_from_db(__pFilterHandle.get(), groupIndex, &totalCount);\r
-       }\r
-       r = MapCoreErrorToNativeResult(ret);\r
-       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "Failed to perform media_album/group count_from_db operation.");\r
-\r
-       SysLog(NID_CNT, "totalCount = %d for media_album/group count_from_db", totalCount);\r
-\r
-       if (totalCount > 0)\r
-       {\r
-               if ((totalCount % countPerPage) == 0)\r
-               {\r
-                       totalPageCount = totalCount / countPerPage;\r
-               }\r
-               else\r
-               {\r
-                       totalPageCount = (totalCount / countPerPage) + 1;\r
-               }\r
-\r
-               if ((pageNo < 1) || (pageNo > totalPageCount))\r
-               {\r
-                       r = E_INVALID_ARG;\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "(pageNo < 1) || (pageNo > totalPageCount).");\r
-               }\r
-\r
-               offset = (pageNo * countPerPage) - countPerPage;\r
-\r
-               SysLog(NID_CNT, "GetValueListN totalCount [%d] totalPageCount[%d] __countPerPage[%d] __pageNo[%d] offset[%d]",\r
-                               totalCount, totalPageCount, countPerPage, pageNo, offset);\r
-\r
-               ret = media_filter_set_offset(__pFilterHandle.get(),offset,countPerPage);\r
-               r = MapCoreErrorToNativeResult(ret);\r
-               SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "failed to perform media_filter_set_offset operation.");\r
-\r
-               if (colIndex == ALBUM_COLUMN_NUM)\r
-               {\r
-                       r = ExecuteAndFillAlbumValues();\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillAlbumValues Failed.");\r
-               }\r
-               else\r
-               {\r
-                       r = ExecuteAndFillGetValueListN(groupIndex, colIndex);\r
-                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillGetValueListN Failed.");\r
-               }\r
-\r
-       }\r
-       else if (pageNo > 1)\r
-       {\r
-               r = E_INVALID_ARG;\r
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "(pageNo > 1) and  (totalcount = 0).");\r
-       }\r
-\r
-       return r;\r
-}\r
-\r
-//  fills  given column value list for GetValuelistN api\r
-result\r
-_ContentSearchImpl::ExecuteAndFillGetValueListN(media_group_e groupIndex, int colIndex) const\r
-{\r
-       SysLog(NID_CNT, "Enter\n");\r
-\r
-       int ret                     = MEDIA_CONTENT_ERROR_NONE;\r
-       result r                    = E_SUCCESS;\r
-       result res                  = E_SUCCESS;\r
-       std::unique_ptr<GList, SearchGListDeleter> pItemList;\r
-       GList* pTemp = NULL;\r
-\r
-       std::unique_ptr<Object> pValue;\r
-\r
-       DateTime dateTime;\r
-\r
-       long long contentSize = 0;\r
-       long long addedTime     = 0;\r
-\r
-       double dVal     = 0;\r
-       char *pColumnVal = null;\r
-       int contentType = 0;\r
-\r
-       pTemp = pItemList.get();\r
-\r
-       ret = media_group_foreach_group_from_db(__pFilterHandle.get(), groupIndex, GroupItemCb, &pTemp);\r
-       r = MapCoreErrorToNativeResult(ret);\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform media_group_foreach_group_from_db operation.");\r
-\r
-       SysTryReturnResult(NID_CNT, pTemp != NULL, r, "media_info_foreach_media_from_db pTemp is null.");\r
-\r
-       for (int idx = 0; idx < (int)g_list_length(pTemp); idx++)\r
-       {\r
-               SysLog(NID_CNT, "idx = %d and (int)g_list_length(pItemList) = %d", idx, (int)g_list_length(pTemp));\r
-\r
-               pColumnVal = (char *)g_list_nth_data(pTemp, idx);\r
-\r
-               String strColVal(pColumnVal);\r
-\r
-               _ContentUtility::DoSafeFree(pColumnVal);\r
-\r
-               SysLog(NID_CNT, "pColumnVal = %ls", strColVal.GetPointer());\r
-\r
-               switch (colIndex)\r
-               {\r
-               case 0://"ContentType", "MEDIA_TYPE"\r
-                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))\r
-                       {\r
-                               res = Integer::Parse(strColVal, contentType);\r
-                               SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] Integer parse failed.", GetErrorMessage(res));\r
-                       }\r
-                       switch ((media_content_type_e)contentType)\r
-                       {\r
-                       case MEDIA_CONTENT_TYPE_OTHERS:\r
-                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_OTHER));\r
-                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_OTHER");\r
-                               break;\r
-                       case MEDIA_CONTENT_TYPE_IMAGE:\r
-                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_IMAGE));\r
-                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_IMAGE");\r
-                               break;\r
-                       case MEDIA_CONTENT_TYPE_SOUND:\r
-                               //fall through\r
-                       case MEDIA_CONTENT_TYPE_MUSIC:\r
-                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_AUDIO));\r
-                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_AUDIO");\r
-                               break;\r
-                       case MEDIA_CONTENT_TYPE_VIDEO:\r
-                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_VIDEO));\r
-                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_VIDEO");\r
-                               break;\r
-                       default:\r
-                               break;\r
-                       }\r
-                       break;\r
-               case 1://"ContentFileName", "MEDIA_DISPLAY_NAME"\r
-               //fall through\r
-               case 2://"ContentName", "MEDIA_CONTENT_NAME"\r
-               //fall through\r
-               case 3://"Category", "MEDIA_CATEGORY"\r
-               //fall through\r
-               case 4://"Author", "MEDIA_AUTHOR"\r
-               //fall through\r
-               case 5://"keyword", "MEDIA_KEYWORD"\r
-               //fall through\r
-               case 6://"Provider", "MEDIA_PROVIDER"\r
-               //fall through\r
-               case 7://"Rating", "MEDIA_AGE_RATING"\r
-               //fall through\r
-               case 8://"LocationTag", "MEDIA_LOCATION_TAG"\r
-               //fall through\r
-               case 14://"Title", "MEDIA_TITLE"\r
-               //fall through\r
-               case 15://"Artist", "MEDIA_ARTIST"\r
-               //fall through\r
-               case 16://"Genre", "MEDIA_GENRE"\r
-               //fall through\r
-               case 17://"Year", "MEDIA_YEAR"\r
-               //fall through\r
-               case 18://"Composer", "MEDIA_COMPOSER"\r
-\r
-                       pValue.reset(new (std::nothrow) String(strColVal));\r
-                       break;\r
-\r
-               case 9://"ContentSize", "MEDIA_SIZE" \r
-                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))\r
-                       {\r
-                               res = LongLong::Parse(strColVal, contentSize);\r
-                               SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] LongLong parse failed.", GetErrorMessage(res));\r
-                       }\r
-\r
-                       pValue.reset(new (std::nothrow) LongLong(contentSize));\r
-                       break;\r
-               case 10://"DateTime", "MEDIA_ADDED_TIME" \r
-                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))\r
-                       {\r
-                               res = LongLong::Parse(strColVal, addedTime);\r
-                               SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] LongLong parse failed.", GetErrorMessage(res));\r
-                       }\r
-\r
-                       res = dateTime.SetValue(1970, 1, 1);\r
-                       SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] dateTime.SetValue failed.", GetErrorMessage(res));\r
-\r
-                       res = dateTime.AddSeconds(addedTime);\r
-                       SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] dateTime.AddSeconds failed.", GetErrorMessage(res));\r
-\r
-                       SysLog(NID_CNT, "DateTime : %ls", dateTime.ToString().GetPointer());\r
-\r
-                       pValue.reset(new (std::nothrow) DateTime(dateTime));\r
-\r
-                       break;\r
-               case 11://"Latitude", "MEDIA_LATITUDE"\r
-                       //fall through\r
-               case 12://"Longitude", "MEDIA_LONGITUDE"\r
-                       //fall through\r
-               case 13://"Altitude", "MEDIA_ALTITUDE"\r
-                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))\r
+       SysTryReturnResult(NID_CNT, pFilterHandle != null, E_OUT_OF_MEMORY, "pFilterHandle is null.");
+
+       switch (__contentType)
+       {
+               // Image-0,video-1,sound-2,music-3,other-4
+       case CONTENT_TYPE_OTHER:
+               inputCondition = "MEDIA_TYPE=4 ";
+               break;
+       case CONTENT_TYPE_IMAGE:
+               inputCondition = "MEDIA_TYPE=0 ";
+               break;
+       case CONTENT_TYPE_AUDIO:
+               inputCondition = "(MEDIA_TYPE=2 or MEDIA_TYPE=3) ";
+               break;
+       case CONTENT_TYPE_VIDEO:
+               inputCondition = "MEDIA_TYPE=1 ";
+               break;
+       case CONTENT_TYPE_ALL:
+               //If content type is CONTENT_TYPE_ALL, then MEDIA_TYPE is empty
+               break;
+       default:
+               break;
+       }
+
+       if (!__inputExpr.IsEmpty())
+       {
+               if (isAndAppendReq && (!inputCondition.IsEmpty())) //For CONTENT_TYPE_ALL inputCondition is empty
+               {
+                       r = inputCondition.Append("AND ");
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform append operation.");
+               }
+
+               r = inputCondition.Append(__inputExpr);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform append operation.");
+       }
+
+       if (!inputCondition.IsEmpty())
+       {
+               //CopyToCharArrayN: utility function, converts a osp string to char*
+               pInputCond = std::unique_ptr<char[]>(_StringConverter::CopyToCharArrayN(inputCondition));
+               SysTryReturnResult(NID_CNT, pInputCond, E_OUT_OF_MEMORY, "pInputCond is NULL.");
+
+               SysLog(NID_CNT, "pInputCond = %s", pInputCond.get());
+
+               ret = media_filter_set_condition(pFilterHandle.get(), pInputCond.get(), MEDIA_CONTENT_COLLATE_DEFAULT);
+               SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_set_condition operation.");
+       }
+
+       if (!__inputColumnName.IsEmpty()) // SortColumn is optional in case of SearchN
+       {
+               //__inputColumnName (osp column name) is replaced with slpColumn (slp column name).
+               r = GetSlpColumnName(slpColumn);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform GetSlpColumnName operation.");
+
+               //CopyToCharArrayN: utility function, converts a osp string to char*
+
+               pSortCol = std::unique_ptr<char[]>(_StringConverter::CopyToCharArrayN(slpColumn));
+               SysTryReturnResult(NID_CNT, pSortCol, E_OUT_OF_MEMORY, "pSortCol is NULL.");
+
+               if (__inputSortOrder == SORT_ORDER_ASCENDING)
+               {
+                       ret = media_filter_set_order(pFilterHandle.get(), MEDIA_CONTENT_ORDER_ASC, pSortCol.get(), MEDIA_CONTENT_COLLATE_NOCASE);
+                       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_set_order operation.");
+               }
+               else if (__inputSortOrder == SORT_ORDER_DESCENDING)
+               {
+                       ret = media_filter_set_order(pFilterHandle.get(), MEDIA_CONTENT_ORDER_DESC, pSortCol.get(), MEDIA_CONTENT_COLLATE_NOCASE);
+                       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "Failed to perform media_filter_set_order operation.");
+               }
+       }
+
+       __pFilterHandle.reset(pFilterHandle.release());
+
+       return r;
+}
+
+// Osp column names are mapped with slp column names
+// CONTENT_TYPE_OTHER and CONTENT_TYPE_IMAGE (0 - 13 ) are valid columns
+// CONTENT_TYPE_VIDEO  (0 - 16 ) are valid columns
+// CONTENT_TYPE_ALL and  CONTENT_TYPE_VIDEO (0 - 18 ) are valid columns
+// if the given osp column is out of the specified range of the type, E_INVALID_ARG is retuned.
+result
+_ContentSearchImpl::GetSlpColumnName(String& inputCol) const
+{
+       String          ospColumnName(L"");
+       String          slpColumnName(L"");
+       String          columnName(__inputColumnName);
+       result          r = E_SUCCESS;
+       int             maxCols = 0;
+       switch (__contentType)
+       {
+       case CONTENT_TYPE_OTHER:
+               //fall through
+       case CONTENT_TYPE_IMAGE:
+               maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;
+               break;
+       case CONTENT_TYPE_VIDEO:
+               maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;
+               break;
+       case CONTENT_TYPE_AUDIO:
+               //fall through
+       case CONTENT_TYPE_ALL:
+               maxCols = MAX_QUERY_COLUMNS;
+               break;
+       default:
+               break;
+       }
+       for (int colIndex = 0; colIndex < maxCols; colIndex++)
+       {
+               ospColumnName.Clear();
+               slpColumnName.Clear();
+
+               ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;
+               slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;
+
+               ospColumnName.ToUpper();
+               columnName.ToUpper();
+               if (columnName == ospColumnName)
+               {
+                       inputCol = slpColumnName;
+                       return r;
+               }
+       }
+       return E_INVALID_ARG;
+}
+
+//If the input expression contains any osp column name, it will be replaced with slp column name.
+// only CONTENT_TYPE_AUDIO and CONTENT_TYPE_ALL allowed to use all given columns
+// so, check for invalid column for CONTENT_TYPE_OTHER,CONTENT_TYPE_IMAGE and CONTENT_TYPE_VIDEO.
+// all the osp columns in the expression should be replaced with slp column names.
+// ' is used as a delimeter in parsing user query. so, \\' is saved as a special@apostrophe string.
+// \\' is replaced with '', which considers ' as normal character.
+
+result
+_ContentSearchImpl::ReplaceOspColumnNameWithSlp(void) const
+{
+       String          ospColumnName(L"");
+       String          slpColumnName(L"");
+       String          splApostrophe(L"special@apostrophe");
+       result          r = E_SUCCESS;
+       int             maxCols = 0;
+
+       int indexOf = 0;
+       
+       String strToBeReplaced(L"\\'");
+       int strLen = strToBeReplaced.GetLength();
+       int startIndex = 0;
+
+       while(E_SUCCESS == __inputExpr.IndexOf(strToBeReplaced,startIndex,indexOf))
+       {
+               int lenAfterSubStr = indexOf + strLen;
+               while ((lenAfterSubStr < __inputExpr.GetLength()) && (__inputExpr[lenAfterSubStr] == ' '))
+               {
+                       lenAfterSubStr++;
+               }
+               if ((lenAfterSubStr < __inputExpr.GetLength()) && ((__inputExpr[lenAfterSubStr] == '\'') ||
+                               ((!__inputExpr.StartsWith(L"AND ", lenAfterSubStr)) && (!__inputExpr.StartsWith(L"OR ", lenAfterSubStr)))))
+               {
+                       r = __inputExpr.Remove(indexOf,strLen);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "Failed to perform Remove operation.");
+                       r = __inputExpr.Insert(splApostrophe,indexOf);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "Failed to perform Insert operation.");
+                       startIndex = indexOf + splApostrophe.GetLength();
+               }
+               else
+               {
+                       startIndex = lenAfterSubStr;
+               }
+       }
+
+       SysLog(NID_CNT, "__inputExpr after splApostrophe append = %ls", __inputExpr.GetPointer());
+
+       switch (__contentType)
+       {
+       case CONTENT_TYPE_OTHER:
+               //fall through
+       case CONTENT_TYPE_IMAGE:
+               r = CheckInvalidColumnInQuery();
+               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_INVALID_ARG, "Invalid Column In QueryString.");
+               maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;
+               break;
+       case CONTENT_TYPE_VIDEO:
+               r = CheckInvalidColumnInQuery();
+               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_INVALID_ARG, "Invalid Column In QueryString.");
+               maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;
+               break;
+       case CONTENT_TYPE_AUDIO:
+               //fall through
+       case CONTENT_TYPE_ALL:
+               maxCols = MAX_QUERY_COLUMNS;
+               break;
+       default:
+               break;
+       }
+       for (int colIndex = 0; colIndex < maxCols; colIndex++)
+       {
+               ospColumnName.Clear();
+               slpColumnName.Clear();
+
+               ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;
+               slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;
+
+               ReplaceString(ospColumnName,slpColumnName);
+       }
+
+       // Append ESCAPE '\' for LIKE query
+       r = AppendEscapeKeywordForLikeQuery();
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "AppendEscapeKeywordForLikeQuery failed.");
+
+       r = ReplaceDateTimeStringWithInt();
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_INVALID_ARG, "ReplaceDateTimeStringWithInt failed.");
+
+       // replace splApostrophe string with actual
+       r = __inputExpr.Replace(splApostrophe, "''");
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string Replace failed.");
+
+       return r;
+}
+
+//This function is to appened ESCAPE keyword for _ and % special characters in LIKE query.
+
+result
+_ContentSearchImpl::AppendEscapeKeywordForLikeQuery(void) const
+{
+       String  delim = L"'"; //Delimeters  is  ' .
+       result r = E_SUCCESS;
+       bool isCol = true;
+       bool isAppendEscape = false;
+       String token;
+       String tokenUpper;
+       String inputExpr = __inputExpr;
+
+       // Create a StringTokenizer instance
+       StringTokenizer  strTok(inputExpr, delim);
+
+       inputExpr.Clear();
+
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "GetNextToken failed.");
+               if (isCol) //column name
+               {
+                       isCol = false;
+                       tokenUpper = token;
+                       tokenUpper.ToUpper();
+                       if (tokenUpper.Contains(" LIKE"))
                        {
-                               dVal = _LocalizedNumParser::ToDouble(strColVal, "C");\r
-                               r = GetLastResult();\r
+                               isAppendEscape = true;
+                       }
+                       else
+                       {
+                               isAppendEscape = false;
+                       }
+                       r = inputExpr.Append(token);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+               }
+               else // value of the column
+               {
+                       isCol = true;
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                       r = inputExpr.Append(token);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+
+                       if (isAppendEscape)
+                       {
+                               if (token.Contains("\\_") || token.Contains("\\%"))
+                               {
+                                       r = inputExpr.Append("ESCAPE'\\'  ");
+                                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                               }
+                       }
+               }
+       }
+
+       __inputExpr.Clear();
+       r = __inputExpr.Insert(inputExpr, 0);
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string insert failed.");
+
+       return r;
+}
+
+//This function is to replace DateTime value(osp datetime type is string) which is string with int.(SLP dateTime column type is int)
+
+result
+_ContentSearchImpl::ReplaceDateTimeStringWithInt(void) const
+{
+       String  delim = L"'"; //Delimeters  is  ' .
+       result r = E_SUCCESS;
+       bool isCol = true;
+       bool isConvertReq = false;
+       bool isBetweenExistsInDateTimeQuery = false;
+       String token;
+       String tokenUpper;
+       String inputExpr = __inputExpr;
+
+       if(!inputExpr.Contains("MEDIA_ADDED_TIME"))
+       {
+               return r;
+       }
+
+       // Create a StringTokenizer instance
+       StringTokenizer  strTok(inputExpr, delim);
+
+       inputExpr.Clear();
+
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "GetNextToken failed.");
+               if (isCol) //column name
+               {
+                       isCol = false;
+                       tokenUpper = token;
+                       tokenUpper.ToUpper();
+                       if(isBetweenExistsInDateTimeQuery)
+                       {
+                               isBetweenExistsInDateTimeQuery = false;
+                               isConvertReq = true;
+                       }
+                       else
+                       {
+                               if (tokenUpper.Contains("MEDIA_ADDED_TIME"))
+                               {
+                                       if (tokenUpper.Contains("BETWEEN"))
+                                       {
+                                               isBetweenExistsInDateTimeQuery = true;
+                                       }
+                                       isConvertReq = true;
+                               }
+                               else
+                               {
+                                       isConvertReq = false;
+                               }
+                       }
+
+                       r = inputExpr.Append(token);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");
+               }
+               else // value of the column
+               {
+                       isCol = true;
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");
+
+                       if (isConvertReq)
+                       {
+                               Tizen::Base::DateTime dt;
+                               r = Tizen::Base::DateTime::Parse(token, dt);
+                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to parse DateTime.");
+
+                               int year = dt.GetYear();
+                               int month = dt.GetMonth(); 
+                               int day = dt.GetDay();
+                               int hour = dt.GetHour();
+                               int minute = dt.GetMinute(); 
+                               int second = dt.GetSecond();
+                               
+                               time_t rawTime;
+                               struct tm* timeInfo;
+
+                               time(&rawTime);
+                               timeInfo = localtime(&rawTime);
+                               timeInfo->tm_year = year - 1900;
+                               timeInfo->tm_mon = month - 1;
+                               timeInfo->tm_mday = day;
+                               timeInfo->tm_hour = hour;
+                               timeInfo->tm_min = minute;
+                               timeInfo->tm_sec = second;
+
+                               time_t seconds = mktime(timeInfo);
+                               SysTryReturnResult(NID_CNT, seconds != -1, E_INVALID_ARG, "Failed to convert DateTime to broken-down time.");
+
+                               long long ticksInSeconds = (long long)seconds;
+
+                               r = inputExpr.Append(ticksInSeconds);
+                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");
+                       }
+                       else
+                       {
+                               r = inputExpr.Append(token);
+                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");
+                       }
+
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string append failed.");
+               }
+       }
+
+       __inputExpr.Clear();
+       r = __inputExpr.Insert(inputExpr, 0);
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "string insert failed.");
+
+       return r;
+}
+
+// CONTENT_TYPE_OTHER and CONTENT_TYPE_IMAGE (0 - 13 ) are valid columns
+// CONTENT_TYPE_VIDEO  (0 - 16 ) are valid columns
+// CONTENT_TYPE_ALL and  CONTENT_TYPE_VIDEO (0 - 18 ) are valid columns
+// This functions checks for invalid column in the given input string (only allowed columns should be used by content type other wise
+// E_INVALID_ARG is returned)
+// StringTokenizer is used to parse input expression, by using delimater "'", to differentiate column and value.
+// As values may also contain column names
+// Ex: 1. where author = syam_author_01 2. where album = jalsa_album_name_01.
+
+result
+_ContentSearchImpl::CheckInvalidColumnInQuery(void) const
+{
+       result r = E_SUCCESS;
+       int tokenNo = 0;
+       String  delim = L"'"; //Delimeters  is  ' .
+        bool isColReplaceReq = true;
+       String token;
+       String inputExpr = __inputExpr;
+
+       // Create a StringTokenizer instance
+       StringTokenizer  strTok(inputExpr, delim);
+
+       inputExpr.Clear();
+
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "strTok GetNextToken failed.");
+
+               SysLog(NID_CNT, "In CheckInvalidColumnInQuery token[%d] = %ls", ++tokenNo, token.GetPointer());
+
+               if (isColReplaceReq)
+               {
+                       isColReplaceReq = false;
+                       r = inputExpr.Append(token);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                       token.ToUpper();
+                       switch (__contentType)
+                       {
+                       case CONTENT_TYPE_OTHER:
+                               //fall through
+                       case CONTENT_TYPE_IMAGE:
+                               if ((token.Contains("TITLE")) || (token.Contains("ARTIST")) || (token.Contains("GENRE")))
+                               {
+                                       SysLog(NID_CNT, "Title or Artist or Genre are not valid cloumns for this content type");
+                                       return E_INVALID_ARG;
+                               }
+                               //fall through
+                       case CONTENT_TYPE_VIDEO:
+                               if ((token.Contains("COMPOSER")) || (token.Contains("ALBUM")))
+                               {
+                                       SysLog(NID_CNT, "Composer or Album  are not valid cloumns for this content type");
+                                       return E_INVALID_ARG;
+                               }
+                               break;
+                       default:
+                               break;
+                       }
+               }
+               else
+               {
+                       isColReplaceReq = true;
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                       r = inputExpr.Append(token);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+               }
+       }
+       return r;
+}
+
+// It replaces native column name with core column name.
+// StringTokenizer is used to parse input expression, by using delimiter "'", to differentiate column and value.
+// As values may also contain column names
+// Only column names are replaced but not values(values may contain column names)
+// Ex: 1. where author = syam_author_01 2. where album = jalsa_album_name_01.
+
+result
+_ContentSearchImpl::ReplaceString(String ospColumnName, String slpColumnName) const
+{
+       String  delim = L"'"; //Delimiters  is  ' .
+       result r = E_SUCCESS;
+        bool isColReplaceReq = true;
+       String token;
+       String inputExpr = __inputExpr;
+
+       // Create a StringTokenizer instance
+       StringTokenizer  strTok(inputExpr, delim);
+
+       inputExpr.Clear();
+
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);         // Osp, StringTokenizer, Sample, code
+               SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string GetNextToken() failed.");
+               if (isColReplaceReq) //column name
+               {
+                       isColReplaceReq = false;
+                       r = token.Replace(ospColumnName, slpColumnName);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string replace() failed.");
+                       r = inputExpr.Append(token);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+               }
+               else // value of the column
+               {
+                       isColReplaceReq = true;
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                       r = inputExpr.Append(token);
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+                       r = inputExpr.Append("'");
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string append failed.");
+               }
+       }
+       __inputExpr.Clear();
+       r = __inputExpr.Insert(inputExpr, 0);
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, E_SYSTEM, "string insert() failed.");
+
+       return r;
+}
+
+// Returns list of search result for the given expression and content type.
+Collection::IList*
+_ContentSearchImpl::SearchN(int pageNo, int countPerPage, int& totalPageCount, int& totalCount, const String& whereExpr, const String& sortColumn, SortOrder sortOrder) const
+{
+       SysLog(NID_CNT, "pageNo = %d, countPerPage = %d, whereExpr = %ls", pageNo, countPerPage, whereExpr.GetPointer());
+
+       ClearLastResult();
+
+       result r        = E_SUCCESS;
+       int ret         = MEDIA_CONTENT_ERROR_NONE;
+       int offset      = 0;
+
+       __inputColumnName.Clear();
+       __inputExpr.Clear();
+       __inputColumnName = sortColumn;
+       __inputSortOrder = sortOrder;
+       totalPageCount = 0;
+       totalCount = 0;
+
+       if (!whereExpr.IsEmpty()) // copy whereExpr if not empty to class variable __inputExpr
+       {
+               r = __inputExpr.Append(whereExpr);
+               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] __inputExpr.Append Failed as whereExpr is not empty.", GetErrorMessage(r));
+
+               r = ReplaceOspColumnNameWithSlp();
+               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] ReplaceOspColumnNameWithSlp for InputExpr Failed.", GetErrorMessage(r));
+
+               SysLog(NID_CNT, "After replace __inputExpr = %ls", __inputExpr.GetPointer());
+       }
+       if ((__inputColumnName.IsEmpty()) && ((__inputSortOrder == SORT_ORDER_ASCENDING) || (__inputSortOrder == SORT_ORDER_DESCENDING)))
+       {
+               SysLog(NID_CNT, "sort column name is empty and sort oder is not none. so,E_INVALID_ARG occured.");
+               SetLastResult(E_INVALID_ARG);
+               return null;
+       }
+       else
+       {
+               std::unique_ptr<ArrayList, AllElementsDeleter> pFinalOutList(new (std::nothrow) ArrayList());
+               SysTryReturn(NID_CNT, pFinalOutList.get() != null, NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");
+
+               r = pFinalOutList->Construct();
+               SysTryReturn(NID_CNT, !IsFailed(r), NULL, r, "[%s] Failed to construct ArrayList.", GetErrorMessage(r));
+
+               __pFinalOutList = std::move(pFinalOutList);
+
+               r = CreateQueryFilter(true);
+               SysTryReturn(NID_CNT, !IsFailed(r), NULL, r, "[%s] Failed to perform CreateQueryFilter operation.", GetErrorMessage(r));
+
+               ret = media_info_get_media_count_from_db(__pFilterHandle.get(), &totalCount);
+               r = MapCoreErrorToNativeResult(ret);
+               SysTryReturn(NID_CNT, r == E_SUCCESS , NULL, r, "[%s] Failed to perform media_info_get_media_count_from_db operation.", GetErrorMessage(r));
+
+               SysLog(NID_CNT, "totalCount is [%d] for media_info_get_media_count_from_db", totalCount);
+
+               if (totalCount > 0)
+               {
+                       if ((totalCount % countPerPage) == 0)
+                       {
+                               totalPageCount = totalCount / countPerPage;
+                       }
+                       else
+                       {
+                               totalPageCount = (totalCount / countPerPage) + 1;
+                       }
+
+                       SysTryReturn(NID_CNT, ((pageNo >= 1) && (pageNo <= totalPageCount)) , NULL, E_INVALID_ARG, "[E_INVALID_ARG] (pageNo < 1) || (pageNo > totalPageCount).");
+
+                       offset = (pageNo * countPerPage) - countPerPage;
+
+                       SysLog(NID_CNT, " SearchN   totalCount [%d] totalPageCount[%d] __countPerPage[%d] __pageNo[%d] offset[%d]",
+                                       totalCount, totalPageCount, countPerPage, pageNo, offset);
+
+                       ret = media_filter_set_offset(__pFilterHandle.get(), offset, countPerPage);
+                       r = MapCoreErrorToNativeResult(ret);
+                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r,
+                       "[%s] Failed to perform media_filter_set_offset operation.", GetErrorMessage(r));
+
+                       r = ExecuteAndFillFinalOutList();
+                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, E_SYSTEM, "[E_SYSTEM] ExecuteAndFillFinalOutList Failed.");
+               }
+               else if (pageNo > 1)
+               {
+                       r = E_INVALID_ARG;
+                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[E_INVALID_ARG] (pageNo > 1) and  (totalcount = 0).");
+               }
+       }
+       SetLastResult(r);
+       return __pFinalOutList.release();
+}
+
+// Fills final result list
+result
+_ContentSearchImpl::ExecuteAndFillFinalOutList(void) const
+{
+       SysLog(NID_CNT, "Enter\n");
+
+       int ret                                         = MEDIA_CONTENT_ERROR_NONE;
+       result r                                        = E_SUCCESS;
+
+       std::unique_ptr<GList, SearchGListDeleter> pItemList;
+       GList* pTemp = NULL;
+       std::unique_ptr<media_info_s, SearchMediaHandleDeleter> pMediaHandle;
+
+       std::unique_ptr<ImageContentInfo> pImageContentInfo;
+       std::unique_ptr<AudioContentInfo> pAudioContentInfo;
+       std::unique_ptr<VideoContentInfo> pVideoContentInfo;
+       std::unique_ptr<OtherContentInfo> pOtherContentInfo;
+
+       _ImageContentInfoImpl* pImageContentInfoImpl = null;
+       _AudioContentInfoImpl* pAudioContentInfoImpl = null;
+       _VideoContentInfoImpl* pVideoContentInfoImpl = null;
+       _OtherContentInfoImpl* pOtherContentInfoImpl = null;
+
+       std::unique_ptr<ContentSearchResult> pContentSearchResult;
+
+       pTemp = pItemList.get();
+
+       ret = media_info_foreach_media_from_db(__pFilterHandle.get(), MediaItemCb, &pTemp);
+       r = MapCoreErrorToNativeResult(ret);
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform media_info_foreach_media_from_db operation.");
+
+       SysTryReturnResult(NID_CNT, pTemp != NULL, r, "media_info_foreach_media_from_db pTemp is null.");
+
+       media_content_type_e mediaType = MEDIA_CONTENT_TYPE_OTHERS;
+
+       for (int idx = 0; idx < (int)g_list_length(pTemp); idx++)
+       {
+               pMediaHandle.reset(static_cast<media_info_h>(g_list_nth_data(pTemp, idx)));
+
+               ret = media_info_get_media_type(pMediaHandle.get(), &mediaType);
+               r = MapCoreErrorToNativeResult(ret);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_info_get_media_type.");
+
+               std::unique_ptr<char, UtilCharDeleter> pMediaPath;
+               char* pTempPath = null;
+
+               ret = media_info_get_file_path(pMediaHandle.get(), &pTempPath);
+               r = MapCoreErrorToNativeResult(ret);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_info_get_file_path operation.");
+
+               pMediaPath.reset(pTempPath);
+               String contentPath(pMediaPath.get());
+
+               switch (mediaType)
+               {
+               case MEDIA_CONTENT_TYPE_OTHERS:
+                       pOtherContentInfo = std::unique_ptr<OtherContentInfo>(new (std::nothrow) OtherContentInfo);
+                       SysTryReturnResult(NID_CNT, pOtherContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pOtherContentInfo.");
+
+                       r = pOtherContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to OtherContentInfo.");
+
+                       pOtherContentInfoImpl = null;
+                       pOtherContentInfoImpl = _OtherContentInfoImpl::GetInstance(*(pOtherContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pOtherContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pOtherContentInfoImpl.");
+
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pOtherContentInfoImpl);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+
+                       _ContentInfoHelper::SetContentInfoImpl(pOtherContentInfo.get(), pOtherContentInfoImpl);
+
+                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);
+                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");
+
+                       pContentSearchResult->SetContentType(CONTENT_TYPE_OTHER);
+                       pContentSearchResult->SetContentInfo(pOtherContentInfo.release());
+
+                       // Shallow copy, adds just the pointer: not the element
+                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");
+
+                       break;
+               case MEDIA_CONTENT_TYPE_IMAGE:
+                       pImageContentInfo = std::unique_ptr<ImageContentInfo>(new (std::nothrow) ImageContentInfo);
+                       SysTryReturnResult(NID_CNT, pImageContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pImageContentInfo.");
+
+                       r = pImageContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to ImageContentInfo.");
+
+                       pImageContentInfoImpl = null;
+                       pImageContentInfoImpl = _ImageContentInfoImpl::GetInstance(*(pImageContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pImageContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pImageContentInfoImpl.");
+
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pImageContentInfoImpl);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+
+                       r = _ContentUtility::FillImageContentData(pMediaHandle.get(), pImageContentInfoImpl);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform GetDataFromImageTable operation.");
+
+                       _ContentInfoHelper::SetContentInfoImpl(pImageContentInfo.get(), pImageContentInfoImpl);
+
+                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);
+                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");
+
+                       pContentSearchResult->SetContentType(CONTENT_TYPE_IMAGE);
+                       pContentSearchResult->SetContentInfo(pImageContentInfo.release());
+
+                       // Shallow copy, adds just the pointer: not the element
+                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");
+
+                       break;
+               case MEDIA_CONTENT_TYPE_MUSIC:
+                       //fall through
+               case MEDIA_CONTENT_TYPE_SOUND:
+                       pAudioContentInfo = std::unique_ptr<AudioContentInfo>(new (std::nothrow) AudioContentInfo);
+                       SysTryReturnResult(NID_CNT, pAudioContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pAudioContentInfo.");
+
+                       r = pAudioContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to AudioContentInfo.");
+
+                       pAudioContentInfoImpl = null;
+                       pAudioContentInfoImpl = _AudioContentInfoImpl::GetInstance(*(pAudioContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pAudioContentInfoImpl.");
+
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pAudioContentInfoImpl);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+
+                       r = _ContentUtility::FillAudioContentData(pMediaHandle.get(), pAudioContentInfoImpl);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillAudioContentData operation.");
+
+                       _ContentInfoHelper::SetContentInfoImpl(pAudioContentInfo.get(), pAudioContentInfoImpl);
+
+                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);
+                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");
+
+                       pContentSearchResult->SetContentType(CONTENT_TYPE_AUDIO);
+                       pContentSearchResult->SetContentInfo(pAudioContentInfo.release());
+
+                       // Shallow copy, adds just the pointer: not the element
+                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");
+
+                       break;
+               case MEDIA_CONTENT_TYPE_VIDEO:
+                       pVideoContentInfo = std::unique_ptr<VideoContentInfo>(new (std::nothrow) VideoContentInfo);
+                       SysTryReturnResult(NID_CNT, pVideoContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pVideoContentInfo.");
+
+                       r = pVideoContentInfo->Construct(&contentPath);
+                       r = ConvertErrorToResult(r);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to VideoContentInfo.");
+
+                       pVideoContentInfoImpl = null;
+                       pVideoContentInfoImpl = _VideoContentInfoImpl::GetInstance(*(pVideoContentInfo.get()));
+                       SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pVideoContentInfoImpl.");
+
+                       r = _ContentUtility::FillContentData(pMediaHandle.get(), pVideoContentInfoImpl);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+
+                       r = _ContentUtility::FillVideoContentData(pMediaHandle.get(), pVideoContentInfoImpl);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillVideoContentData operation.");
+
+                       _ContentInfoHelper::SetContentInfoImpl(pVideoContentInfo.get(), pVideoContentInfoImpl);
+
+                       pContentSearchResult = std::unique_ptr<ContentSearchResult>(new (std::nothrow) ContentSearchResult);
+                       SysTryReturnResult(NID_CNT, pContentSearchResult.get() != null, E_OUT_OF_MEMORY, "Failed to create pContentSearchResult.");
+
+                       pContentSearchResult->SetContentType(CONTENT_TYPE_VIDEO);
+                       pContentSearchResult->SetContentInfo(pVideoContentInfo.release());
+
+                       // Shallow copy, adds just the pointer: not the element
+                       r = __pFinalOutList->Add(*(pContentSearchResult.release()));
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Add operation for ArrayList.");
+
+                       break;
+               default:
+                       break;
+               }
+       }
+       return r;
+}
+
+// returns  given column value list in the requested order
+Collection::IList*
+_ContentSearchImpl::GetValueListN(const String& sortColumn, SortOrder sortOrder)
+{
+       SysLog(NID_CNT, "inputColumn = %ls", sortColumn.GetPointer());
+       ClearLastResult();
+
+       result r        = E_SUCCESS;
+       int colIndex    = 0;
+       int maxCols     = 0;
+
+       __inputColumnName.Clear();
+       __inputExpr.Clear();
+
+       __inputColumnName = sortColumn;
+       __inputSortOrder  = sortOrder;
+
+       String          ospColumnName(L"");
+       String          slpColumnName(L"");
+
+       String          columnName(__inputColumnName);
+
+       if ((__inputColumnName.IsEmpty()) && ((__inputSortOrder == SORT_ORDER_ASCENDING) || (__inputSortOrder == SORT_ORDER_DESCENDING)))
+       {
+               SysLog(NID_CNT, "sort column name is empty and sort oder is not none. so,E_INVALID_ARG occured.");
+               SetLastResult(E_INVALID_ARG);
+               return null;
+       }
+       else
+       {
+               std::unique_ptr<ArrayList, AllElementsDeleter> pFinalOutList(new (std::nothrow) ArrayList());
+               SysTryReturn(NID_CNT, pFinalOutList.get() != null, NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");
+
+               r = pFinalOutList->Construct();
+               SysTryReturn(NID_CNT, !IsFailed(r), NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");
+
+               __pFinalOutList = std::move(pFinalOutList);
+
+               switch (__contentType)
+               {
+               case CONTENT_TYPE_OTHER:
+                       //fall through
+               case CONTENT_TYPE_IMAGE:
+                       maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;
+                       break;
+               case CONTENT_TYPE_VIDEO:
+                       maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;
+                       break;
+               case CONTENT_TYPE_AUDIO:
+                       //fall through
+               case CONTENT_TYPE_ALL:
+                       maxCols = MAX_QUERY_COLUMNS;
+                       break;
+               default:
+                       break;
+               }
+
+               for (colIndex = 0; colIndex < maxCols; colIndex++)
+               {
+                       ospColumnName.Clear();
+                       slpColumnName.Clear();
+
+                       ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;
+                       slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;
+
+                       ospColumnName.ToUpper();
+                       columnName.ToUpper();
+                       if (columnName == ospColumnName)
+                       {
+                               r = FillColumnsList(colIndex);
+                               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] FillColumnsList Failed.", GetErrorMessage(r));
+                               break;
+                       }
+               }
+               if (colIndex == maxCols)
+               {
+                       r = E_INVALID_ARG;
+                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[E_INVALID_ARG] invalid column.");
+               }
+       }
+       SetLastResult(r);
+       return __pFinalOutList.release();
+}
+
+// returns  given column value list in the requested order
+Collection::IList*
+_ContentSearchImpl::GetValueListN(int pageNo, int countPerPage, int& totalPageCount, int& totalCount, const String& sortColumn, SortOrder sortOrder) const
+{
+       SysLog(NID_CNT, "pageNo = %d, countPerPage = %d, inputColumn = %ls", pageNo, countPerPage, sortColumn.GetPointer());
+
+       ClearLastResult();
+
+       result r        = E_SUCCESS;
+       int colIndex    = 0;
+       int maxCols     = 0;
+
+       __inputColumnName.Clear();
+       __inputExpr.Clear();
+
+       __inputColumnName = sortColumn;
+       __inputSortOrder  = sortOrder;
+
+       String          ospColumnName(L"");
+       String          slpColumnName(L"");
+
+       String          columnName(__inputColumnName);
+
+       if ((__inputColumnName.IsEmpty()) && ((__inputSortOrder == SORT_ORDER_ASCENDING) || (__inputSortOrder == SORT_ORDER_DESCENDING)))
+       {
+               SysLog(NID_CNT, "sort column name is empty and sort oder is not none. so,E_INVALID_ARG occured.");
+               SetLastResult(E_INVALID_ARG);
+               return null;
+       }
+       else
+       {
+               std::unique_ptr<ArrayList, AllElementsDeleter> pFinalOutList(new (std::nothrow) ArrayList());
+               SysTryReturn(NID_CNT, pFinalOutList.get() != null, NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to construct ArrayList.");
+
+               r = pFinalOutList->Construct();
+               SysTryReturn(NID_CNT, !IsFailed(r), NULL, r, "[%s] Failed to construct ArrayList.", GetErrorMessage(r));
+
+               __pFinalOutList = std::move(pFinalOutList);
+
+               switch (__contentType)
+               {
+               case CONTENT_TYPE_OTHER:
+                       //fall through
+               case CONTENT_TYPE_IMAGE:
+                       maxCols = MAX_QUERY_COLUMNS_FOR_IMAGE_OTHERS;
+                       break;
+               case CONTENT_TYPE_VIDEO:
+                       maxCols = MAX_QUERY_COLUMNS_FOR_VIDEO;
+                       break;
+               case CONTENT_TYPE_AUDIO:
+                       //fall through
+               case CONTENT_TYPE_ALL:
+                       maxCols = MAX_QUERY_COLUMNS;
+                       break;
+               default:
+                       break;
+               }
+
+               for (colIndex = 0; colIndex < maxCols; colIndex++)
+               {
+                       ospColumnName.Clear();
+                       slpColumnName.Clear();
+
+                       ospColumnName = dbfieldinfo[colIndex].dbFieldOspName ;
+                       slpColumnName = dbfieldinfo[colIndex].dbFieldSlpName ;
+
+                       ospColumnName.ToUpper();
+                       columnName.ToUpper();
+                       if (columnName == ospColumnName)
+                       {
+                               r = FillColumnsList(pageNo, countPerPage, totalPageCount, totalCount, colIndex);
+                               SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[%s] FillColumnsList Failed.", GetErrorMessage(r));
+                               break;
+                       }
+               }
+               if (colIndex == maxCols)
+               {
+                       r = E_INVALID_ARG;
+                       SysTryReturn(NID_CNT, r == E_SUCCESS, NULL, r, "[E_INVALID_ARG] invalid column.");
+               }
+       }
+       SetLastResult(r);
+       return __pFinalOutList.release();
+}
+
+// prepares query expression to be used in group api. colIndex is mapped to actual group value.
+media_group_e
+_ContentSearchImpl::GetIndexAndCreateQueryExp(int colIndex) const
+{
+       media_group_e groupIndex = MEDIA_CONTENT_GROUP_DISPLAY_NAME;;
+       switch (colIndex)
+       {
+       case 0://"ContentType", "MEDIA_TYPE"
+               groupIndex = MEDIA_CONTENT_GROUP_TYPE;
+               __inputExpr = "MEDIA_TYPE IS NOT NULL";
+               break;
+       case 1://"ContentFileName", "MEDIA_DISPLAY_NAME"
+               groupIndex = MEDIA_CONTENT_GROUP_DISPLAY_NAME;
+               __inputExpr = "MEDIA_DISPLAY_NAME IS NOT NULL";
+               break;
+       case 2://"ContentName", "MEDIA_CONTENT_NAME"
+               groupIndex = MEDIA_CONTENT_GROUP_CONTENT_NAME;
+               __inputExpr = "MEDIA_CONTENT_NAME IS NOT NULL";
+               break;
+       case 3://"Category", "MEDIA_CATEGORY"
+               groupIndex = MEDIA_CONTENT_GROUP_CATEGORY;
+               __inputExpr = "MEDIA_CATEGORY IS NOT NULL";
+               break;
+       case 4://"Author", "MEDIA_AUTHOR"
+               groupIndex = MEDIA_CONTENT_GROUP_AUTHOR;
+               __inputExpr = "MEDIA_AUTHOR IS NOT NULL";
+               break;
+       case 5://"keyword", "MEDIA_KEYWORD"
+               groupIndex = MEDIA_CONTENT_GROUP_KEYWORD;
+               __inputExpr = "MEDIA_KEYWORD IS NOT NULL";
+               break;
+       case 6://"Provider", "MEDIA_PROVIDER"
+               groupIndex = MEDIA_CONTENT_GROUP_PROVIDER;
+               __inputExpr = "MEDIA_PROVIDER IS NOT NULL";
+               break;
+       case 7://"Rating", "MEDIA_AGE_RATING"
+               groupIndex = MEDIA_CONTENT_GROUP_AGE_RATING;
+               __inputExpr = "MEDIA_AGE_RATING IS NOT NULL";
+               break;
+       case 8://"LocationTag", "MEDIA_LOCATION_TAG"
+               groupIndex = MEDIA_CONTENT_GROUP_LOCATION_TAG;
+               __inputExpr = "MEDIA_LOCATION_TAG IS NOT NULL";
+               break;
+       case 9://"ContentSize", "MEDIA_SIZE"
+               groupIndex = MEDIA_CONTENT_GROUP_SIZE;
+               __inputExpr = "MEDIA_SIZE IS NOT NULL";
+               break;
+       case 10://"DateTime", "MEDIA_ADDED_TIME"
+               groupIndex = MEDIA_CONTENT_GROUP_ADDED_TIME;
+               __inputExpr = "MEDIA_ADDED_TIME IS NOT NULL";
+               break;
+       case 11://"Latitude", "MEDIA_LATITUDE"
+               groupIndex = MEDIA_CONTENT_GROUP_LATITUDE;
+               __inputExpr = "MEDIA_LATITUDE IS NOT NULL";
+               break;
+       case 12://"Longitude", "MEDIA_LONGITUDE"
+               groupIndex = MEDIA_CONTENT_GROUP_LONGITUDE;
+               __inputExpr = "MEDIA_LONGITUDE IS NOT NULL";
+               break;
+       case 13://"Altitude", "MEDIA_ALTITUDE"
+               groupIndex = MEDIA_CONTENT_GROUP_ALTITUDE;
+               __inputExpr = "MEDIA_ALTITUDE IS NOT NULL";
+               break;
+       case 14://"Title", "MEDIA_TITLE"
+               groupIndex = MEDIA_CONTENT_GROUP_TITLE;
+               __inputExpr = "MEDIA_TITLE IS NOT NULL";
+               break;
+       case 15://"Artist", "MEDIA_ARTIST"
+               groupIndex = MEDIA_CONTENT_GROUP_ARTIST;
+               __inputExpr = "MEDIA_ARTIST IS NOT NULL";
+               break;
+       case 16://"Genre", "MEDIA_GENRE"
+               groupIndex = MEDIA_CONTENT_GROUP_GENRE;
+               __inputExpr = "MEDIA_GENRE IS NOT NULL";
+               break;
+       case 17://"Year", "MEDIA_YEAR"
+               groupIndex = MEDIA_CONTENT_GROUP_YEAR;
+               __inputExpr = "MEDIA_YEAR IS NOT NULL";
+               break;
+       case 18://"Composer", "MEDIA_COMPOSER"
+               groupIndex = MEDIA_CONTENT_GROUP_COMPOSER;
+               __inputExpr = "MEDIA_COMPOSER IS NOT NULL";
+               break;
+       case 19://"Album", "MEDIA_ALBUM"
+               __inputExpr = "MEDIA_ALBUM IS NOT NULL";
+               break;
+       default:
+               break;
+       }
+       return groupIndex;
+}
+
+// Fills  given column value list and destroys filter handle
+result
+_ContentSearchImpl::FillColumnsList(int colIndex) const
+{
+       result r        = E_SUCCESS;
+       int ret         = MEDIA_CONTENT_ERROR_NONE;
+       int totalCount  = 0;
+       media_group_e groupIndex = GetIndexAndCreateQueryExp(colIndex);
+
+       r = CreateQueryFilter(true);
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "CreateQueryFilter Failed.");
+
+       if (colIndex == ALBUM_COLUMN_NUM)
+       {
+               ret = media_album_get_album_count_from_db(__pFilterHandle.get(), &totalCount);
+       }
+       else
+       {
+               ret = media_group_get_group_count_from_db(__pFilterHandle.get(), groupIndex, &totalCount);
+       }
+       r = MapCoreErrorToNativeResult(ret);
+       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "Failed to perform media_album/group count_from_db operation.");
+
+       SysLog(NID_CNT, "totalCount = %d for media_album/group count_from_db", totalCount);
+
+       if (totalCount > 0)
+       {
+               if (colIndex == ALBUM_COLUMN_NUM)
+               {
+                       r = ExecuteAndFillAlbumValues();
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillAlbumValues Failed.");
+               }
+               else
+               {
+                       r = ExecuteAndFillGetValueListN(groupIndex, colIndex);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillGetValueListN Failed.");
+               }
+       }
+       return r;
+}
+
+// prepares input expression to be sent for create filter and fills  given column value list
+result
+_ContentSearchImpl::FillColumnsList(int pageNo, int countPerPage, int& totalPageCount, int& totalCount, int colIndex) const
+{
+       result r        = E_SUCCESS;
+       int ret         = MEDIA_CONTENT_ERROR_NONE;
+       int offset      = 0;
+       totalPageCount = 0;
+       totalCount = 0;
+       media_group_e groupIndex = GetIndexAndCreateQueryExp(colIndex);
+
+       r = CreateQueryFilter(true);
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "CreateQueryFilter Failed.");
+
+       if (colIndex == ALBUM_COLUMN_NUM)
+       {
+               ret = media_album_get_album_count_from_db(__pFilterHandle.get(), &totalCount);
+       }
+       else
+       {
+               ret = media_group_get_group_count_from_db(__pFilterHandle.get(), groupIndex, &totalCount);
+       }
+       r = MapCoreErrorToNativeResult(ret);
+       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "Failed to perform media_album/group count_from_db operation.");
+
+       SysLog(NID_CNT, "totalCount = %d for media_album/group count_from_db", totalCount);
+
+       if (totalCount > 0)
+       {
+               if ((totalCount % countPerPage) == 0)
+               {
+                       totalPageCount = totalCount / countPerPage;
+               }
+               else
+               {
+                       totalPageCount = (totalCount / countPerPage) + 1;
+               }
+
+               if ((pageNo < 1) || (pageNo > totalPageCount))
+               {
+                       r = E_INVALID_ARG;
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "(pageNo < 1) || (pageNo > totalPageCount).");
+               }
+
+               offset = (pageNo * countPerPage) - countPerPage;
+
+               SysLog(NID_CNT, "GetValueListN totalCount [%d] totalPageCount[%d] __countPerPage[%d] __pageNo[%d] offset[%d]",
+                               totalCount, totalPageCount, countPerPage, pageNo, offset);
+
+               ret = media_filter_set_offset(__pFilterHandle.get(),offset,countPerPage);
+               r = MapCoreErrorToNativeResult(ret);
+               SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "failed to perform media_filter_set_offset operation.");
+
+               if (colIndex == ALBUM_COLUMN_NUM)
+               {
+                       r = ExecuteAndFillAlbumValues();
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillAlbumValues Failed.");
+               }
+               else
+               {
+                       r = ExecuteAndFillGetValueListN(groupIndex, colIndex);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "ExecuteAndFillGetValueListN Failed.");
+               }
+
+       }
+       else if (pageNo > 1)
+       {
+               r = E_INVALID_ARG;
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "(pageNo > 1) and  (totalcount = 0).");
+       }
+
+       return r;
+}
+
+//  fills  given column value list for GetValuelistN api
+result
+_ContentSearchImpl::ExecuteAndFillGetValueListN(media_group_e groupIndex, int colIndex) const
+{
+       SysLog(NID_CNT, "Enter\n");
+
+       int ret                     = MEDIA_CONTENT_ERROR_NONE;
+       result r                    = E_SUCCESS;
+       result res                  = E_SUCCESS;
+       std::unique_ptr<GList, SearchGListDeleter> pItemList;
+       GList* pTemp = NULL;
+
+       std::unique_ptr<Object> pValue;
+
+       DateTime dateTime;
+
+       long long contentSize = 0;
+       long long addedTime     = 0;
+
+       double dVal     = 0;
+       char *pColumnVal = null;
+       int contentType = 0;
+
+       pTemp = pItemList.get();
+
+       ret = media_group_foreach_group_from_db(__pFilterHandle.get(), groupIndex, GroupItemCb, &pTemp);
+       r = MapCoreErrorToNativeResult(ret);
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform media_group_foreach_group_from_db operation.");
+
+       SysTryReturnResult(NID_CNT, pTemp != NULL, r, "media_info_foreach_media_from_db pTemp is null.");
+
+       for (int idx = 0; idx < (int)g_list_length(pTemp); idx++)
+       {
+               SysLog(NID_CNT, "idx = %d and (int)g_list_length(pItemList) = %d", idx, (int)g_list_length(pTemp));
+
+               pColumnVal = (char *)g_list_nth_data(pTemp, idx);
+
+               String strColVal(pColumnVal);
+
+               _ContentUtility::DoSafeFree(pColumnVal);
+
+               SysLog(NID_CNT, "pColumnVal = %ls", strColVal.GetPointer());
+
+               switch (colIndex)
+               {
+               case 0://"ContentType", "MEDIA_TYPE"
+                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))
+                       {
+                               res = Integer::Parse(strColVal, contentType);
+                               SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] Integer parse failed.", GetErrorMessage(res));
+                       }
+                       switch ((media_content_type_e)contentType)
+                       {
+                       case MEDIA_CONTENT_TYPE_OTHERS:
+                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_OTHER));
+                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_OTHER");
+                               break;
+                       case MEDIA_CONTENT_TYPE_IMAGE:
+                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_IMAGE));
+                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_IMAGE");
+                               break;
+                       case MEDIA_CONTENT_TYPE_SOUND:
+                               //fall through
+                       case MEDIA_CONTENT_TYPE_MUSIC:
+                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_AUDIO));
+                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_AUDIO");
+                               break;
+                       case MEDIA_CONTENT_TYPE_VIDEO:
+                               pValue.reset(new (std::nothrow) String(CONTENT_TYPE_VIDEO));
+                               SysLog(NID_CNT, "mediaType = CONTENT_TYPE_VIDEO");
+                               break;
+                       default:
+                               break;
+                       }
+                       break;
+               case 1://"ContentFileName", "MEDIA_DISPLAY_NAME"
+               //fall through
+               case 2://"ContentName", "MEDIA_CONTENT_NAME"
+               //fall through
+               case 3://"Category", "MEDIA_CATEGORY"
+               //fall through
+               case 4://"Author", "MEDIA_AUTHOR"
+               //fall through
+               case 5://"keyword", "MEDIA_KEYWORD"
+               //fall through
+               case 6://"Provider", "MEDIA_PROVIDER"
+               //fall through
+               case 7://"Rating", "MEDIA_AGE_RATING"
+               //fall through
+               case 8://"LocationTag", "MEDIA_LOCATION_TAG"
+               //fall through
+               case 14://"Title", "MEDIA_TITLE"
+               //fall through
+               case 15://"Artist", "MEDIA_ARTIST"
+               //fall through
+               case 16://"Genre", "MEDIA_GENRE"
+               //fall through
+               case 17://"Year", "MEDIA_YEAR"
+               //fall through
+               case 18://"Composer", "MEDIA_COMPOSER"
+
+                       pValue.reset(new (std::nothrow) String(strColVal));
+                       break;
+
+               case 9://"ContentSize", "MEDIA_SIZE" 
+                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))
+                       {
+                               res = LongLong::Parse(strColVal, contentSize);
+                               SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] LongLong parse failed.", GetErrorMessage(res));
+                       }
+
+                       pValue.reset(new (std::nothrow) LongLong(contentSize));
+                       break;
+               case 10://"DateTime", "MEDIA_ADDED_TIME" 
+                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))
+                       {
+                               res = LongLong::Parse(strColVal, addedTime);
+                               SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] LongLong parse failed.", GetErrorMessage(res));
+                       }
+
+                       res = dateTime.SetValue(1970, 1, 1);
+                       SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] dateTime.SetValue failed.", GetErrorMessage(res));
+
+                       res = dateTime.AddSeconds(addedTime);
+                       SysTryLog(NID_CNT, res == E_SUCCESS, "[%s] dateTime.AddSeconds failed.", GetErrorMessage(res));
+
+                       SysLog(NID_CNT, "DateTime : %ls", dateTime.ToString().GetPointer());
+
+                       pValue.reset(new (std::nothrow) DateTime(dateTime));
+
+                       break;
+               case 11://"Latitude", "MEDIA_LATITUDE"
+                       //fall through
+               case 12://"Longitude", "MEDIA_LONGITUDE"
+                       //fall through
+               case 13://"Altitude", "MEDIA_ALTITUDE"
+                       if ((strColVal.CompareTo(L"Unknown") != 0) && (!strColVal.IsEmpty()))
+                       {
+                               dVal = _LocalizedNumParser::ToDouble(strColVal, "C");
+                               r = GetLastResult();
                                SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform ToDouble operation.");
-                       }\r
-                       pValue.reset(new (std::nothrow) Double(dVal));\r
-                       break;\r
-\r
-               case 19://"Album", "MEDIA_ALBUM"\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-               if (pValue.get() != NULL)\r
-               {\r
-                       r = __pFinalOutList->Add(*(pValue.release()));\r
-                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform arraylist Add operation.");\r
-               }\r
-       }\r
-\r
-       return r;\r
-}\r
-\r
-result\r
-_ContentSearchImpl::ExecuteAndFillAlbumValues(void) const\r
-{\r
-       int ret = MEDIA_CONTENT_ERROR_NONE;\r
-       result r = E_SUCCESS;\r
-       std::unique_ptr<GList, SearchGListDeleter> pItemList;\r
-       GList* pTemp = NULL;\r
-       std::unique_ptr<media_album_s, AlbumHandleDeleter> pAlbumHandle;\r
-       std::unique_ptr<media_album_s, AlbumHandleDeleter> pTempAlbumHandle;\r
-\r
-       char* pName = NULL;\r
-       std::unique_ptr<char, CharDeleter> pAlbumName;\r
-       std::unique_ptr< String > pValue;\r
-       int lastIndex = 0;\r
-\r
-       pTemp = pItemList.get();\r
-\r
-       ret = media_album_foreach_album_from_db(__pFilterHandle.get(), AlbumItemCb, &pTemp);\r
-       r = MapCoreErrorToNativeResult(ret);\r
-       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform media_album_foreach_album_from_db operation.");\r
-       SysTryReturnResult(NID_CNT, pTemp != NULL, r, "media_info_foreach_media_from_db pTemp is null.");\r
-\r
-       for (int idx = 0; idx < (int)g_list_length(pTemp); idx++)\r
-       {\r
-               pAlbumHandle.reset(static_cast<media_album_h>(g_list_nth_data(pTemp, idx)));\r
-               ret = media_album_get_name(pAlbumHandle.get(), &pName);\r
-               r = MapCoreErrorToNativeResult(ret);\r
-               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_album_get_name.");\r
-               \r
-               if (pName != NULL)\r
-               {\r
-                       SysLog(NID_CNT, "pColumnVal = %s", pName);\r
-\r
-                       pAlbumName.reset(pName);\r
-                       pValue.reset(new (std::nothrow) String(pAlbumName.get()));\r
-                       SysTryReturnResult(NID_CNT, pValue != NULL, E_OUT_OF_MEMORY, "media_info_foreach_media_from_db pTemp is null.");\r
-\r
-                       if (idx == 0)\r
-                       {\r
-                               r = __pFinalOutList->Add(pValue.get());\r
-                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform arraylist Add operation.");\r
-                               pValue.release();\r
-                       }\r
-                       else\r
-                       {\r
-                               String* pTempNameList(static_cast< String* >(__pFinalOutList->GetAt(lastIndex)));\r
-\r
-                               if (pValue->CompareTo(*pTempNameList) != 0)\r
-                               {\r
-                                       r = __pFinalOutList->Add(pValue.get());\r
-                                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform arraylist Add operation.");\r
-\r
-                                       pValue.release();\r
-                                       lastIndex++;\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       return r;\r
-}\r
-\r
-result\r
-_ContentSearchImpl::MapCoreErrorToNativeResult(int reason) const\r
-{\r
-       result r = E_SUCCESS;\r
-\r
-       switch (reason)\r
-       {\r
-       case MEDIA_CONTENT_ERROR_NONE:\r
-               r = E_SUCCESS;\r
-               break;\r
-\r
-       case MEDIA_CONTENT_ERROR_INVALID_PARAMETER:\r
-               r = E_INVALID_ARG;\r
-               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_INVALID_PARAMETER");\r
-               break;\r
-\r
-       case MEDIA_CONTENT_ERROR_DB_FAILED:\r
-               r = E_SYSTEM;\r
-               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_DB_FAILED");\r
-               break;\r
-\r
-       case MEDIA_CONTENT_ERROR_OUT_OF_MEMORY:\r
-               r = E_OUT_OF_MEMORY;\r
-               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_OUT_OF_MEMORY");\r
-               break;\r
-\r
-       default:\r
-               SysLog(NID_CNT, "default");\r
-               r = E_SYSTEM;\r
-               break;\r
-       }\r
-       return r;\r
-}\r
-\r
-//Callback function registered to each media info details\r
-// all items are appened to the list\r
-bool\r
-MediaItemCb(media_info_h media, void* pUserdata)\r
-{\r
-       int ret  = MEDIA_CONTENT_ERROR_NONE;\r
-       media_info_h new_media = NULL;\r
-       ret = media_info_clone(&new_media, media);\r
-       SysTryLog(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, "[E_SYSTEM] Failed to perform media_info_clone");\r
-\r
-       GList** pList = (GList**)pUserdata;\r
-       *pList = g_list_append(*pList, new_media);\r
-\r
-       return true;\r
-}\r
-\r
-//Callback function registered for column values\r
-// all items are appened to the list\r
-bool\r
-GroupItemCb(const char* pGroupName, void* pUserdata)\r
-{\r
-       char* pGrpName = strdup(pGroupName);\r
-       GList** pList = (GList**)pUserdata;\r
-       *pList = g_list_append(*pList, pGrpName);\r
-\r
-       return true;\r
-}\r
-\r
-//Callback function registered to each media info details\r
-// all items are appened to the list\r
-bool\r
-AlbumItemCb(media_album_h album, void* pUserdata)\r
-{\r
-       int ret  = MEDIA_CONTENT_ERROR_NONE;\r
-       media_album_h new_album = NULL;\r
-       ret = media_album_clone(&new_album, album);\r
-       SysTryLog(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, "[E_SYSTEM] Failed to perform media_album_clone");\r
-\r
-       GList** pList = (GList**)pUserdata;\r
-       *pList = g_list_append(*pList, new_album);\r
-\r
-       return true;\r
-}\r
-\r
-}}\r
+                       }
+                       pValue.reset(new (std::nothrow) Double(dVal));
+                       break;
+
+               case 19://"Album", "MEDIA_ALBUM"
+                       break;
+               default:
+                       break;
+               }
+               if (pValue.get() != NULL)
+               {
+                       r = __pFinalOutList->Add(*(pValue.release()));
+                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform arraylist Add operation.");
+               }
+       }
+
+       return r;
+}
+
+result
+_ContentSearchImpl::ExecuteAndFillAlbumValues(void) const
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       result r = E_SUCCESS;
+       std::unique_ptr<GList, SearchGListDeleter> pItemList;
+       GList* pTemp = NULL;
+       std::unique_ptr<media_album_s, AlbumHandleDeleter> pAlbumHandle;
+       std::unique_ptr<media_album_s, AlbumHandleDeleter> pTempAlbumHandle;
+
+       char* pName = NULL;
+       std::unique_ptr<char, CharDeleter> pAlbumName;
+       std::unique_ptr< String > pValue;
+       int lastIndex = 0;
+
+       pTemp = pItemList.get();
+
+       ret = media_album_foreach_album_from_db(__pFilterHandle.get(), AlbumItemCb, &pTemp);
+       r = MapCoreErrorToNativeResult(ret);
+       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform media_album_foreach_album_from_db operation.");
+       SysTryReturnResult(NID_CNT, pTemp != NULL, r, "media_info_foreach_media_from_db pTemp is null.");
+
+       for (int idx = 0; idx < (int)g_list_length(pTemp); idx++)
+       {
+               pAlbumHandle.reset(static_cast<media_album_h>(g_list_nth_data(pTemp, idx)));
+               ret = media_album_get_name(pAlbumHandle.get(), &pName);
+               r = MapCoreErrorToNativeResult(ret);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_album_get_name.");
+               
+               if (pName != NULL)
+               {
+                       SysLog(NID_CNT, "pColumnVal = %s", pName);
+
+                       pAlbumName.reset(pName);
+                       pValue.reset(new (std::nothrow) String(pAlbumName.get()));
+                       SysTryReturnResult(NID_CNT, pValue != NULL, E_OUT_OF_MEMORY, "media_info_foreach_media_from_db pTemp is null.");
+
+                       if (idx == 0)
+                       {
+                               r = __pFinalOutList->Add(pValue.get());
+                               SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform arraylist Add operation.");
+                               pValue.release();
+                       }
+                       else
+                       {
+                               String* pTempNameList(static_cast< String* >(__pFinalOutList->GetAt(lastIndex)));
+
+                               if (pValue->CompareTo(*pTempNameList) != 0)
+                               {
+                                       r = __pFinalOutList->Add(pValue.get());
+                                       SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform arraylist Add operation.");
+
+                                       pValue.release();
+                                       lastIndex++;
+                               }
+                       }
+               }
+       }
+
+       return r;
+}
+
+result
+_ContentSearchImpl::MapCoreErrorToNativeResult(int reason) const
+{
+       result r = E_SUCCESS;
+
+       switch (reason)
+       {
+       case MEDIA_CONTENT_ERROR_NONE:
+               r = E_SUCCESS;
+               break;
+
+       case MEDIA_CONTENT_ERROR_INVALID_PARAMETER:
+               r = E_INVALID_ARG;
+               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_INVALID_PARAMETER");
+               break;
+
+       case MEDIA_CONTENT_ERROR_DB_FAILED:
+               r = E_SYSTEM;
+               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_DB_FAILED");
+               break;
+
+       case MEDIA_CONTENT_ERROR_OUT_OF_MEMORY:
+               r = E_OUT_OF_MEMORY;
+               SysLog(NID_CNT, "MEDIA_CONTENT_ERROR_OUT_OF_MEMORY");
+               break;
+
+       default:
+               SysLog(NID_CNT, "default");
+               r = E_SYSTEM;
+               break;
+       }
+       return r;
+}
+
+result
+_ContentSearchImpl::ConvertErrorToResult(result res) const
+{
+       result r = E_SUCCESS;
+
+       switch (res)
+       {
+       case E_FILE_NOT_FOUND:
+               // Fall through
+       case E_IO:
+               r = E_SYSTEM;
+               break;
+
+       default:
+               r = res;
+               break;
+       }
+       return r;
+}
+
+// Callback function registered to each media info details
+// all items are appended to the list
+bool
+MediaItemCb(media_info_h media, void* pUserdata)
+{
+       int ret  = MEDIA_CONTENT_ERROR_NONE;
+       media_info_h new_media = NULL;
+       ret = media_info_clone(&new_media, media);
+       SysTryLog(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, "[E_SYSTEM] Failed to perform media_info_clone");
+
+       GList** pList = (GList**)pUserdata;
+       *pList = g_list_append(*pList, new_media);
+
+       return true;
+}
+
+// Callback function registered for column values
+// all items are appended to the list
+bool
+GroupItemCb(const char* pGroupName, void* pUserdata)
+{
+       char* pGrpName = strdup(pGroupName);
+       GList** pList = (GList**)pUserdata;
+       *pList = g_list_append(*pList, pGrpName);
+
+       return true;
+}
+
+// Callback function registered to each media info details
+// all items are appended to the list
+bool
+AlbumItemCb(media_album_h album, void* pUserdata)
+{
+       int ret  = MEDIA_CONTENT_ERROR_NONE;
+       media_album_h new_album = NULL;
+       ret = media_album_clone(&new_album, album);
+       SysTryLog(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, "[E_SYSTEM] Failed to perform media_album_clone");
+
+       GList** pList = (GList**)pUserdata;
+       *pList = g_list_append(*pList, new_album);
+
+       return true;
+}
+
+}}
index 6484f83..f336259 100644 (file)
 #include <FBaseInteger.h>
 #include <FBaseLongLong.h>
 #include <FBaseFloat.h>
-#include <FCnt_ContentUtility.h>
+#include <FCntContentManagerUtil.h>
+#include <FCntVideoMetadata.h>
+#include "FCnt_ContentUtility.h"
+#include "FCnt_ContentInfoImpl.h"
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_VideoContentInfoImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Locations;
 
 namespace Tizen { namespace Content
 {
@@ -37,16 +44,15 @@ static const double DEFAULT_COORDINATE = -200.0;
 
 // Default constructor
 _ContentUtility::_ContentUtility(void)
-       : Object()
 {
-       SysLog(NID_CNT, "Enter\n");
+
 }
 
 
 // Default destructor
 _ContentUtility::~_ContentUtility(void)
 {
-       SysLog(NID_CNT, "Enter\n");
+
 }
 
 void
@@ -55,26 +61,14 @@ _ContentUtility::DoSafeFree(char* pSrc)
        if (pSrc != NULL)
        {
                free(pSrc);
-               pSrc = NULL;
        }
 }
 
-void
-_ContentUtility::DoSafeDelete(String* pSrc)
-{
-       if (pSrc != NULL)
-       {
-               delete pSrc;
-               pSrc = NULL;
-       }
-}
-
-// fills contentinfo information in the content data object.
+// Fills ContentInfo information in the content data object.
 result
-_ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_ContentData* pContentData)
+_ContentUtility::FillContentData(media_info_h mediaHandle, _ContentInfoImpl* pInfoImpl)
 {
-
-       SysTryReturnResult(NID_CNT, mediaHandle != null && pContentData != null, E_INVALID_ARG, "mediaHandle or pContentData is null.");
+       SysTryReturnResult(NID_CNT, mediaHandle != null && pInfoImpl != null, E_INVALID_ARG, "mediaHandle or pInfoImpl is null.");
 
        int ret  = MEDIA_CONTENT_ERROR_NONE;
        result r = E_SUCCESS;
@@ -100,6 +94,7 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_Content
        double latitude         = 0;
        double longitude        = 0;
        double altitude         = 0;
+       Coordinates coordinates;
 
        bool isDrm = 0;
 
@@ -251,111 +246,133 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_Content
 
        if (pMediaId.get() != null)
        {
-               r = UuId::Parse(String(pMediaId.get()), pContentData->contentId);
+               ContentId contentId;
+
+               r = UuId::Parse(String(pMediaId.get()), contentId);
                SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform UuId::Parse operation.");
+
+               pInfoImpl->SetContentId(contentId);
        }
 
-       pContentData->isDrm = isDrm;
-       SysLog(NID_CNT, "pContentData->isDrm = %d", pContentData->isDrm);
+       pInfoImpl->SetDrmProtected(isDrm);
+       SysLog(NID_CNT, "pContentInfoImpl->isDrm = %d", pInfoImpl->IsDrmProtected());
 
-       pContentData->contentSize       = contentSize;
-       SysLog(NID_CNT, "pContentData->contentSize = %lu", pContentData->contentSize);
+       pInfoImpl->SetContentSize(contentSize);
+       SysLog(NID_CNT, "pContentInfoImpl->contentSize = %lu", pInfoImpl->GetContentSize());
 
        if (Double::Compare(latitude, DEFAULT_COORDINATE) != 0)
        {
-               pContentData->latitude          = latitude;
+               pInfoImpl->SetLatitude(latitude);
+               coordinates.SetLatitude(latitude);
        }
        if (Double::Compare(longitude, DEFAULT_COORDINATE) != 0)
        {
-               pContentData->longitude         = longitude;
+               pInfoImpl->SetLongitude(longitude);
+               coordinates.SetLongitude(longitude);
        }
        if (Double::Compare(altitude, DEFAULT_COORDINATE) != 0)
        {
-               pContentData->altitude          = altitude;
+               pInfoImpl->SetAltitude(altitude);
+               coordinates.SetAltitude(altitude);
        }
 
+       pInfoImpl->SetCoordinates(coordinates);
+
        if (pMediaPath.get() != NULL)
        {
-               pContentData->contentPath       = String(pMediaPath.get());
-               SysSecureLog(NID_CNT, "pContentData->contentPath = %ls", pContentData->contentPath.GetPointer());
+               String contentPath(pMediaPath.get());
+
+               pInfoImpl->SetContentPath(contentPath);
+               SysSecureLog(NID_CNT, "pContentInfoImpl->contentPath = %ls", (pInfoImpl->GetContentPath()).GetPointer());
        }
 
        if (pThumbnailPath.get() != NULL)
        {
-               pContentData->pThumbnailPath    = new (std::nothrow) String(pThumbnailPath.get());
-               SysTryReturnResult(NID_CNT, pContentData->pThumbnailPath != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysSecureLog(NID_CNT, "pContentData->pThumbnailPath = %ls", pContentData->pThumbnailPath->GetPointer());
+               String thumbnailPath(pThumbnailPath.get());
+
+               pInfoImpl->SetThumbnailPath(thumbnailPath);
+               SysSecureLog(NID_CNT, "pContentInfoImpl->pThumbnailPath = %ls", (pInfoImpl->GetThumbnailPath()).GetPointer());
        }
 
        if (pAuthor.get() != NULL)
        {
-               pContentData->pAuthor           = new (std::nothrow) String(pAuthor.get());
-               SysTryReturnResult(NID_CNT, pContentData->pAuthor != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pAuthor = %ls", pContentData->pAuthor->GetPointer());
+               String author(pAuthor.get());
+
+               pInfoImpl->SetAuthor(author);
+               SysLog(NID_CNT, "pContentInfoImpl->pAuthor = %ls", (pInfoImpl->GetAuthor()).GetPointer());
        }
 
        if (pCategory.get() != NULL)
        {
-               pContentData->pCategory         = new (std::nothrow) String(pCategory.get());
-               SysTryReturnResult(NID_CNT, pContentData->pCategory != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pCategory = %ls", pContentData->pCategory->GetPointer());
+               String category(pCategory.get());
+
+               pInfoImpl->SetCategory(category);
+               SysLog(NID_CNT, "pContentInfoImpl->pCategory = %ls", (pInfoImpl->GetCategory()).GetPointer());
        }
 
        if (pContentName.get() != NULL)
        {
-               pContentData->pContentName      = new (std::nothrow) String(pContentName.get());
-               SysTryReturnResult(NID_CNT, pContentData->pContentName != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pContentName = %ls", pContentData->pContentName->GetPointer());
+               String contentName(pContentName.get());
+
+               pInfoImpl->SetContentName(contentName);
+               SysLog(NID_CNT, "pContentInfoImpl->pContentName = %ls", (pInfoImpl->GetContentName()).GetPointer());
        }
 
        if (pDescription.get() != NULL)
        {
-               pContentData->pDescription      = new (std::nothrow) String(pDescription.get());
-               SysTryReturnResult(NID_CNT, pContentData->pDescription != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pDescription = %ls", pContentData->pDescription->GetPointer());
+               String description(pDescription.get());
+
+               pInfoImpl->SetDescription(description);
+               SysLog(NID_CNT, "pContentInfoImpl->pDescription = %ls", (pInfoImpl->GetDescription()).GetPointer());
        }
 
        if (pLocationTag.get() != NULL)
        {
-               pContentData->pLocationTag      = new (std::nothrow) String(pLocationTag.get());
-               SysTryReturnResult(NID_CNT, pContentData->pLocationTag != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pLocationTag = %ls", pContentData->pLocationTag->GetPointer());
+               String locationTag(pLocationTag.get());
+
+               pInfoImpl->SetLocationTag(locationTag);
+               SysLog(NID_CNT, "pContentInfoImpl->pLocationTag = %ls", (pInfoImpl->GetLocationTag()).GetPointer());
        }
 
        if (pProvider.get() != NULL)
        {
-               pContentData->pProvider         = new (std::nothrow) String(pProvider.get());
-               SysTryReturnResult(NID_CNT, pContentData->pProvider != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pProvider = %ls", pContentData->pProvider->GetPointer());
+               String provider(pProvider.get());
+
+               pInfoImpl->SetProvider(provider);
+               SysLog(NID_CNT, "pContentInfoImpl->pProvider = %ls", (pInfoImpl->GetProvider()).GetPointer());
        }
 
        if (pContentRating.get() != NULL)
        {
-               pContentData->pRating           = new (std::nothrow) String(pContentRating.get());
-               SysTryReturnResult(NID_CNT, pContentData->pRating != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pRating = %ls", pContentData->pRating->GetPointer());
+               String rating(pContentRating.get());
+
+               pInfoImpl->SetRating(rating);
+               SysLog(NID_CNT, "pContentInfoImpl->pRating = %ls", (pInfoImpl->GetRating()).GetPointer());
        }
 
        if (pKeyword.get() != NULL)
        {
-               pContentData->pKeyword  = new (std::nothrow) String(pKeyword.get());
-               SysTryReturnResult(NID_CNT, pContentData->pKeyword != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pContentData->pKeyword = %ls", pContentData->pKeyword->GetPointer());
+               String keyword(pKeyword.get());
+
+               pInfoImpl->SetKeyword(keyword);
+               SysLog(NID_CNT, "pContentInfoImpl->pKeyword = %ls", (pInfoImpl->GetKeyword()).GetPointer());
        }
 
        if (pMimeType.get() != NULL)
        {
-               pContentData->mimeType  = String(pMimeType.get());
-               SysLog(NID_CNT, "pContentData->mimeType = %ls", (pContentData->mimeType).GetPointer());
+               String mimeType(pMimeType.get());
+
+               pInfoImpl->SetMimeType(mimeType);
+               SysLog(NID_CNT, "pContentInfoImpl->mimeType = %ls", (pInfoImpl->GetMimeType()).GetPointer());
        }
 
        switch (storageType)
        {
        case MEDIA_CONTENT_STORAGE_INTERNAL:
-               pContentData->storageType = 0;
+               pInfoImpl->SetStorageType(0);
                break;
        case MEDIA_CONTENT_STORAGE_EXTERNAL:
-               pContentData->storageType = 1;
+               pInfoImpl->SetStorageType(1);
                break;
        default:
                break;
@@ -363,40 +380,44 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_Content
        switch (mediaType)
        {
        case MEDIA_CONTENT_TYPE_OTHERS:
-               pContentData->contentType       = CONTENT_TYPE_OTHER;
+               pInfoImpl->SetContentType(CONTENT_TYPE_OTHER);
                break;
        case MEDIA_CONTENT_TYPE_IMAGE:
-               pContentData->contentType       = CONTENT_TYPE_IMAGE;
+               pInfoImpl->SetContentType(CONTENT_TYPE_IMAGE);
                break;
        case MEDIA_CONTENT_TYPE_SOUND:
                //fall through
        case MEDIA_CONTENT_TYPE_MUSIC:
-               pContentData->contentType       = CONTENT_TYPE_AUDIO;
+               pInfoImpl->SetContentType(CONTENT_TYPE_AUDIO);
                break;
        case MEDIA_CONTENT_TYPE_VIDEO:
-               pContentData->contentType       = CONTENT_TYPE_VIDEO;
+               pInfoImpl->SetContentType(CONTENT_TYPE_VIDEO);
                break;
        default:
                break;
        }
 
-       r = (pContentData->dateTime).SetValue(1970, 1, 1);
+       DateTime dt;
+
+       r = dt.SetValue(1970, 1, 1);
        SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform datetime.SetValue operation.");
 
-       r = (pContentData->dateTime).AddSeconds(addedTime);// need to check addedTime is secs/millisec
+       r = dt.AddSeconds(addedTime);// need to check addedTime is secs/millisec
        SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform datetime.AddSeconds operation.");
 
+       pInfoImpl->SetDateTime(dt);
+
        SysLog(NID_CNT, "addedTime = %ld", addedTime);
-       SysLog(NID_CNT, "pContentData->dateTime : %ls", pContentData->dateTime.ToString().GetPointer());
+       SysLog(NID_CNT, "pContentInfoImpl->dateTime : %ls", (pInfoImpl->GetDateTime()).ToString().GetPointer());
 
        return r;
 }
 
-// fills Imagecontentinfo information in the image content data object .
+// Fills ImageContentInfo information in the image content data object .
 result
-_ContentUtility::FillImageContentData(media_info_h mediaHandle, ImageContentInfo::_ImageContentData* pImageContentData)
+_ContentUtility::FillImageContentData(media_info_h mediaHandle, _ImageContentInfoImpl* pImageContentInfoImpl)
 {
-       SysTryReturnResult(NID_CNT, mediaHandle != null && pImageContentData != null, E_INVALID_ARG, "mediaHandle or pImageContentData is null.");
+       SysTryReturnResult(NID_CNT, mediaHandle != null && pImageContentInfoImpl != null, E_INVALID_ARG, "mediaHandle or pImageContentInfoImpl is null.");
 
        int ret  = MEDIA_CONTENT_ERROR_NONE;
        result r = E_SUCCESS;
@@ -433,9 +454,9 @@ _ContentUtility::FillImageContentData(media_info_h mediaHandle, ImageContentInfo
        ret = image_meta_get_height(pImageHandle.get(), &height);
        SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform image_meta_get_height operation.");
 
-       pImageContentData->width        = width;
-       pImageContentData->height = height;
-       pImageContentData->orientationType      = static_cast<ImageOrientationType>(orientation);
+       pImageContentInfoImpl->SetWidth(width);
+       pImageContentInfoImpl->SetHeight(height);
+       pImageContentInfoImpl->SetOrientation(static_cast< ImageOrientationType >(orientation));
 
        if (pDisplayName != NULL)
        {
@@ -455,18 +476,18 @@ _ContentUtility::FillImageContentData(media_info_h mediaHandle, ImageContentInfo
                        r = E_SUCCESS;
                        fileName = strTitle;
                }
-               pImageContentData->title = fileName;
-               SysLog(NID_CNT, "pImageContentData->title = %ls", pImageContentData->title.GetPointer());
+               pImageContentInfoImpl->SetTitle(fileName);
+               SysLog(NID_CNT, "pImageContentInfoImpl->title = %ls", (pImageContentInfoImpl->GetTitle()).GetPointer());
        }
 
        return r;
 }
 
-// fills audio contentinfo information in the audio content data object.
+// Fills AudioContentInfo information in the audio content data object.
 result
-_ContentUtility::FillAudioContentData(media_info_h mediaHandle, AudioContentInfo::_AudioContentData* pAudioContentData)
+_ContentUtility::FillAudioContentData(media_info_h mediaHandle, _AudioContentInfoImpl* pAudioContentInfoImpl)
 {
-       SysTryReturnResult(NID_CNT, mediaHandle != null && pAudioContentData != null, E_INVALID_ARG, "mediaHandle or pAudioContentData is null.");
+       SysTryReturnResult(NID_CNT, mediaHandle != null && pAudioContentInfoImpl != null, E_INVALID_ARG, "mediaHandle or pAudioContentInfoImpl is null.");
 
        int ret  = MEDIA_CONTENT_ERROR_NONE;
        result r = E_SUCCESS;
@@ -577,86 +598,83 @@ _ContentUtility::FillAudioContentData(media_info_h mediaHandle, AudioContentInfo
        ret = audio_meta_get_duration(pAudioHandle.get(), &duration);
        SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform audio_meta_get_duration operation.");
 
-       pAudioContentData->bitrate      = bitrate;
+       pAudioContentInfoImpl->SetBitrate(bitrate);
 
        if (pYear.get() != null)
        {
-               SysLog(NID_CNT, "pAudioContentData->pYear  = %s", pYear.get());
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pYear  = %s", pYear.get());
 
                String strYear(pYear.get());
                if (strYear.CompareTo(L"Unknown") != 0)
                {
-                       r = Integer::Parse(strYear, pAudioContentData->releaseYear);
+                       int releaseYear = 0;
+
+                       r = Integer::Parse(strYear, releaseYear);
                        if (IsFailed(r))
                        {
                                // It is one of the metadata. If error occurs, skip it for other metadata.
-                               pAudioContentData->releaseYear = 0;
+                               pAudioContentInfoImpl->SetReleaseYear(0);
                                r = E_SUCCESS;
-                               SysLog(NID_CNT, "pAudioContentData->pYear(invalid data) = %ls", strYear.GetPointer());
+                               SysLog(NID_CNT, "pAudioContentInfoImpl->pYear(invalid data) = %ls", strYear.GetPointer());
                        }
+
+                       pAudioContentInfoImpl->SetReleaseYear(releaseYear);
                }
        }
 
        if (pTitle.get() != NULL)
        {
-               pAudioContentData->pTitle = new (std::nothrow) String(pTitle.get());
-               SysTryReturnResult(NID_CNT, pAudioContentData->pTitle != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pAudioContentData->pTitle  = %ls", pAudioContentData->pTitle->GetPointer());
+               pAudioContentInfoImpl->SetTitle(String(pTitle.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pTitle  = %ls", (pAudioContentInfoImpl->GetTitle()).GetPointer());
        }
 
        if (pArtistName.get() != NULL)
        {
-               pAudioContentData->pArtist      = new (std::nothrow) String(pArtistName.get());
-               SysTryReturnResult(NID_CNT, pAudioContentData->pArtist != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pAudioContentData->pArtist = %ls", pAudioContentData->pArtist->GetPointer());
+               pAudioContentInfoImpl->SetArtist(String(pArtistName.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pArtist = %ls", (pAudioContentInfoImpl->GetArtist()).GetPointer());
        }
 
        if (pGenreName.get() != NULL)
        {
-               pAudioContentData->pGenre       = new (std::nothrow) String(pGenreName.get());
-               SysTryReturnResult(NID_CNT, pAudioContentData->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pAudioContentData->pGenre = %ls", pAudioContentData->pGenre->GetPointer());
+               pAudioContentInfoImpl->SetGenre(String(pGenreName.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pGenre = %ls", (pAudioContentInfoImpl->GetGenre()).GetPointer());
        }
 
        if (pComposerName.get() != NULL)
        {
-               pAudioContentData->pComposer    = new (std::nothrow) String(pComposerName.get());
-               SysTryReturnResult(NID_CNT, pAudioContentData->pComposer != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pAudioContentData->pComposer = %ls", pAudioContentData->pComposer->GetPointer());
+               pAudioContentInfoImpl->SetComposer(String(pComposerName.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pComposer = %ls", (pAudioContentInfoImpl->GetComposer()).GetPointer());
        }
 
        if (pAlbumName.get() != NULL)
        {
-               pAudioContentData->pAlbumName   = new (std::nothrow) String(pAlbumName.get());
-               SysTryReturnResult(NID_CNT, pAudioContentData->pAlbumName != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pAudioContentData->pAlbumName  = %ls", pAudioContentData->pAlbumName->GetPointer());
+               pAudioContentInfoImpl->SetAlbumName(String(pAlbumName.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pAlbumName  = %ls", (pAudioContentInfoImpl->GetAlbumName()).GetPointer());
        }
 
        if (pCopyRight.get() != NULL)
        {
-               pAudioContentData->pCopyright   = new (std::nothrow) String(pCopyRight.get());
-               SysTryReturnResult(NID_CNT, pAudioContentData->pCopyright != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pAudioContentData->pCopyright  = %ls", pAudioContentData->pCopyright->GetPointer());
+               pAudioContentInfoImpl->SetCopyright(String(pCopyRight.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pCopyright  = %ls", (pAudioContentInfoImpl->GetCopyright()).GetPointer());
        }
 
        if (pTrackNum.get() != NULL)
        {
-               pAudioContentData->pTrackInfo   = new (std::nothrow) String(pTrackNum.get());
-               SysTryReturnResult(NID_CNT, pAudioContentData->pTrackInfo != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pAudioContentData->pTrackInfo  = %ls", pAudioContentData->pTrackInfo->GetPointer());
+               pAudioContentInfoImpl->SetTrackInfo(String(pTrackNum.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pTrackInfo  = %ls", (pAudioContentInfoImpl->GetTrackInfo()).GetPointer());
        }
 
-       pAudioContentData->duration = duration;
-       SysLog(NID_CNT,"pAudioContentData->duration = %d", pAudioContentData->duration);
+       pAudioContentInfoImpl->SetDuration(duration);
+       SysLog(NID_CNT,"pAudioContentInfoImpl->duration = %d", pAudioContentInfoImpl->GetDuration());
 
        return r;
 }
 
-// fills video contentinfo information in the video content data object.
+// Fills VideoContentInfo information in the video content data object.
 result
-_ContentUtility::FillVideoContentData(media_info_h mediaHandle, VideoContentInfo::_VideoContentData* pVideoContentData)
+_ContentUtility::FillVideoContentData(media_info_h mediaHandle, _VideoContentInfoImpl* pVideoContentInfoImpl)
 {
-       SysTryReturnResult(NID_CNT, mediaHandle != null && pVideoContentData != null, E_INVALID_ARG, "mediaHandle or pVideoContentData is null.");
+       SysTryReturnResult(NID_CNT, mediaHandle != null && pVideoContentInfoImpl != null, E_INVALID_ARG, "mediaHandle or pVideoContentInfoImpl is null.");
 
        int ret  = MEDIA_CONTENT_ERROR_NONE;
        result r = E_SUCCESS;
@@ -726,44 +744,49 @@ _ContentUtility::FillVideoContentData(media_info_h mediaHandle, VideoContentInfo
        ret = video_meta_get_duration(pVideoHandle.get(), &duration);
        SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform video_meta_get_duration operation.");
 
-       pVideoContentData->width = width;
-       pVideoContentData->height = height;
+       pVideoContentInfoImpl->SetWidth(width);
+       pVideoContentInfoImpl->SetHeight(height);
 
        if (pTitle.get() != NULL)
        {
-               pVideoContentData->pTitle  = new (std::nothrow) String(pTitle.get());
-               SysTryReturnResult(NID_CNT, pVideoContentData->pTitle != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pVideoContentData->pTitle = %ls", pVideoContentData->pTitle->GetPointer());
+               pVideoContentInfoImpl->SetTitle(String(pTitle.get()));
+               SysLog(NID_CNT, "pVideoContentInfoImpl->pTitle = %ls", (pVideoContentInfoImpl->GetTitle()).GetPointer());
        }
 
        if (pArtistName.get() != NULL)
        {
-               pVideoContentData->pArtist = new (std::nothrow) String(pArtistName.get());
-               SysTryReturnResult(NID_CNT, pVideoContentData->pArtist != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pVideoContentData->pArtist = %ls", pVideoContentData->pArtist->GetPointer());
+               pVideoContentInfoImpl->SetArtist(String(pArtistName.get()));
+               SysLog(NID_CNT, "pVideoContentInfoImpl->pArtist = %ls", (pVideoContentInfoImpl->GetArtist()).GetPointer());
        }
 
        if (pGenreName.get() != NULL)
        {
-               pVideoContentData->pGenre  = new (std::nothrow) String(pGenreName.get());
-               SysTryReturnResult(NID_CNT, pVideoContentData->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pVideoContentData->pGenre = %ls", pVideoContentData->pGenre->GetPointer());
+               pVideoContentInfoImpl->SetGenre(String(pGenreName.get()));
+               SysLog(NID_CNT, "pVideoContentInfoImpl->pGenre = %ls", (pVideoContentInfoImpl->GetGenre()).GetPointer());
        }
 
        if (pAlbumName.get() != NULL)
        {
-               pVideoContentData->pAlbumName  = new (std::nothrow) String(pAlbumName.get());
-               SysTryReturnResult(NID_CNT, pVideoContentData->pAlbumName != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-               SysLog(NID_CNT, "pVideoContentData->pAlbumName = %ls", pVideoContentData->pAlbumName->GetPointer());
+               pVideoContentInfoImpl->SetAlbumName(String(pAlbumName.get()));
+               SysLog(NID_CNT, "pVideoContentInfoImpl->pAlbumName = %ls", (pVideoContentInfoImpl->GetAlbumName()).GetPointer());
        }
 
-       pVideoContentData->duration = duration;
-       SysLog(NID_CNT,"pVideoContentData->duration = %d", pVideoContentData->duration);
+       pVideoContentInfoImpl->SetDuration(duration);
+       SysLog(NID_CNT,"pVideoContentInfoImpl->duration = %d", pVideoContentInfoImpl->GetDuration());
+
+       // Get from metadata extractor (framerate, audio bitrate, video bitrate)
+       VideoMetadata* pVideoMetadata = ContentManagerUtil::GetVideoMetaN(pVideoContentInfoImpl->GetContentPath());
+       r = GetLastResult();
+       SysTryReturnResult(NID_CNT, pVideoMetadata != null, r, "GetVideoMetadata() failed.");
+
+       pVideoContentInfoImpl->SetFramerate(pVideoMetadata->GetFramerate());
+       pVideoContentInfoImpl->SetAudioBitrate(pVideoMetadata->GetAudioBitrate());
+       pVideoContentInfoImpl->SetVideoBitrate(pVideoMetadata->GetVideoBitrate());
 
        return r;
 }
 
-// Convertion of system errors to osp errors
+// Conversion of system errors to native errors
 result
 _ContentUtility::MapCoreErrorToNativeResult(int reason)
 {
index 68d55c5..94989e3 100644 (file)
@@ -444,10 +444,7 @@ CATCH:
 result
 _DownloadManagerImpl::Pause(RequestId reqId)
 {
-       result r = E_SUCCESS;
-
        int ret = 0;
-       int state = STATE_NONE;
 
        // Pause the download request
        ret = download_pause((int)reqId);
@@ -462,10 +459,7 @@ _DownloadManagerImpl::Pause(RequestId reqId)
 result
 _DownloadManagerImpl::Resume(RequestId reqId)
 {
-       result r = E_SUCCESS;
-
        int ret = 0;
-       int state = STATE_NONE;
 
        // Resume the download request
        ret = download_start((int)reqId);
@@ -481,7 +475,6 @@ result
 _DownloadManagerImpl::Cancel(RequestId reqId)
 {
        int ret = 0;
-       int state = STATE_NONE;
 
        // Stop the download request
        ret = download_cancel((int)reqId);
@@ -655,7 +648,6 @@ void
 _DownloadManagerImpl::DestroyResources(RequestId reqId)
 {
        int ret = 0;
-       result r = E_SUCCESS;
 
        // Cancel the callback
        UnregisterCallback(reqId);
diff --git a/src/FCnt_ImageContentInfoImpl.cpp b/src/FCnt_ImageContentInfoImpl.cpp
new file mode 100644 (file)
index 0000000..5559904
--- /dev/null
@@ -0,0 +1,210 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCnt_ImageContentInfoImpl.cpp
+ * @brief              This is the implementation file for the %_ImageContentInfoImpl class.
+ *
+ * This file contains implementation of the %_ImageContentInfoImpl class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FIoFile.h>
+#include <FIoDirectory.h>
+#include <FSysEnvironment.h>
+#include <FIo_FileImpl.h>
+#include <FApp_AppInfo.h>
+#include "FCnt_ImageContentInfoImpl.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Locations;
+using namespace Tizen::System;
+
+namespace Tizen { namespace Content
+{
+
+_ImageContentInfoImpl::_ImageContentInfoImpl(void)
+       : __width(0)
+       , __height(0)
+       , __orientationType(IMAGE_ORIENTATION_TYPE_UNKNOWN)
+       , __title(L"")
+{
+
+}
+
+_ImageContentInfoImpl::~_ImageContentInfoImpl(void)
+{
+
+}
+
+_ImageContentInfoImpl*
+_ImageContentInfoImpl::GetInstance(ImageContentInfo& imageContentInfo)
+{
+       return imageContentInfo.__pImageContentInfoImpl;
+}
+
+const _ImageContentInfoImpl*
+_ImageContentInfoImpl::GetInstance(const ImageContentInfo& imageContentInfo)
+{
+       return imageContentInfo.__pImageContentInfoImpl;
+}
+
+result
+_ImageContentInfoImpl::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
+{
+       result r = E_SUCCESS;
+       int contentLength = 0;
+       FileAttributes attribute;
+
+       // checks parameters
+       contentLength = contentPath.GetLength();
+       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
+                       "The contentPath should start with /Media or /Storagecard/Media.");
+       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                       "The file corresponding to contentPath could not be found.");
+
+       if (!thumbnailPath.IsEmpty())
+       {
+               SysLog(NID_CNT,
+                               "The thumbnailPath is not supported but you can get the thumbnail managed by Tizen from ContentInfo::GetThumbnailN().");
+       }
+
+       if (setGps)
+       {
+               SysLog(NID_CNT, "The setGps is not supported.");
+       }
+
+       SetContentPath(contentPath);
+       SetContentType(CONTENT_TYPE_IMAGE);
+
+       return r;
+}
+
+result
+_ImageContentInfoImpl::Construct(const String* pContentPath)
+{
+       result r = E_SUCCESS;
+
+       if (pContentPath != null)
+       {
+               String contentPath(*pContentPath);
+
+               if (!_AppInfo::IsOspCompat())
+               {
+                       if (!(contentPath.StartsWith(Environment::GetMediaPath(), 0)
+                               || contentPath.StartsWith(Environment::GetExternalStoragePath(), 0)))
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] The path is not supported.");
+                               return E_INVALID_ARG;
+                       }
+               }
+               else
+               {
+                       // prior to 2.0
+                       if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
+                       {
+                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
+                               // it should be converted in 2.0.
+                               r = contentPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
+                       {
+                               r = contentPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG,
+                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
+                               return E_INVALID_ARG;
+                       }
+               }
+
+               int length = contentPath.GetLength();
+               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
+                               "The length of pContentPath is 0.");
+               SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                               "The file corresponding to pContentPath could not be found.");
+
+               SetContentPath(contentPath);
+               SetContentType(CONTENT_TYPE_IMAGE);
+       }
+       else
+       {
+               SetContentType(CONTENT_TYPE_IMAGE);
+       }
+
+       return r;
+}
+
+int
+_ImageContentInfoImpl::GetWidth(void) const
+{
+       return __width;
+}
+
+int
+_ImageContentInfoImpl::GetHeight(void) const
+{
+       return __height;
+}
+
+ImageOrientationType
+_ImageContentInfoImpl::GetOrientation(void) const
+{
+       return __orientationType;
+}
+
+String
+_ImageContentInfoImpl::GetTitle(void) const
+{
+       if (__title.IsEmpty())
+       {
+               SysLog(NID_CNT, "Title is empty.");
+               return L"Unknown";
+       }
+
+       return __title;
+}
+
+void
+_ImageContentInfoImpl::SetWidth(int width)
+{
+       __width = width;
+}
+
+void
+_ImageContentInfoImpl::SetHeight(int height)
+{
+       __height = height;
+}
+
+void
+_ImageContentInfoImpl::SetTitle(const String& title)
+{
+       __title = title;
+}
+
+void
+_ImageContentInfoImpl::SetOrientation(const ImageOrientationType& orientationType)
+{
+       __orientationType = orientationType;
+}
+
+}}
diff --git a/src/FCnt_OtherContentInfoImpl.cpp b/src/FCnt_OtherContentInfoImpl.cpp
new file mode 100644 (file)
index 0000000..e423305
--- /dev/null
@@ -0,0 +1,149 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCnt_OtherContentInfoImpl.cpp
+ * @brief              This is the implementation file for the %_OtherContentInfoImpl class.
+ *
+ * This file contains implementation of the %_OtherContentInfoImpl class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FIoDirectory.h>
+#include <FIoFile.h>
+#include <FSysEnvironment.h>
+#include <FApp_AppInfo.h>
+#include <FIo_FileImpl.h>
+#include "FCnt_OtherContentInfoImpl.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::System;
+
+namespace Tizen { namespace Content
+{
+
+_OtherContentInfoImpl::_OtherContentInfoImpl(void)
+{
+
+}
+
+_OtherContentInfoImpl::~_OtherContentInfoImpl(void)
+{
+
+}
+
+_OtherContentInfoImpl*
+_OtherContentInfoImpl::GetInstance(OtherContentInfo& otherContentInfo)
+{
+       return otherContentInfo.__pOtherContentInfoImpl;
+}
+
+const _OtherContentInfoImpl*
+_OtherContentInfoImpl::GetInstance(const OtherContentInfo& otherContentInfo)
+{
+       return otherContentInfo.__pOtherContentInfoImpl;
+}
+
+result
+_OtherContentInfoImpl::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
+{
+       result r = E_SUCCESS;
+       int contentLength = 0;
+       FileAttributes attribute;
+
+       // checks parameters
+       contentLength = contentPath.GetLength();
+       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
+                       "The contentPath should start with /Media or /Storagecard/Media.");
+       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                       "The file corresponding to contentPath could not be found.");
+
+       if (thumbnailPath.GetLength() > 0)
+       {
+               SysLog(NID_CNT, "The thumbnailPath is not supported.");
+       }
+
+       if (setGps)
+       {
+               SysLog(NID_CNT, "The setGps is not supported.");
+       }
+
+       SetContentPath(contentPath);
+       SetContentType(CONTENT_TYPE_OTHER);
+
+       return r;
+}
+
+result
+_OtherContentInfoImpl::Construct(const String* pContentPath)
+{
+       result r = E_SUCCESS;
+
+       if (pContentPath != null)
+       {
+               String contentPath(*pContentPath);
+
+               if (!_AppInfo::IsOspCompat())
+               {
+                       if (!(contentPath.StartsWith(Environment::GetMediaPath(), 0)
+                               || contentPath.StartsWith(Environment::GetExternalStoragePath(), 0)))
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] The path is not supported.");
+                               return E_INVALID_ARG;
+                       }
+               }
+               else
+               {
+                       // prior to 2.0
+                       if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
+                       {
+                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
+                               // it should be converted in 2.0.
+                               r = contentPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
+                       {
+                               r = contentPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG,
+                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
+                               return E_INVALID_ARG;
+                       }
+               }
+
+               int length = contentPath.GetLength();
+               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
+                               "The length of pContentPath is 0.");
+               SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                               "The file corresponding to pContentPath could not be found.");
+
+               SetContentPath(contentPath);
+               SetContentType(CONTENT_TYPE_OTHER);
+       }
+       else
+       {
+               SetContentType(CONTENT_TYPE_OTHER);
+       }
+
+       return r;
+}
+
+}}
index 84483c1..666c4e7 100644 (file)
  * This file contains implementation of the %_PlayListImpl class.
  */
 
+#include <new>
 #include <FBaseSysLog.h>
 #include <FBaseInteger.h>
 #include <FBaseLongLong.h>
 #include <FBaseFloat.h>
 #include <FCntPlayList.h>
 #include <FBase_StringConverter.h>
-#include <FCnt_PlayListImpl.h>
-#include <FCnt_ContentUtility.h>
+#include "FCnt_PlayListImpl.h"
+#include "FCnt_ContentUtility.h"
+#include "FCnt_ImageContentInfoImpl.h"
+#include "FCnt_AudioContentInfoImpl.h"
+#include "FCnt_VideoContentInfoImpl.h"
+#include "FCnt_OtherContentInfoImpl.h"
+#include "FCnt_ContentInfoHelper.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -45,8 +51,7 @@ namespace Tizen { namespace Content
        bool PlaylistItemsCb(int playlistId, media_info_h media, void *pUserData);
 
 _PlayListImpl::_PlayListImpl(void)
-       : Object()
-       , __pFilterHandle(NULL)
+       : __pFilterHandle(NULL)
        , __playListName(L"")
 {
 
@@ -323,16 +328,16 @@ _PlayListImpl::FillPlayListInfo(int playlistId, ArrayList* pPlayListItemList) co
        GList* pTemp = NULL;
        std::unique_ptr<media_info_s, MediaHandleDeleter> pMediaHandle;
 
-       ContentInfo::_ContentData* pContentData = null;
-       ImageContentInfo::_ImageContentData* pImageContentData = null;
-       AudioContentInfo::_AudioContentData* pAudioContentData = null;
-       VideoContentInfo::_VideoContentData* pVideoContentData = null;
-
        std::unique_ptr<ImageContentInfo> pImageContentInfo;
        std::unique_ptr<AudioContentInfo> pAudioContentInfo;
        std::unique_ptr<VideoContentInfo> pVideoContentInfo;
        std::unique_ptr<OtherContentInfo> pOtherContentInfo;
 
+       _ImageContentInfoImpl* pImageContentInfoImpl = null;
+       _AudioContentInfoImpl* pAudioContentInfoImpl = null;
+       _VideoContentInfoImpl* pVideoContentInfoImpl = null;
+       _OtherContentInfoImpl* pOtherContentInfoImpl = null;
+
        //SysTryReturn(NID_CNT, pPlayListItemList != NULL , r, r, "[E_SUCCESS] pPlayListItemList is null");
 
        pTemp = pItemList.get();
@@ -352,23 +357,37 @@ _PlayListImpl::FillPlayListInfo(int playlistId, ArrayList* pPlayListItemList) co
                        r = MapCoreErrorToNativeResult(ret);
                        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_info_get_media_type.");
 
+                       std::unique_ptr<char, UtilCharDeleter> pMediaPath;
+                       char* pTempPath = null;
+
+                       ret = media_info_get_file_path(pMediaHandle.get(), &pTempPath);
+                       r = MapCoreErrorToNativeResult(ret);
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform media_info_get_file_path operation.");
+
+                       pMediaPath.reset(pTempPath);
+                       String contentPath(pMediaPath.get());
+
                        switch (mediaType)
                        {
                        case MEDIA_CONTENT_TYPE_IMAGE:
                                pImageContentInfo = std::unique_ptr<ImageContentInfo>(new (std::nothrow) ImageContentInfo);
                                SysTryReturnResult(NID_CNT, pImageContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pImageContentInfo.");
 
-                               pContentData = pImageContentInfo->GetContentData();
-                               SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                               r = pImageContentInfo->Construct(&contentPath);
+                               r = ConvertErrorToResult(r);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to ImageContentInfo.");
 
-                               pImageContentData = pImageContentInfo->GetImageContentData();
-                               SysTryReturnResult(NID_CNT, pImageContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                               pImageContentInfoImpl = null;
+                               pImageContentInfoImpl = _ImageContentInfoImpl::GetInstance(*(pImageContentInfo.get()));
+                               SysTryReturnResult(NID_CNT, pImageContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pImageContentInfoImpl.");
 
-                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pImageContentInfoImpl);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_DATABASE, "Failed to perform FillContentData operation.");
 
-                               r = _ContentUtility::FillImageContentData(pMediaHandle.get(), pImageContentData);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform GetDataFromImageTable operation.");
+                               r = _ContentUtility::FillImageContentData(pMediaHandle.get(), pImageContentInfoImpl);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_DATABASE, "Failed to perform GetDataFromImageTable operation.");
+
+                               _ContentInfoHelper::SetContentInfoImpl(pImageContentInfo.get(), pImageContentInfoImpl);
 
                                // Shallow copy, adds just the pointer: not the element
                                r = pPlayListItemList->Add(*(pImageContentInfo.release()));
@@ -381,17 +400,21 @@ _PlayListImpl::FillPlayListInfo(int playlistId, ArrayList* pPlayListItemList) co
                                pAudioContentInfo = std::unique_ptr<AudioContentInfo>(new (std::nothrow) AudioContentInfo);
                                SysTryReturnResult(NID_CNT, pAudioContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pAudioContentInfo.");
 
-                               pContentData = pAudioContentInfo->GetContentData();
-                               SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                               r = pAudioContentInfo->Construct(&contentPath);
+                               r = ConvertErrorToResult(r);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to AudioContentInfo.");
+
+                               pAudioContentInfoImpl = null;
+                               pAudioContentInfoImpl = _AudioContentInfoImpl::GetInstance(*(pAudioContentInfo.get()));
+                               SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pAudioContentInfoImpl.");
 
-                               pAudioContentData = pAudioContentInfo->GetAudioContentData();
-                               SysTryReturnResult(NID_CNT, pAudioContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pAudioContentInfoImpl);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_DATABASE, "Failed to perform FillContentData operation.");
 
-                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+                               r = _ContentUtility::FillAudioContentData(pMediaHandle.get(), pAudioContentInfoImpl);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_DATABASE, "Failed to perform FillAudioContentData operation.");
 
-                               r = _ContentUtility::FillAudioContentData(pMediaHandle.get(), pAudioContentData);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillAudioContentData operation.");
+                               _ContentInfoHelper::SetContentInfoImpl(pAudioContentInfo.get(), pAudioContentInfoImpl);
 
                                // Shallow copy, adds just the pointer: not the element
                                r = pPlayListItemList->Add(*(pAudioContentInfo.release()));
@@ -402,17 +425,21 @@ _PlayListImpl::FillPlayListInfo(int playlistId, ArrayList* pPlayListItemList) co
                                pVideoContentInfo = std::unique_ptr<VideoContentInfo>(new (std::nothrow) VideoContentInfo);
                                SysTryReturnResult(NID_CNT, pVideoContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pVideoContentInfo.");
 
-                               pContentData = pVideoContentInfo->GetContentData();
-                               SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                               r = pVideoContentInfo->Construct(&contentPath);
+                               r = ConvertErrorToResult(r);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to VideoContentInfo.");
+
+                               pVideoContentInfoImpl = null;
+                               pVideoContentInfoImpl = _VideoContentInfoImpl::GetInstance(*(pVideoContentInfo.get()));
+                               SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pVideoContentInfoImpl.");
 
-                               pVideoContentData = pVideoContentInfo->GetVideoContentData();
-                               SysTryReturnResult(NID_CNT, pVideoContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pVideoContentInfoImpl);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_DATABASE, "Failed to perform FillContentData operation.");
 
-                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+                               r = _ContentUtility::FillVideoContentData(pMediaHandle.get(), pVideoContentInfoImpl);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_DATABASE, "Failed to perform FillVideoContentData operation.");
 
-                               r = _ContentUtility::FillVideoContentData(pMediaHandle.get(), pVideoContentData);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillVideoContentData operation.");
+                               _ContentInfoHelper::SetContentInfoImpl(pVideoContentInfo.get(), pVideoContentInfoImpl);
 
                                // Shallow copy, adds just the pointer: not the element
                                r = pPlayListItemList->Add(*(pVideoContentInfo.release()));
@@ -423,11 +450,18 @@ _PlayListImpl::FillPlayListInfo(int playlistId, ArrayList* pPlayListItemList) co
                                pOtherContentInfo = std::unique_ptr<OtherContentInfo>(new (std::nothrow) OtherContentInfo);
                                SysTryReturnResult(NID_CNT, pOtherContentInfo.get() != null, E_OUT_OF_MEMORY, "Failed to create pOtherContentInfo.");
 
-                               pContentData = pOtherContentInfo->GetContentData();
-                               SysTryReturnResult(NID_CNT, pContentData != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+                               r = pOtherContentInfo->Construct(&contentPath);
+                               r = ConvertErrorToResult(r);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform Construct operation to OtherContentInfo.");
 
-                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pContentData);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform FillContentData operation.");
+                               pOtherContentInfoImpl = null;
+                               pOtherContentInfoImpl = _OtherContentInfoImpl::GetInstance(*(pOtherContentInfo.get()));
+                               SysTryReturnResult(NID_CNT, pOtherContentInfoImpl != null, E_OUT_OF_MEMORY, "Failed to assign operation to pOtherContentInfoImpl.");
+
+                               r = _ContentUtility::FillContentData(pMediaHandle.get(), pOtherContentInfoImpl);
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_DATABASE, "Failed to perform FillContentData operation.");
+
+                               _ContentInfoHelper::SetContentInfoImpl(pOtherContentInfo.get(), pOtherContentInfoImpl);
 
                                // Shallow copy, adds just the pointer: not the element
                                r = pPlayListItemList->Add(*(pOtherContentInfo.release()));
@@ -775,6 +809,28 @@ _PlayListImpl::MapCoreDatabaseErrorToNativeResult(int reason) const
        return r;
 }
 
+result
+_PlayListImpl::ConvertErrorToResult(result res) const
+{
+       result r = E_SUCCESS;
+
+       switch (res)
+       {
+       case E_INVALID_ARG:
+               // Fall through
+       case E_FILE_NOT_FOUND:
+               // Fall through
+       case E_IO:
+               r = E_SYSTEM;
+               break;
+
+       default:
+               r = res;
+               break;
+       }
+       return r;
+}
+
 bool
 MediaPlayListImplCb(media_playlist_h playlistHandle, void *pUserData)
 {
index aba4cb2..7f77486 100644 (file)
@@ -27,8 +27,8 @@
 #include <FCntPlayList.h>
 #include <FCntPlayListManager.h>
 #include <FBase_StringConverter.h>
-#include <FCnt_PlayListImpl.h>
-#include <FCnt_PlayListManagerImpl.h>
+#include "FCnt_PlayListImpl.h"
+#include "FCnt_PlayListManagerImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -41,8 +41,7 @@ namespace Tizen { namespace Content
 bool MediaPlayListCb(media_playlist_h playlistHandle, void *pUserData);
 
 _PlayListManagerImpl::_PlayListManagerImpl(void)
-       : Object()
-       , __pFilterHandle(NULL)
+       : __pFilterHandle(NULL)
 {
 
 }
diff --git a/src/FCnt_VideoContentInfoImpl.cpp b/src/FCnt_VideoContentInfoImpl.cpp
new file mode 100644 (file)
index 0000000..7d546d3
--- /dev/null
@@ -0,0 +1,320 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCntVideoContentInfo.cpp
+ * @brief              This is the implementation file for the %VideoContentInfo class.
+ *
+ * This file contains implementation of the %VideoContentInfo class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FCntContentManagerUtil.h>
+#include <FCntVideoMetadata.h>
+#include <FIoFile.h>
+#include <FIoDirectory.h>
+#include <FSysEnvironment.h>
+#include <FIo_FileImpl.h>
+#include <FApp_AppInfo.h>
+#include "FCnt_VideoContentInfoImpl.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Locations;
+using namespace Tizen::System;
+
+namespace Tizen { namespace Content
+{
+
+_VideoContentInfoImpl::_VideoContentInfoImpl(void)
+       : __width(0)
+       , __height(0)
+       , __framerate(0)
+       , __audioBitrate(0)
+       , __videoBitrate(0)
+       , __duration(0)
+       , __artist(L"")
+       , __genre(L"")
+       , __title(L"")
+       , __albumName(L"")
+{
+
+}
+
+_VideoContentInfoImpl::~_VideoContentInfoImpl(void)
+{
+
+}
+
+_VideoContentInfoImpl*
+_VideoContentInfoImpl::GetInstance(VideoContentInfo& videoContentInfo)
+{
+       return videoContentInfo.__pVideoContentInfoImpl;
+}
+
+const _VideoContentInfoImpl*
+_VideoContentInfoImpl::GetInstance(const VideoContentInfo& videoContentInfo)
+{
+       return videoContentInfo.__pVideoContentInfoImpl;
+}
+
+result
+_VideoContentInfoImpl::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
+{
+       result r = E_SUCCESS;
+       int contentLength = 0;
+       FileAttributes attribute;
+
+       // checks parameters
+       contentLength = contentPath.GetLength();
+       SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
+                       "The contentPath should start with /Media or /Storagecard/Media.");
+       SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                       "The file corresponding to contentPath could not be found.");
+
+       if (!thumbnailPath.IsEmpty())
+       {
+               SysLog(NID_CNT,
+                               "The thumbnailPath is not supported but you can get the thumbnail managed by Tizen from ContentInfo::GetThumbnailN().");
+       }
+
+       if (setGps)
+       {
+               SysLog(NID_CNT, "The setGps is not supported.");
+       }
+
+       SetContentPath(contentPath);
+       SetContentType(CONTENT_TYPE_VIDEO);
+
+       return r;
+}
+
+result
+_VideoContentInfoImpl::Construct(const String* pContentPath)
+{
+       result r = E_SUCCESS;
+
+       if (pContentPath != null)
+       {
+               String contentPath(*pContentPath);
+
+               if (!_AppInfo::IsOspCompat())
+               {
+                       if (!(contentPath.StartsWith(Environment::GetMediaPath(), 0)
+                               || contentPath.StartsWith(Environment::GetExternalStoragePath(), 0)))
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] The path is not supported.");
+                               return E_INVALID_ARG;
+                       }
+               }
+               else
+               {
+                       // prior to 2.0
+                       if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
+                       {
+                               // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
+                               // it should be converted in 2.0.
+                               r = contentPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
+                       {
+                               r = contentPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
+                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+                       }
+                       else
+                       {
+                               SysLogException(NID_CNT, E_INVALID_ARG,
+                                               "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
+                               return E_INVALID_ARG;
+                       }
+               }
+
+               int length = contentPath.GetLength();
+               SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
+                               "The length of pContentPath is 0.");
+               SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+                               "The file corresponding to pContentPath could not be found.");
+
+               SetContentPath(contentPath);
+               SetContentType(CONTENT_TYPE_VIDEO);
+       }
+       else
+       {
+               SetContentType(CONTENT_TYPE_VIDEO);
+       }
+
+       return r;
+}
+
+String
+_VideoContentInfoImpl::GetGenre(void) const
+{
+       if (__genre.IsEmpty())
+       {
+               SysLog(NID_CNT, "Genre is empty.");
+               return String(L"Unknown");
+       }
+
+       return __genre;
+}
+
+String
+_VideoContentInfoImpl::GetArtist(void) const
+{
+       if (__artist.IsEmpty())
+       {
+               SysLog(NID_CNT, "Artist is empty.");
+               return String(L"Unknown");
+       }
+
+       return __artist;
+}
+
+int
+_VideoContentInfoImpl::GetBitrate(void) const
+{
+       return __audioBitrate;
+}
+
+int
+_VideoContentInfoImpl::GetAudioBitrate(void) const
+{
+       return __audioBitrate;
+}
+
+int
+_VideoContentInfoImpl::GetVideoBitrate(void) const
+{
+       return __videoBitrate;
+}
+
+int
+_VideoContentInfoImpl::GetFramerate(void) const
+{
+       return __framerate;
+}
+
+int
+_VideoContentInfoImpl::GetWidth(void) const
+{
+       return __width;
+}
+
+int
+_VideoContentInfoImpl::GetHeight(void) const
+{
+       return __height;
+}
+
+String
+_VideoContentInfoImpl::GetTitle(void) const
+{
+       if (__title.IsEmpty())
+       {
+               SysLog(NID_CNT, "Title is empty.");
+               return String(L"Unknown");
+       }
+
+       return __title;
+}
+
+String
+_VideoContentInfoImpl::GetAlbumName(void) const
+{
+       if (__albumName.IsEmpty())
+       {
+               SysLog(NID_CNT, "AlbumName is empty.");
+               return String(L"Unknown");
+       }
+
+       return __albumName;
+}
+
+long
+_VideoContentInfoImpl::GetDuration(void) const
+{
+       return __duration;
+}
+
+void
+_VideoContentInfoImpl::SetGenre(const Tizen::Base::String& genre)
+{
+       __genre = genre;
+}
+
+void
+_VideoContentInfoImpl::SetArtist(const Tizen::Base::String& artist)
+{
+       __artist = artist;
+}
+
+void
+_VideoContentInfoImpl::SetBitrate(int bitrate)
+{
+       __audioBitrate = bitrate;
+}
+
+void
+_VideoContentInfoImpl::SetAudioBitrate(int audioBitrate)
+{
+       __audioBitrate = audioBitrate;
+}
+
+void
+_VideoContentInfoImpl::SetVideoBitrate(int videoBitrate)
+{
+       __videoBitrate = videoBitrate;
+}
+
+void
+_VideoContentInfoImpl::SetFramerate(int framerate)
+{
+       __framerate = framerate;
+}
+
+void
+_VideoContentInfoImpl::SetWidth(int width)
+{
+       __width = width;
+}
+
+void
+_VideoContentInfoImpl::SetHeight(int height)
+{
+       __height = height;
+}
+
+void
+_VideoContentInfoImpl::SetTitle(const Tizen::Base::String& title)
+{
+       __title = title;
+}
+
+void
+_VideoContentInfoImpl::SetAlbumName(const Tizen::Base::String& albumName)
+{
+       __albumName = albumName;
+}
+
+void
+_VideoContentInfoImpl::SetDuration(long duration)
+{
+       __duration = duration;
+}
+
+}}
diff --git a/src/inc/FCnt_AudioContentInfoImpl.h b/src/inc/FCnt_AudioContentInfoImpl.h
new file mode 100644 (file)
index 0000000..5802a1f
--- /dev/null
@@ -0,0 +1,110 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file                       FCnt_AudioContentInfoImpl.h
+ * @brief              This is the header file for the %_AudioContentInfoImpl class.
+ *
+ * This header file contains the declarations of the %_AudioContentInfoImpl class.
+ */
+
+#ifndef _FCNT_INTERNAL_AUDIO_CONTENT_INFO_IMPL_H_
+#define _FCNT_INTERNAL_AUDIO_CONTENT_INFO_IMPL_H_
+
+#include <FCntContentInfo.h>
+#include <FCntAudioContentInfo.h>
+#include "FCnt_ContentInfoImpl.h"
+
+namespace Tizen { namespace Content
+{
+
+class _OSP_EXPORT_ _AudioContentInfoImpl
+       : public Tizen::Content::_ContentInfoImpl
+{
+public:
+
+       _AudioContentInfoImpl(void);
+
+       virtual ~_AudioContentInfoImpl(void);
+
+       result Construct(const Tizen::Base::String* pContentPath);
+
+       virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
+
+       Tizen::Base::String GetGenre(void) const;
+
+       Tizen::Base::String GetArtist(void) const;
+
+       Tizen::Base::String GetComposer(void) const;
+
+       Tizen::Base::String GetAlbumName(void) const;
+
+       int GetReleaseYear(void) const;
+
+       int GetBitrate(void) const;
+
+       Tizen::Base::String GetTitle(void) const;
+
+       Tizen::Base::String GetCopyright(void) const;
+
+       Tizen::Base::String GetTrackInfo(void) const;
+
+       long GetDuration(void) const;
+
+       void SetGenre(const Tizen::Base::String& genre);
+
+       void SetArtist(const Tizen::Base::String& artist);
+
+       void SetComposer(const Tizen::Base::String& composer);
+
+       void SetAlbumName(const Tizen::Base::String& albumName);
+
+       void SetReleaseYear(int releaseYear);
+
+       void SetBitrate(int bitrate);
+
+       void SetTitle(const Tizen::Base::String& title);
+
+       void SetCopyright(const Tizen::Base::String& copyright);
+
+       void SetTrackInfo(const Tizen::Base::String& trackInfo);
+
+       void SetDuration(long duration);
+
+       static _AudioContentInfoImpl* GetInstance(AudioContentInfo& audioContentInfo);
+
+       static const _AudioContentInfoImpl* GetInstance(const AudioContentInfo& audioContentInfo);
+
+private:
+       _AudioContentInfoImpl(const _AudioContentInfoImpl& rhs);
+
+       _AudioContentInfoImpl& operator =(const _AudioContentInfoImpl& rhs);
+
+       int __bitrate;
+       int __releaseYear;
+       long __duration;
+       Tizen::Base::String __title;
+       Tizen::Base::String __albumName;
+       Tizen::Base::String __artist;
+       Tizen::Base::String __composer;
+       Tizen::Base::String __genre;
+       Tizen::Base::String __copyright;
+       Tizen::Base::String __trackInfo;
+
+};  // _AudioContentInfoImpl
+
+}}  // Tizen::Content
+
+#endif  // _FCNT_INTERNAL_AUDIO_CONTENT_INFO_IMPL_H_
index 2c6d223..5a8c537 100644 (file)
@@ -78,7 +78,6 @@ struct GListDeleter
        void operator()(GList* pGList)
        {
                g_list_free(pGList);
-               pGList = NULL;
        }
 };
 
@@ -87,7 +86,6 @@ struct FolderHandleDeleter
        void operator()(media_folder_h folderHandle)
        {
                media_folder_destroy(folderHandle);
-               folderHandle = NULL;
        }
 };
 
@@ -96,7 +94,6 @@ struct MediaHandleDeleter
        void operator()(media_info_h mediaHandle)
        {
                media_info_destroy(mediaHandle);
-               mediaHandle = NULL;
        }
 };
 
@@ -105,7 +102,6 @@ struct FilterHandleDeleter
        void operator()(filter_h filterHandle)
        {
                media_filter_destroy(filterHandle);
-               filterHandle = NULL;
        }
 };
 
@@ -114,7 +110,6 @@ struct CharDeleter
        void operator()(char* character)
        {
                free(character);
-               character = NULL;
        }
 };
 
@@ -180,6 +175,8 @@ private:
        result FillFinalOutList(char* pFolderId) const;
        result GetSlpColumnName(Tizen::Base::String& inputCol, Tizen::Base::String sortCol) const;
        result MapCoreErrorToNativeResult(int reason) const;
+       result MapCoreErrorToDirectoryCountNativeResult(int reason) const;
+       result ConvertErrorToResult(result res) const;
        bool CheckMediaPath(const Tizen::Base::String& directoryPath) const;
 
        mutable std::unique_ptr<filter_s, FilterHandleDeleter> __pFilterHandle;
diff --git a/src/inc/FCnt_ContentInfoImpl.h b/src/inc/FCnt_ContentInfoImpl.h
new file mode 100644 (file)
index 0000000..f5291fa
--- /dev/null
@@ -0,0 +1,175 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file               FCnt_ContentInfoImpl.h
+ * @brief              This is the header file for the %_ContentInfoImpl class.
+ *
+ * This header file contains the declarations of the %_ContentInfoImpl class.
+ */
+
+#ifndef _FCNT_INTERNAL_CONTENT_INFO_IMPL_H_
+#define _FCNT_INTERNAL_CONTENT_INFO_IMPL_H_
+
+#include <FBaseUuId.h>
+#include <FBaseDateTime.h>
+#include <FCntTypes.h>
+#include <FLocCoordinates.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+}}
+
+namespace Tizen { namespace Content
+{
+
+class _OSP_EXPORT_ _ContentInfoImpl
+       : public Tizen::Base::Object
+{
+public:
+
+       _ContentInfoImpl(void);
+
+       virtual ~_ContentInfoImpl(void);
+
+       result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
+
+       ContentId GetContentId(void) const;
+
+       ContentType GetContentType(void) const;
+
+       unsigned long GetContentSize(void) const;
+
+       Tizen::Base::String GetMimeType(void) const;
+
+       Tizen::Base::DateTime GetDateTime(void) const;
+
+       Tizen::Base::String GetContentName(void) const;
+
+       virtual Tizen::Base::String GetContentPath(void) const;
+
+       Tizen::Base::String GetLocationTag(void) const;
+
+       Tizen::Base::String GetRating(void) const;
+
+       Tizen::Base::String GetCategory(void) const;
+
+       Tizen::Base::String GetDescription(void) const;
+
+       Tizen::Base::String GetKeyword(void) const;
+
+       Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
+
+       Tizen::Base::String GetAuthor(void) const;
+
+       Tizen::Base::String GetProvider(void) const;
+
+       Tizen::Base::String GetMediaFormat(void) const;
+
+       Tizen::Locations::Coordinates GetCoordinates(void) const;
+
+       bool IsDrmProtected(void) const;
+
+       void SetContentId(const ContentId& contentId);
+
+       void SetContentType(const ContentType& contentType);
+
+       void SetContentSize(unsigned long contentSize);
+
+       void SetMimeType(const Tizen::Base::String& mimeType);
+
+       void SetDateTime(const Tizen::Base::DateTime& dateTime);
+
+       void SetContentPath(const Tizen::Base::String& contentPath);
+
+       void SetLocationTag(const Tizen::Base::String& locationTag);
+
+       void SetRating(const Tizen::Base::String& rating);
+
+       void SetCategory(const Tizen::Base::String& category);
+
+       void SetDescription(const Tizen::Base::String& description);
+
+       void SetContentName(const Tizen::Base::String& contentName);
+
+       void SetKeyword(const Tizen::Base::String& keyword);
+
+       void SetAuthor(const Tizen::Base::String& author);
+
+       void SetProvider(const Tizen::Base::String& provider);
+
+       void SetMediaFormat(const Tizen::Base::String& mediaFormat);
+
+       void SetCoordinates(const Tizen::Locations::Coordinates& coordinates);
+
+       void SetDrmProtected(bool isDrm);
+
+       double GetLatitude(void) const;
+
+       double GetLongitude(void) const;
+
+       double GetAltitude(void) const;
+
+       Tizen::Base::String GetThumbnailPath(void) const;
+
+       void SetLatitude(double latitude);
+
+       void SetLongitude(double longitude);
+
+       void SetAltitude(double altitude);
+
+       void SetThumbnailPath(const Tizen::Base::String& thumbnailPath);
+
+       void SetStorageType(int storageType);
+
+       static _ContentInfoImpl* GetInstance(ContentInfo& contentInfo);
+
+       static const _ContentInfoImpl* GetInstance(const ContentInfo& contentInfo);
+
+private:
+
+       _ContentInfoImpl(const _ContentInfoImpl& rhs);
+
+       _ContentInfoImpl& operator =(const _ContentInfoImpl& rhs);
+
+       ContentId __contentId;
+       int __storageType;
+       ContentType __contentType;
+       unsigned long __contentSize;
+       Tizen::Base::DateTime __dateTime;
+       double __latitude;
+       double __longitude;
+       double __altitude;
+       bool __isDrm;
+       Tizen::Base::String __contentPath;
+       Tizen::Base::String __mimeType;
+       Tizen::Base::String __thumbnailPath;
+       Tizen::Base::String __author;
+       Tizen::Base::String __category;
+       Tizen::Base::String __contentName;
+       Tizen::Base::String __description;
+       Tizen::Base::String __keyword;
+       Tizen::Base::String __locationTag;
+       Tizen::Base::String __provider;
+       Tizen::Base::String __rating;
+       Tizen::Base::String __mediaFormat;
+       Tizen::Locations::Coordinates __coordinates;
+
+};  // _ContentInfoImpl
+
+}}  // Tizen::Content
+
+#endif  // _FCNT_INTERNAL_CONTENT_INFO_IMPL_H_
index dcdc809..109d0da 100644 (file)
@@ -36,44 +36,39 @@ class IContentUpdateEventListener;
 
 typedef struct media_info_s* media_info_h;
 
-struct MediaInfoDeleter
+struct _MediaInfoDeleter
 {
        void operator()(media_info_h mediaInfo)
        {
-               int val = media_info_destroy(mediaInfo);
-               mediaInfo = NULL;
-               SysLog(NID_CNT, "media_info_destroy result[%d].", val);
+               media_info_destroy(mediaInfo);
        }
 };
 
-struct ImageMetaDeleter
+struct _ImageMetaDeleter
 {
        void operator()(image_meta_h* pImageMeta)
        {
-               int val = image_meta_destroy(*pImageMeta);
-               SysLog(NID_CNT, "image_meta_destroy result[%d].", val);
+               image_meta_destroy(*pImageMeta);
        }
 };
 
-struct AudioMetaDeleter
+struct _AudioMetaDeleter
 {
        void operator()(audio_meta_h* pAudioMeta)
        {
-               int val = audio_meta_destroy(*pAudioMeta);
-               SysLog(NID_CNT, "audio_meta_destroy result[%d].", val);
+               audio_meta_destroy(*pAudioMeta);
        }
 };
 
-struct VideoMetaDeleter
+struct _VideoMetaDeleter
 {
        void operator()(video_meta_h* pVideoMeta)
        {
-               int val = video_meta_destroy(*pVideoMeta);
-               SysLog(NID_CNT, "video_meta_destroy result[%d].", val);
+               video_meta_destroy(*pVideoMeta);
        }
 };
 
-struct ScanResult
+struct _ScanResult
 {
        Tizen::Base::String scanPath;
        IContentScanListener* pScanListener;
@@ -177,11 +172,15 @@ public:
 
 private:
        _ContentManagerImpl(const _ContentManagerImpl& rhs);
-       ContentId SaveDataToDatabase(const media_info_h pMediaInfo, ContentInfo::_ContentData* pContentData) const;
-       result UpdateDataToDatabase(const ContentInfo::_ContentData* pContentData) const;
-       result MakeContentInfo(const media_info_h pMediaInfo, ContentInfo::_ContentData* pContentData, int systemType, void* pMetadata) const;
+       ContentId SaveDataToDatabase(const media_info_h pMediaInfo, _ContentInfoImpl* pContentInfoImpl) const;
+       result UpdateDataToDatabase(const _ContentInfoImpl* pContentInfoImpl) const;
+       result MakeContentInfo(const media_info_h pMediaInfo, int systemType, void* pInfoImpl) const;
+       result MakeImageContentInfo(const media_info_h pMediaInfo, void* pInfoImpl) const;
+       result MakeAudioContentInfo(const media_info_h pMediaInfo, void* pInfoImpl) const;
+       result MakeVideoContentInfo(const media_info_h pMediaInfo, void* pInfoImpl) const;
        bool VerifyMediaFilePathCompatibility(const Tizen::Base::String& contentPath, bool checkVersion) const;
        bool VerifyHomeFilePathCompatibility(const Tizen::Base::String& contentPath) const;
+       result ConvertErrorToResult(result res) const;
        _ContentManagerImpl& operator =(const _ContentManagerImpl& rhs);
 
 private:
@@ -189,7 +188,7 @@ private:
        IContentUpdateEventListener* __pListener;
        friend class _ContentDownloadHandler;
 
-};  // class _ContentManagerImpl
+};  // _ContentManagerImpl
 
 }}  // Tizen::Content
 
index 9805073..87390ab 100644 (file)
@@ -188,6 +188,8 @@ private:
 
        result MapCoreErrorToNativeResult(int reason) const;
 
+       result ConvertErrorToResult(result res) const;
+
        ContentType                                                     __contentType;
        mutable std::unique_ptr<Tizen::Base::Collection::ArrayList, Tizen::Base::Collection::AllElementsDeleter> __pFinalOutList;
        mutable Tizen::Base::String                                     __inputExpr;
index fa0dd33..a17f9ee 100644 (file)
@@ -39,7 +39,6 @@ struct UtilCharDeleter
        void operator()(char* pChar)
        {
                free(pChar);
-               pChar = null;
        }
 };
 struct ImageMetaHandleDeleter
@@ -47,7 +46,6 @@ struct ImageMetaHandleDeleter
        void operator()(image_meta_h imageHandle)
        {
                image_meta_destroy(imageHandle);
-               imageHandle = NULL;
        }
 };
 struct AudioMetaHandleDeleter
@@ -55,7 +53,6 @@ struct AudioMetaHandleDeleter
        void operator()(audio_meta_h audioHandle)
        {
                audio_meta_destroy(audioHandle);
-               audioHandle = NULL;
        }
 };
 struct VideoMetaHandleDeleter
@@ -63,7 +60,6 @@ struct VideoMetaHandleDeleter
        void operator()(video_meta_h videoHandle)
        {
                video_meta_destroy(videoHandle);
-               videoHandle = NULL;
        }
 };
 
@@ -88,15 +84,13 @@ public:
 
        static void DoSafeFree(char* pSrc);
 
-       static void DoSafeDelete(Tizen::Base::String* pSrc);
+       static result FillContentData(media_info_h mediaHandle, _ContentInfoImpl* pContentInfoImpl);
 
-       static result FillContentData(media_info_h mediaHandle, ContentInfo::_ContentData* pContentData);
+       static result FillImageContentData(media_info_h media_handle, _ImageContentInfoImpl* pImageContentInfoImpl);
 
-       static result FillImageContentData(media_info_h media_handle, ImageContentInfo::_ImageContentData* pImageContentData);
+       static result FillAudioContentData(media_info_h media_handle, _AudioContentInfoImpl* pAudioContentInfoImpl);
 
-       static result FillAudioContentData(media_info_h media_handle, AudioContentInfo::_AudioContentData* pAudioContentData);
-
-       static result FillVideoContentData(media_info_h media_handle, VideoContentInfo::_VideoContentData* pVideoContentData);
+       static result FillVideoContentData(media_info_h media_handle, _VideoContentInfoImpl* pVideoContentInfoImpl);
 
        static result MapCoreErrorToNativeResult(int reason);
 
@@ -104,7 +98,7 @@ private:
        _ContentUtility(const _ContentUtility& rhs);
        _ContentUtility& operator =(const _ContentUtility& rhs);
 
-};     // class ContentUtility
+};     // _ContentUtility
 
 }}     // Tizen::Content
 
diff --git a/src/inc/FCnt_ImageContentInfoImpl.h b/src/inc/FCnt_ImageContentInfoImpl.h
new file mode 100644 (file)
index 0000000..cafd785
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file                       FCnt_ImageContentInfoImpl.h
+ * @brief              This is the header file for the %_ImageContentInfoImpl class.
+ *
+ * This header file contains the declarations of the %_ImageContentInfoImpl class.
+ */
+
+#ifndef _FCNT_INTERNAL_IMAGE_CONTENT_INFO_IMPL_H_
+#define _FCNT_INTERNAL_IMAGE_CONTENT_INFO_IMPL_H_
+
+#include <FCntContentInfo.h>
+#include <FCntImageContentInfo.h>
+#include "FCnt_ContentInfoImpl.h"
+
+namespace Tizen { namespace Content
+{
+
+class _OSP_EXPORT_ _ImageContentInfoImpl
+       : public Tizen::Content::_ContentInfoImpl
+{
+public:
+
+       _ImageContentInfoImpl(void);
+
+       virtual ~_ImageContentInfoImpl(void);
+
+       result Construct(const Tizen::Base::String* pContentPath);
+
+       virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
+
+       int GetWidth(void) const;
+
+       int GetHeight(void) const;
+
+       Tizen::Base::String GetTitle(void) const;
+
+       ImageOrientationType GetOrientation(void) const;
+
+       void SetWidth(int width);
+
+       void SetHeight(int height);
+
+       void SetTitle(const Tizen::Base::String& title);
+
+       void SetOrientation(const ImageOrientationType& orientationType);
+
+       static _ImageContentInfoImpl* GetInstance(ImageContentInfo& imageContentInfo);
+
+       static const _ImageContentInfoImpl* GetInstance(const ImageContentInfo& imageContentInfo);
+
+private:
+       _ImageContentInfoImpl(const _ImageContentInfoImpl& rhs);
+
+       _ImageContentInfoImpl& operator =(const _ImageContentInfoImpl& rhs);
+
+       int __width;
+       int __height;
+       ImageOrientationType __orientationType;
+       Tizen::Base::String __title;
+
+};  // _ImageContentInfoImpl
+
+}}  // Tizen::Content
+
+#endif  // _FCNT_INTERNAL_IMAGE_CONTENT_INFO_IMPL_H_
diff --git a/src/inc/FCnt_OtherContentInfoImpl.h b/src/inc/FCnt_OtherContentInfoImpl.h
new file mode 100644 (file)
index 0000000..55300b0
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file                       FCnt_OtherContentInfoImpl.h
+ * @brief              This is the header file for the %_OtherContentInfoImpl class.
+ *
+ * This header file contains the declarations of the %_OtherContentInfoImpl class.
+ */
+
+#ifndef _FCNT_INTERNAL_OTHER_CONTENT_INFO_IMPL_H_
+#define _FCNT_INTERNAL_OTHER_CONTENT_INFO_IMPL_H_
+
+#include <FCntContentInfo.h>
+#include <FCntOtherContentInfo.h>
+#include "FCnt_ContentInfoImpl.h"
+
+namespace Tizen { namespace Content
+{
+
+class _OSP_EXPORT_ _OtherContentInfoImpl
+       : public Tizen::Content::_ContentInfoImpl
+{
+public:
+
+       _OtherContentInfoImpl(void);
+
+       virtual ~_OtherContentInfoImpl(void);
+
+       result Construct(const Tizen::Base::String* pContentPath);
+
+       virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
+
+       static _OtherContentInfoImpl* GetInstance(OtherContentInfo& otherContentInfo);
+
+       static const _OtherContentInfoImpl* GetInstance(const OtherContentInfo& otherContentInfo);
+
+private:
+
+       _OtherContentInfoImpl(const _OtherContentInfoImpl& rhs);
+
+       _OtherContentInfoImpl& operator =(const _OtherContentInfoImpl& rhs);
+
+};  // _OtherContentInfoImpl
+
+}}  // Tizen::Content
+
+#endif  // _FCNT_INTERNAL_OTHER_CONTENT_INFO_IMPL_H_
index dc8b5f1..433c063 100644 (file)
@@ -38,7 +38,6 @@ struct PlayListHandleDeleter
        void operator()(media_playlist_h playListHandle)
        {
                media_playlist_destroy(playListHandle);
-               playListHandle = NULL;
        }
 };
 
@@ -47,7 +46,6 @@ struct MediaHandleDeleter
        void operator()(media_info_h mediaHandle)
        {
                media_info_destroy(mediaHandle);
-               mediaHandle = NULL;
        }
 };
 
@@ -56,7 +54,6 @@ struct GListDeleter
        void operator()(GList* pGList)
        {
                g_list_free(pGList);
-               pGList = NULL;
        }
 };
 
@@ -65,7 +62,6 @@ struct FilterHandleDeleter
        void operator()(filter_h filterHandle)
        {
                media_filter_destroy(filterHandle);
-               filterHandle = NULL;
        }
 };
 
@@ -127,6 +123,7 @@ private:
        result FillPlayListInfo(int playlistId, Tizen::Base::Collection::ArrayList* pPlayListItemList) const;
        result MapCoreErrorToNativeResult(int reason) const;
        result MapCoreDatabaseErrorToNativeResult(int reason) const;
+       result ConvertErrorToResult(result res) const;
 
 };     // class _PlayListImpl
 
diff --git a/src/inc/FCnt_VideoContentInfoImpl.h b/src/inc/FCnt_VideoContentInfoImpl.h
new file mode 100644 (file)
index 0000000..1b5f181
--- /dev/null
@@ -0,0 +1,115 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file                       FCnt_VideoContentInfoImpl.h
+ * @brief              This is the header file for the %_VideoContentInfoImpl class.
+ *
+ * This header file contains the declarations of the %_VideoContentInfoImpl class.
+ */
+
+#ifndef _FCNT_INTERNAL_VIDEO_CONTENT_INFO_IMPL_H_
+#define _FCNT_INTERNAL_VIDEO_CONTENT_INFO_IMPL_H_
+
+#include <FCntContentInfo.h>
+#include <FCntVideoContentInfo.h>
+#include "FCnt_ContentInfoImpl.h"
+
+namespace Tizen { namespace Content
+{
+
+class _OSP_EXPORT_ _VideoContentInfoImpl
+       : public Tizen::Content::_ContentInfoImpl
+{
+public:
+
+       _VideoContentInfoImpl(void);
+
+       virtual ~_VideoContentInfoImpl(void);
+
+       result Construct(const Tizen::Base::String* pContentPath);
+
+       virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
+
+       Tizen::Base::String GetGenre(void) const;
+
+       Tizen::Base::String GetArtist(void) const;
+
+       int GetBitrate(void) const;
+
+       int GetAudioBitrate(void) const;
+
+       int GetVideoBitrate(void) const;
+
+       int GetFramerate(void) const;
+
+       int GetWidth(void) const;
+
+       int GetHeight(void) const;
+
+       Tizen::Base::String GetTitle(void) const;
+
+       Tizen::Base::String GetAlbumName(void) const;
+
+       long GetDuration(void) const;
+
+       void SetGenre(const Tizen::Base::String& genre);
+
+       void SetArtist(const Tizen::Base::String& artist);
+
+       void SetBitrate(int bitrate);
+
+       void SetAudioBitrate(int audioBitrate);
+
+       void SetVideoBitrate(int videoBitrate);
+
+       void SetFramerate(int framerate);
+
+       void SetWidth(int width);
+
+       void SetHeight(int height);
+
+       void SetTitle(const Tizen::Base::String& title);
+
+       void SetAlbumName(const Tizen::Base::String& albumName);
+
+       void SetDuration(long duration);
+
+       static _VideoContentInfoImpl* GetInstance(VideoContentInfo& videoContentInfo);
+
+       static const _VideoContentInfoImpl* GetInstance(const VideoContentInfo& videoContentInfo);
+
+private:
+
+       _VideoContentInfoImpl(const _VideoContentInfoImpl& rhs);
+
+       _VideoContentInfoImpl& operator =(const _VideoContentInfoImpl& rhs);
+
+       int __width;
+       int __height;
+       int __framerate;
+       int __audioBitrate;
+       int __videoBitrate;
+       long __duration;
+       Tizen::Base::String __artist;
+       Tizen::Base::String __genre;
+       Tizen::Base::String __title;
+       Tizen::Base::String __albumName;
+
+};  // _VideoContentInfoImpl
+
+}}  // Tizen::Content
+
+#endif  // _FCNT_INTERNAL_VIDEO_CONTENT_INFO_IMPL_H_