/*
* WMPPlaylist.h
* Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL9
// 2011/12/07
#pragma once
#include <sol/wmp/WMPObject.h>
#include <sol/HTMLEncoder.h>
namespace SOL {
class WMPPlaylist :public WMPObject {
private:
IWMPPlaylistPtr list;
public:
WMPPlaylist(IWMPPlaylistPtr ptr)
:list(ptr)
{
if (ptr == NULL) {
throw NullPointerException("IWMPPlaylistPtr is NULL", 0);
}
}
public:
~WMPPlaylist()
{
list = NULL;
}
public:
long getCount()
{
return list->Getcount();
}
_bstr_t getName()
{
return list->Getname();
}
void putName(_bstr_t pbstrName)
{
list->Putname(pbstrName);
}
long getAttributeCount()
{
return list->GetattributeCount();
}
_bstr_t getAttributeName(long lIndex)
{
return list->GetattributeName(lIndex);
}
IWMPMediaPtr getItem(long lIndex)
{
return list->GetItem(lIndex);
}
_bstr_t getItemInfo(_bstr_t bstrName)
{
return list->getItemInfo(bstrName);
}
HRESULT setItemInfo(_bstr_t bstrName, _bstr_t bstrValue)
{
return list->setItemInfo(bstrName, bstrValue);
}
VARIANT_BOOL getIsIdentical(
struct IWMPPlaylist * pIWMPPlaylist)
{
return list->GetisIdentical(
pIWMPPlaylist);
}
HRESULT clear()
{
return list->clear();
}
HRESULT insertItem(long lIndex, struct IWMPMedia * pIWMPMedia)
{
return list->insertItem(lIndex, pIWMPMedia);
}
HRESULT appendItem(struct IWMPMedia * pIWMPMedia)
{
return list->appendItem(
pIWMPMedia);
}
HRESULT removeItem(
struct IWMPMedia * pIWMPMedia)
{
return list->removeItem(
pIWMPMedia);
}
HRESULT moveItem(
long lIndexOld,
long lIndexNew)
{
return list->moveItem(lIndexOld, lIndexNew);
}
//
public:
void showProperties(HWND hwnd=NULL)
{
_tprintf(_T("<Playlist>\n"));
_tprintf(_T("<Count>%d</Count>\n"), getCount());
_tprintf(_T("<Name>%s</Name>\n"), (const TCHAR*)getName());
long count = getAttributeCount();
_tprintf(_T("<AttributeCount>%d</AttributeCount>\n"), count);
_tprintf(_T("<Attributes>\n"));
for (long i = 0; i<count; i++) {
_bstr_t name = getAttributeName(i);
_bstr_t value = getItemInfo(name);
_bstr_t bname;
_bstr_t bvalue;
HTMLEncoder encoder;
encoder.encode(name, bname);
encoder.encode(value, bvalue);
_tprintf(_T("<Attribute Name=\"%s\" Value=\"%s\" />\n"),
(const TCHAR*)bname, (const TCHAR*)bvalue);
}
_tprintf(_T("</Attributes>\n"));
_tprintf(_T("</Playlist>\n"));
}
public:
void writeProperties(Writer& writer)
{
writer.writeln(L"<Playlist>");
writer.writeln(L"<Count>%d</Count>", getCount());
writer.writeln(L"<Name>%s</Name>", (const wchar_t*)getName());
long count = getAttributeCount();
writer.writeln(L"<AttributeCount>%d</AttributeCount>", count);
writer.writeln(L"<Attributes>");
for (long i = 0; i<count; i++) {
_bstr_t name = getAttributeName(i);
_bstr_t value = getItemInfo(name);
_bstr_t bname;
_bstr_t bvalue;
HTMLEncoder encoder;
encoder.encode(name, bname);
encoder.encode(value, bvalue);
writer.writeln(L"<Attribute Name=\"%s\" Value=\"%s\" />",
(const wchar_t*)bname, (const wchar_t*)bvalue);
}
writer.writeln(L"</Attributes>");
writer.writeln(L"</Playlist>");
}
};
}
|