The ImageContentInfo class provides the methods to access the image content information. Before the image content information can be retrieved, ContentManager must be used to create the content.
For more information on the different types of content information, see Device Content Management.
The following example demonstrates how to use the ImageContentInfo class.
result MyClass::TestImageContentInfo(void) { result r = E_SUCCESS; ContentId contentId; ContentManager contentManager; r = contentManager.Construct(); TryReturn(!IsFailed(r), r, "Construct failed."); Osp::Base::String inputPath(L"/Media/Images/Flower1.jpg"); ImageContentInfo imageContentInfo; r = imageContentInfo.Construct(&inputPath); TryReturn(!IsFailed(r), r, "Construct failed."); contentId = contentManager.CreateContent(imageContentInfo); TryReturn(Osp::Base::UuId::INVALID_UUID != contentId, GetLastResult(), "CreateContent failed."); // Contents information Osp::Base::String contentPath = imageContentInfo.GetContentPath(); // Metadata Osp::Base::String title = imageContentInfo.GetTitle(); return r; }
Public Member Functions | |
result | Construct (const Osp::Base::String &contentPath, const Osp::Base::String &thumbnailPath=L"", bool setGps=false) |
result | Construct (const Osp::Base::String *pContentPath) |
int | GetHeight (void) const |
Osp::Base::String | GetTitle (void) const |
int | GetWidth (void) const |
ImageContentInfo (void) | |
virtual | ~ImageContentInfo (void) |
Osp::Content::ImageContentInfo::ImageContentInfo | ( | void | ) |
This is the default constructor for this class.
virtual Osp::Content::ImageContentInfo::~ImageContentInfo | ( | void | ) | [virtual] |
This is the destructor for this class.
result Osp::Content::ImageContentInfo::Construct | ( | const Osp::Base::String & | contentPath, |
const Osp::Base::String & | thumbnailPath = L"" , |
||
bool | setGps = false |
||
) | [virtual] |
Initializes this instance of ImageContentInfo with the specified parameters.
[in] | contentPath | The content path |
[in] | thumbnailPath | The thumbnail path |
[in] | setGps | Set to true to save the device's last known coordinates in the ContentInfo instance, else false The coordinate information may be incorrect if it is outdated or has never been updated. To update the coordinate information or to get the exact value, use RequestLocationUpdates() of the Osp::Locations::LocationProvider class, before calling this method. |
E_SUCCESS | The method is successful. |
E_INVALID_STATE | This instance has already been constructed. |
E_FILE_NOT_FOUND | The specified file cannot be found or accessed. |
E_IO | An I/O error has occurred. |
E_INVALID_ARG | A specified input parameter is invalid, or the length of the input data exceeds the maximum limit of 256 characters. |
E_LOCATION | The location provider is currently out of service. |
Implements Osp::Content::ContentInfo.
result Osp::Content::ImageContentInfo::Construct | ( | const Osp::Base::String * | pContentPath | ) |
Initializes this instance of ImageContentInfo with the specified parameter.
[in] | pContentPath | The content path |
E_SUCCESS | The method is successful. |
E_INVALID_STATE | This instance has already been constructed. |
E_FILE_NOT_FOUND | The specified file cannot be found or accessed. |
E_INVALID_ARG | The specified content path is invalid or its length exceeds the maximum limit of 256 characters. |
E_OUT_OF_MEMORY | The memory is insufficient. |
E_IO | An I/O error has occurred. |
E_SYSTEM | An internal error has occurred. |
pContentPath
is null
, use CreateContent() of the ContentManager class. int Osp::Content::ImageContentInfo::GetHeight | ( | void | ) | const |
Gets the height of the image.
Osp::Base::String Osp::Content::ImageContentInfo::GetTitle | ( | void | ) | const |
Gets the title of the image.
int Osp::Content::ImageContentInfo::GetWidth | ( | void | ) | const |
Gets the width of the image.