/*
* WMPErrorItem.h
* Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL9
// 2011/12/21
#pragma once
#include <sol/wmp/WMPObject.h>
#include <sol/wmp/WMPErrorItem.h>
namespace SOL {
class WMPErrorItem :public WMPObject {
private:
IWMPErrorItemPtr item;
public:
WMPErrorItem(IWMPErrorItemPtr ptr)
:item(ptr)
{
if(ptr == NULL) {
throw NullPointerException("IWMPErrorItemPtr is NULL", 0);
}
}
public:
~WMPErrorItem()
{
item = NULL;
}
long getErrorCode()
{
return item->GeterrorCode();
}
_bstr_t getErrorDescription()
{
return item->GeterrorDescription();
}
_variant_t getErrorContext()
{
return item->GeterrorContext();
}
long getRemedy()
{
return item->Getremedy();
}
_bstr_t getCustomUrl()
{
return item->GetcustomUrl();
}
public:
void show()
{
_tprintf(_T("<ErrorItem>\n"));
_tprintf(_T("<ErrorCode>%x</ErrorCode>\n"), getErrorCode());
_tprintf(_T("<ErrorDescription>%s</ErrorDescription>\n"),(const TCHAR*)getErrorDescription());
try {
_tprintf(_T("<Remedy>%x</Remedy>\n"), getRemedy());
} catch (...) {
//printf("Failed to getRemedy()\n");
}
try {
_tprintf(_T("<CustomUrl>%s</CustomUrl>\n"),(const TCHAR*)getCustomUrl());
} catch (...) {
//printf("Faiied to getCustomUrl()\n");
}
_tprintf(_T("</ErrorItem>\n"));
}
public:
void write(Writer& writer)
{
writer.writeln(L"<ErrorItem>");
writer.writeln(L"<ErrorCode>%x</ErrorCode>", getErrorCode());
writer.writeln(L"<ErrorDescription>%s</ErrorDescription>",(const wchar_t*)getErrorDescription());
try {
writer.writeln(L"<Remedy>%x</Remedy>", getRemedy());
} catch (...) {
//printf("Failed to getRemedy()\n");
}
try {
writer.writeln(L"<CustomUrl>%s</CustomUrl>",(const wchar_t*)getCustomUrl());
} catch (...) {
//printf("Faiied to getCustomUrl()\n");
}
writer.writeln(L"</ErrorItem>");
}
};
}
|