mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
tpicture*: run astyle
This commit is contained in:
parent
71e8915568
commit
3ea69ed165
@ -30,162 +30,155 @@ using namespace TagLib;
|
||||
class Picture::PicturePrivate : public RefCounter
|
||||
{
|
||||
public:
|
||||
PicturePrivate() : RefCounter()
|
||||
{
|
||||
}
|
||||
PicturePrivate() : RefCounter()
|
||||
{
|
||||
}
|
||||
|
||||
String description;
|
||||
String mime;
|
||||
Type type;
|
||||
ByteVector data;
|
||||
String description;
|
||||
String mime;
|
||||
Type type;
|
||||
ByteVector data;
|
||||
};
|
||||
|
||||
Picture::Picture()
|
||||
: _p(new PicturePrivate())
|
||||
: _p(new PicturePrivate())
|
||||
{
|
||||
}
|
||||
|
||||
Picture::Picture(const ByteVector& data,
|
||||
Picture::Picture(const ByteVector &data,
|
||||
Type type,
|
||||
const String& mime,
|
||||
const String& description)
|
||||
: _p(new PicturePrivate())
|
||||
const String &mime,
|
||||
const String &description)
|
||||
: _p(new PicturePrivate())
|
||||
{
|
||||
_p->mime = mime;
|
||||
_p->description = description;
|
||||
_p->type = type;
|
||||
_p->data = data;
|
||||
_p->mime = mime;
|
||||
_p->description = description;
|
||||
_p->type = type;
|
||||
_p->data = data;
|
||||
}
|
||||
|
||||
Picture::Picture(const Picture& p)
|
||||
: _p( p.p() )
|
||||
Picture::Picture(const Picture &p)
|
||||
: _p(p.p())
|
||||
{
|
||||
_p->ref();
|
||||
_p->ref();
|
||||
}
|
||||
|
||||
const String& Picture::description() const
|
||||
const String &Picture::description() const
|
||||
{
|
||||
return _p->description;
|
||||
return _p->description;
|
||||
}
|
||||
|
||||
const ByteVector& Picture::data() const
|
||||
const ByteVector &Picture::data() const
|
||||
{
|
||||
return _p->data;
|
||||
return _p->data;
|
||||
}
|
||||
|
||||
const String& Picture::mime() const
|
||||
const String &Picture::mime() const
|
||||
{
|
||||
return _p->mime;
|
||||
return _p->mime;
|
||||
}
|
||||
|
||||
Picture::Type Picture::type() const
|
||||
{
|
||||
return _p->type;
|
||||
return _p->type;
|
||||
}
|
||||
|
||||
Picture::~Picture()
|
||||
{
|
||||
if( _p->deref() )
|
||||
{
|
||||
delete _p;
|
||||
}
|
||||
if(_p->deref())
|
||||
delete _p;
|
||||
}
|
||||
|
||||
/* =========== OPERATORS =========== */
|
||||
|
||||
Picture& Picture::operator =(const Picture& p)
|
||||
Picture &Picture::operator =(const Picture &p)
|
||||
{
|
||||
if( &p == this )
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
if( _p && _p->deref() )
|
||||
{
|
||||
delete _p;
|
||||
}
|
||||
|
||||
_p = p.p();
|
||||
_p->ref();
|
||||
if(&p == this)
|
||||
return *this;
|
||||
|
||||
if(_p && _p->deref())
|
||||
delete _p;
|
||||
|
||||
_p = p.p();
|
||||
_p->ref();
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const Picture& p)
|
||||
std::ostream &operator<<(std::ostream &s, const Picture &p)
|
||||
{
|
||||
String type;
|
||||
switch(p.type())
|
||||
{
|
||||
case Picture::Other:
|
||||
type = "Other";
|
||||
break;
|
||||
case Picture::FileIcon:
|
||||
type = "FileIcon";
|
||||
break;
|
||||
case Picture::OtherFileIcon:
|
||||
type = "OtherFileIcon";
|
||||
break;
|
||||
case Picture::FrontCover:
|
||||
type = "FrontCover";
|
||||
break;
|
||||
case Picture::BackCover:
|
||||
type = "BackCover";
|
||||
break;
|
||||
case Picture::LeafletPage:
|
||||
type = "LeafletPage";
|
||||
break;
|
||||
case Picture::Media:
|
||||
type = "Media";
|
||||
break;
|
||||
case Picture::LeadArtist:
|
||||
type = "LeadArtist";
|
||||
break;
|
||||
case Picture::Artist:
|
||||
type = "Artist";
|
||||
break;
|
||||
case Picture::Conductor:
|
||||
type = "Conductor";
|
||||
break;
|
||||
case Picture::Band:
|
||||
type = "Band";
|
||||
break;
|
||||
case Picture::Composer:
|
||||
type = "Composer";
|
||||
break;
|
||||
case Picture::Lyricist:
|
||||
type = "Lyricist";
|
||||
break;
|
||||
case Picture::RecordingLocation:
|
||||
type = "RecordingLocation";
|
||||
break;
|
||||
case Picture::DuringRecording:
|
||||
type = "DuringRecording";
|
||||
break;
|
||||
case Picture::DuringPerformance:
|
||||
type = "DuringPerformance";
|
||||
break;
|
||||
case Picture::MovieScreenCapture:
|
||||
type = "MovieScreenCapture";
|
||||
break;
|
||||
case Picture::ColouredFish:
|
||||
type = "ColouredFish";
|
||||
break;
|
||||
case Picture::Illustration:
|
||||
type = "Illustration";
|
||||
break;
|
||||
case Picture::BandLogo:
|
||||
type = "BandLogo";
|
||||
break;
|
||||
case Picture::PublisherLogo:
|
||||
type = "PublisherLogo";
|
||||
break;
|
||||
}
|
||||
String type;
|
||||
switch(p.type()) {
|
||||
case Picture::Other:
|
||||
type = "Other";
|
||||
break;
|
||||
case Picture::FileIcon:
|
||||
type = "FileIcon";
|
||||
break;
|
||||
case Picture::OtherFileIcon:
|
||||
type = "OtherFileIcon";
|
||||
break;
|
||||
case Picture::FrontCover:
|
||||
type = "FrontCover";
|
||||
break;
|
||||
case Picture::BackCover:
|
||||
type = "BackCover";
|
||||
break;
|
||||
case Picture::LeafletPage:
|
||||
type = "LeafletPage";
|
||||
break;
|
||||
case Picture::Media:
|
||||
type = "Media";
|
||||
break;
|
||||
case Picture::LeadArtist:
|
||||
type = "LeadArtist";
|
||||
break;
|
||||
case Picture::Artist:
|
||||
type = "Artist";
|
||||
break;
|
||||
case Picture::Conductor:
|
||||
type = "Conductor";
|
||||
break;
|
||||
case Picture::Band:
|
||||
type = "Band";
|
||||
break;
|
||||
case Picture::Composer:
|
||||
type = "Composer";
|
||||
break;
|
||||
case Picture::Lyricist:
|
||||
type = "Lyricist";
|
||||
break;
|
||||
case Picture::RecordingLocation:
|
||||
type = "RecordingLocation";
|
||||
break;
|
||||
case Picture::DuringRecording:
|
||||
type = "DuringRecording";
|
||||
break;
|
||||
case Picture::DuringPerformance:
|
||||
type = "DuringPerformance";
|
||||
break;
|
||||
case Picture::MovieScreenCapture:
|
||||
type = "MovieScreenCapture";
|
||||
break;
|
||||
case Picture::ColouredFish:
|
||||
type = "ColouredFish";
|
||||
break;
|
||||
case Picture::Illustration:
|
||||
type = "Illustration";
|
||||
break;
|
||||
case Picture::BandLogo:
|
||||
type = "BandLogo";
|
||||
break;
|
||||
case Picture::PublisherLogo:
|
||||
type = "PublisherLogo";
|
||||
break;
|
||||
}
|
||||
|
||||
ByteVector displayableData = p.data().mid(0,20).toHex();
|
||||
s << "\nPicture:\n"
|
||||
<< "\ttype: " << type.to8Bit() << std::endl
|
||||
<< "\tdesc: " << p.description().to8Bit() << std::endl
|
||||
<< "\tmime: " << p.mime().to8Bit() << std::endl
|
||||
<< "\tdata: " << std::hex << displayableData << "..." << std::endl;
|
||||
ByteVector displayableData = p.data().mid(0, 20).toHex();
|
||||
s << "\nPicture:\n"
|
||||
<< "\ttype: " << type.to8Bit() << std::endl
|
||||
<< "\tdesc: " << p.description().to8Bit() << std::endl
|
||||
<< "\tmime: " << p.mime().to8Bit() << std::endl
|
||||
<< "\tdata: " << std::hex << displayableData << "..." << std::endl;
|
||||
|
||||
return s;
|
||||
return s;
|
||||
}
|
||||
|
@ -33,12 +33,12 @@
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
class TAGLIB_EXPORT Picture
|
||||
{
|
||||
class TAGLIB_EXPORT Picture
|
||||
{
|
||||
|
||||
class PicturePrivate;
|
||||
class PicturePrivate;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief The Type enum is based on types in id3v2 tags
|
||||
@ -97,7 +97,7 @@ public:
|
||||
* @brief Picture
|
||||
* @param p
|
||||
*/
|
||||
Picture(const Picture& p);
|
||||
Picture(const Picture &p);
|
||||
|
||||
/**
|
||||
* @brief Picture
|
||||
@ -106,31 +106,34 @@ public:
|
||||
* @param mime
|
||||
* @param description
|
||||
*/
|
||||
Picture(const ByteVector& data,
|
||||
Picture(const ByteVector &data,
|
||||
Type type = Other,
|
||||
const String& mime = "image/",
|
||||
const String& description = String());
|
||||
const String &mime = "image/",
|
||||
const String &description = String());
|
||||
|
||||
/*!
|
||||
* Destroys this Picture instance.
|
||||
*/
|
||||
virtual ~Picture();
|
||||
|
||||
const String& mime() const;
|
||||
const String& description() const;
|
||||
const String &mime() const;
|
||||
const String &description() const;
|
||||
Type type() const;
|
||||
const ByteVector& data() const;
|
||||
const ByteVector &data() const;
|
||||
|
||||
/*!
|
||||
* Performs a shallow, implicitly shared, copy of \a p, overwriting the
|
||||
* Picture's current data.
|
||||
*/
|
||||
Picture& operator=(const Picture& p);
|
||||
Picture &operator=(const Picture &p);
|
||||
|
||||
private:
|
||||
PicturePrivate* p() const{ return _p; }
|
||||
PicturePrivate* _p;
|
||||
};
|
||||
private:
|
||||
PicturePrivate *p() const
|
||||
{
|
||||
return _p;
|
||||
}
|
||||
PicturePrivate *_p;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,57 +31,52 @@ PictureMap::PictureMap() : Map< Picture::Type, PictureList >()
|
||||
{
|
||||
}
|
||||
|
||||
PictureMap::PictureMap(const PictureList& l)
|
||||
: Map< Picture::Type, PictureList >()
|
||||
PictureMap::PictureMap(const PictureList &l)
|
||||
: Map< Picture::Type, PictureList >()
|
||||
{
|
||||
insert( l );
|
||||
insert(l);
|
||||
}
|
||||
|
||||
PictureMap::PictureMap(const Picture& p)
|
||||
: Map< Picture::Type, PictureList >()
|
||||
PictureMap::PictureMap(const Picture &p)
|
||||
: Map< Picture::Type, PictureList >()
|
||||
{
|
||||
insert( p );
|
||||
insert(p);
|
||||
}
|
||||
|
||||
void PictureMap::insert(const Picture& p)
|
||||
void PictureMap::insert(const Picture &p)
|
||||
{
|
||||
PictureList list;
|
||||
if(contains(p.type()))
|
||||
{
|
||||
list = Map<Picture::Type, PictureList>::find(p.type())->second;
|
||||
list.append( p );
|
||||
Map<Picture::Type, PictureList>::insert(p.type(), list);
|
||||
}
|
||||
else{
|
||||
list.append(p);
|
||||
Map<Picture::Type, PictureList>::insert(p.type(), list);
|
||||
}
|
||||
PictureList list;
|
||||
if(contains(p.type())) {
|
||||
list = Map<Picture::Type, PictureList>::find(p.type())->second;
|
||||
list.append(p);
|
||||
Map<Picture::Type, PictureList>::insert(p.type(), list);
|
||||
}
|
||||
else {
|
||||
list.append(p);
|
||||
Map<Picture::Type, PictureList>::insert(p.type(), list);
|
||||
}
|
||||
}
|
||||
|
||||
void PictureMap::insert(const PictureList &l)
|
||||
{
|
||||
for(PictureList::ConstIterator it = l.begin(); it != l.end(); ++it)
|
||||
{
|
||||
Picture picture = (*it);
|
||||
insert(picture);
|
||||
}
|
||||
for(PictureList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
Picture picture = (*it);
|
||||
insert(picture);
|
||||
}
|
||||
}
|
||||
|
||||
PictureMap::~PictureMap()
|
||||
{
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const PictureMap& map)
|
||||
std::ostream &operator<<(std::ostream &s, const PictureMap &map)
|
||||
{
|
||||
for(PictureMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
PictureList list = it->second;
|
||||
for(PictureList::ConstIterator it2 = list.begin();
|
||||
it2 != list.end();
|
||||
++it2 )
|
||||
{
|
||||
s << *it2;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
for(PictureMap::ConstIterator it = map.begin(); it != map.end(); ++it) {
|
||||
PictureList list = it->second;
|
||||
for(PictureList::ConstIterator it2 = list.begin();
|
||||
it2 != list.end();
|
||||
++it2)
|
||||
s << *it2;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -33,16 +33,16 @@
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
//! A list of pictures
|
||||
//! A list of pictures
|
||||
|
||||
typedef List<Picture> PictureList;
|
||||
typedef List<Picture> PictureList;
|
||||
|
||||
/*!
|
||||
* This is a spcialization of the List class with some members.
|
||||
*/
|
||||
class TAGLIB_EXPORT PictureMap : public Map< Picture::Type, PictureList >
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* This is a spcialization of the List class with some members.
|
||||
*/
|
||||
class TAGLIB_EXPORT PictureMap : public Map< Picture::Type, PictureList >
|
||||
{
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructs an empty PictureList.
|
||||
@ -52,12 +52,12 @@ public:
|
||||
/*!
|
||||
* Constructs a PictureMap with \a Picture.
|
||||
*/
|
||||
PictureMap(const Picture& p);
|
||||
PictureMap(const Picture &p);
|
||||
|
||||
/*!
|
||||
* Constructs a PictureMap with \a PictureList as a member.
|
||||
*/
|
||||
PictureMap(const PictureList& l);
|
||||
PictureMap(const PictureList &l);
|
||||
|
||||
/*!
|
||||
* Destroys this PictureList instance.
|
||||
@ -68,17 +68,17 @@ public:
|
||||
* @brief insert
|
||||
* @param l
|
||||
*/
|
||||
void insert(const PictureList& l);
|
||||
void insert(const PictureList &l);
|
||||
|
||||
/**
|
||||
* @brief insert
|
||||
* @param p
|
||||
*/
|
||||
void insert(const Picture& p);
|
||||
};
|
||||
void insert(const Picture &p);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
TAGLIB_EXPORT std::ostream &operator<<(std::ostream &s, const TagLib::PictureMap& map);
|
||||
TAGLIB_EXPORT std::ostream &operator<<(std::ostream &s, const TagLib::PictureMap &map);
|
||||
|
||||
#endif // TAGLIB_PICTUREMAP_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user