Fix : Remove exception handling codes at the sample code
[platform/framework/native/content.git] / inc / FCntOtherContentInfo.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                        FCntOtherContentInfo.h
18  * @brief               This is the header file for the %OtherContentInfo class.
19  *
20  * This header file contains the declarations of the %OtherContentInfo class.
21  */
22
23 #ifndef _FCNT_OTHER_CONTENT_INFO_H_
24 #define _FCNT_OTHER_CONTENT_INFO_H_
25
26 #include <FCntContentInfo.h>
27
28 namespace Tizen { namespace Content
29 {
30
31 class _OtherContentInfoImpl;
32
33 /**
34  * @class       OtherContentInfo
35  * @brief       This class provides methods to access the other content information.
36  *
37  * @since       2.0
38  *
39  * @final       This class is not intended for extension.
40  *
41  * The %OtherContentInfo class provides methods to access the other content information. @n
42  * Before getting the other content information, the ContentManager class must be used to create the content. @n
43  * If the @c E_UNSUPPORTED_FORMAT exception is received from the ContentManagerUtil::CheckContentType() method, the file can only be created as %OtherContentInfo.
44  *
45  * For more information on the different types of content information, see <a href="../org.tizen.native.appprogramming/html/guide/content/device_content_mgmt.htm">Device Content Management</a>.
46  *
47  * The following example demonstrates how to use the %OtherContentInfo class.
48  *
49  * @code
50  * #include <FBase.h>
51  * #include <FContent.h>
52  * #include <FSystem.h>
53  *
54  * using namespace Tizen::Content;
55  *
56  * result
57  * MyClass::TestOtherContentInfo(void)
58  * {
59  *              ContentManager contentManager;
60  *              result r = contentManager.Construct();
61  *
62  *              OtherContentInfo otherContentInfo;
63  *              r = otherContentInfo.Construct(null);
64  *
65  *              Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.doc";
66  *              Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Others/flower.doc";
67  *
68  *              ContentId contentId = contentManager.CreateContent(sourcePath, destPath, false, &otherContentInfo);
69  *              r = GetLastResult();
70  *
71  *              return r;
72  * }
73  * @endcode
74  */
75 class _OSP_EXPORT_ OtherContentInfo
76         : public Tizen::Content::ContentInfo
77 {
78 public:
79         /**
80          * The object is not fully constructed after this constructor is called. @n
81          * For full construction, the Construct() method must be called right after calling this constructor.
82          *
83          * @since               2.0
84          */
85         OtherContentInfo(void);
86
87         /**
88          * This destructor overrides Tizen::Base::Object::~Object().
89          *
90          * @since               2.0
91          */
92         virtual ~OtherContentInfo(void);
93
94         /**
95          * Initializes this instance of %OtherContentInfo with the specified parameter.
96          *
97          * @if OSPCOMPAT
98          * @brief <i> [Compatibility] </i>
99          * @endif
100          * @since                       2.0
101          * @if OSPCOMPAT
102          * @compatibility This method has compatibility issues with OSP compatible applications. @n
103          *                For more information, see @ref CompOtherContentInfoConstructPage "here".
104          * @endif
105          *
106          * @return              An error code
107          * @param[in]   pContentPath            The content path @n
108          *                                                                      The path should start with the directory path returned by
109          *                                                                      either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath() @n
110          *                                                                      If the path is @c null,
111          *                                                                      use ContentManager::CreateContent(const Tizen::Base::ByteBuffer&, const Tizen::Base::String&, const ContentInfo*) @n
112          *                                                                      or ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*),
113          *                                                                      instead of this method.
114          * @exception   E_SUCCESS                       The method is successful.
115          * @exception   E_FILE_NOT_FOUND        The specified file cannot be found or accessed.
116          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
117          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
118          * @exception   E_IO                            An I/O error has occurred.
119          * @exception   E_SYSTEM                        An internal error has occurred.
120          *                     
121          */
122         result Construct(const Tizen::Base::String* pContentPath);
123
124         /**
125          * @if OSPCOMPAT
126          * @page        CompOtherContentInfoConstructPage Compatibility for the file path.
127          * @section     CompOtherContentInfoConstructPageIssueSection Issues
128          *          The content path argument of this method in OSP compatible applications has the following issues: @n
129          *          -# The content path should be a path that begins with an allowed path prefix. @n
130          *             For example, L"/Media/Images/flower.jpg", L"/Storagecard/Media/Images/flower.jpg".
131          *
132          * @section     CompOtherContentInfoConstructPageSolutionSection Resolutions
133          *          This issue has been resolved in Tizen. @n
134          *          -# The content path can be a path without a specific allowed path prefix. @n
135          *             Applications do not need to know the specific allowed path prefixes. @n
136          *             To get the directory path, use the following methods: @n
137          *             - For accessing the media directory, use Tizen::System::Environment::GetMediaPath().
138          *             - For accessing the external storage, use Tizen::System::Environment::GetExternalStoragePath().
139          * @endif
140          */
141
142         /**
143          * @if OSPDEPREC
144          * Initializes this instance of %OtherContentInfo with the specified parameters.
145          *
146          * @brief       <i> [Deprecated] </i>
147          * @deprecated   This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates. @n
148          *               Instead of using this method, use Construct(const Tizen::Base::String*). @n
149          *               To set the coordinates in the ContentInfo instance, use ContentInfo::SetCoordinates(const Tizen::Locations::Coordinates&).
150          * @since                       2.0
151          *
152          * @return                      An error code
153          * @param[in]           contentPath                                     The content path
154          * @param[in]           thumbnailPath                           The thumbnail path
155          * @param[in]           setGps                                          Set to @c true to save the device's last known coordinates of the ContentInfo instance, @n
156          *                                              else @c false @n
157          *                                                                                              The coordinate information may be incorrect if it is outdated or has never been updated @n
158          *                                              To update the coordinate information or to get the exact value,
159          *                                              use Tizen::Locations::LocationProvider::RequestLocationUpdates() before calling this method.
160          * @exception           E_SUCCESS                                       The method is successful.
161          * @exception           E_FILE_NOT_FOUND                        The specified file cannot be found or accessed.
162          * @exception           E_INVALID_ARG                           The specified input parameter is invalid.
163          * @exception           E_OUT_OF_MEMORY                         The memory is insufficient.
164          * @exception           E_IO                                            An I/O error has occurred.
165          * @remarks
166          *                                      - The content path must start with @c '/Media' or @c '/Storagecard/Media'.
167          *                                      - The thumbnail path must start with @c '/Home', @c '/Media', or @c '/Storagecard/Media'. @n
168          *                                      The permitted format for a thumbnail image is bitmap (bmp).
169          * @endif
170          */
171         virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
172
173 private:
174         /**
175          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
176          */
177         OtherContentInfo(const OtherContentInfo& rhs);
178
179         /**
180          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
181          */
182         OtherContentInfo& operator =(const OtherContentInfo& rhs);
183
184 private:
185         bool __isCreated;
186
187         friend class _OtherContentInfoImpl;
188         _OtherContentInfoImpl* __pOtherContentInfoImpl;
189
190 };  // OtherContentInfo
191
192 }}  // Tizen::Content
193
194 #endif  // _FCNT_OTHER_CONTENT_INFO_H_