X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Ftaglib%2Fmp4%2Fmp4item.cpp;fp=src%2Ftaglib%2Fmp4%2Fmp4item.cpp;h=0af331f5d960b5253a64a3573de47245050e48ea;hb=68d60ad21e61d1e3255673985ae19606ceb0c59d;hp=0000000000000000000000000000000000000000;hpb=dca4bf6a28a8b904d45ff26376e667b05063a400;p=someplayer diff --git a/src/taglib/mp4/mp4item.cpp b/src/taglib/mp4/mp4item.cpp new file mode 100644 index 0000000..0af331f --- /dev/null +++ b/src/taglib/mp4/mp4item.cpp @@ -0,0 +1,149 @@ +/************************************************************************** + copyright : (C) 2007 by Lukáš Lalinský + email : lalinsky@gmail.com + **************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + * * + * Alternatively, this file is available under the Mozilla Public * + * License Version 1.1. You may obtain a copy of the License at * + * http://www.mozilla.org/MPL/ * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef WITH_MP4 + +#include +#include +#include "mp4item.h" + +using namespace TagLib; + +class MP4::Item::ItemPrivate : public RefCounter +{ +public: + ItemPrivate() : RefCounter(), valid(true) {} + + bool valid; + union { + bool m_bool; + int m_int; + IntPair m_intPair; + }; + StringList m_stringList; + MP4::CoverArtList m_coverArtList; +}; + +MP4::Item::Item() +{ + d = new ItemPrivate; + d->valid = false; +} + +MP4::Item::Item(const Item &item) : d(item.d) +{ + d->ref(); +} + +MP4::Item & +MP4::Item::operator=(const Item &item) +{ + if(d->deref()) { + delete d; + } + d = item.d; + d->ref(); + return *this; +} + +MP4::Item::~Item() +{ + if(d->deref()) { + delete d; + } +} + +MP4::Item::Item(bool value) +{ + d = new ItemPrivate; + d->m_bool = value; +} + +MP4::Item::Item(int value) +{ + d = new ItemPrivate; + d->m_int = value; +} + +MP4::Item::Item(int value1, int value2) +{ + d = new ItemPrivate; + d->m_intPair.first = value1; + d->m_intPair.second = value2; +} + +MP4::Item::Item(const StringList &value) +{ + d = new ItemPrivate; + d->m_stringList = value; +} + +MP4::Item::Item(const MP4::CoverArtList &value) +{ + d = new ItemPrivate; + d->m_coverArtList = value; +} + +bool +MP4::Item::toBool() const +{ + return d->m_bool; +} + +int +MP4::Item::toInt() const +{ + return d->m_int; +} + +MP4::Item::IntPair +MP4::Item::toIntPair() const +{ + return d->m_intPair; +} + +StringList +MP4::Item::toStringList() const +{ + return d->m_stringList; +} + +MP4::CoverArtList +MP4::Item::toCoverArtList() const +{ + return d->m_coverArtList; +} + +bool +MP4::Item::isValid() const +{ + return d->valid; +} + +#endif