00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "item.h"
00024 #include "category.h"
00025 #include "enclosure.h"
00026 #include "person.h"
00027 #include "tools.h"
00028
00029 #include <QtCore/QList>
00030 #include <QtCore/QString>
00031
00032 namespace Syndication {
00033
00034 Item::~Item()
00035 {
00036 }
00037
00038 QString Item::debugInfo() const
00039 {
00040 QString info;
00041
00042 info += "# Item begin ######################\n";
00043
00044 QString did = id();
00045 if (!did.isNull())
00046 info += "id: #" + did + "#\n";
00047
00048 QString dtitle = title();
00049 if (!dtitle.isNull())
00050 info += "title: #" + dtitle + "#\n";
00051
00052 QString dlink = link();
00053 if (!dlink.isNull())
00054 info += "link: #" + dlink + "#\n";
00055
00056 QString ddescription = description();
00057 if (!ddescription.isNull())
00058 info += "description: #" + ddescription + "#\n";
00059
00060 QString dcontent = content();
00061 if (!dcontent.isNull())
00062 info += "content: #" + dcontent + "#\n";
00063
00064 QString pubdate = dateTimeToString(datePublished());
00065 if (!pubdate.isNull())
00066 info += "datePublished: #" + pubdate + "#\n";
00067
00068 QString update = dateTimeToString(dateUpdated());
00069 if (!update.isNull())
00070 info += "dateUpdated: #" + update + "#\n";
00071
00072 QString dlanguage = language();
00073 if (!dlanguage.isNull())
00074 info += "language: #" + dlanguage + "#\n";
00075
00076 QList<PersonPtr> dauthors = authors();
00077 QList<PersonPtr>::ConstIterator itp = dauthors.constBegin();
00078 QList<PersonPtr>::ConstIterator endp = dauthors.constEnd();
00079
00080 for ( ; itp != endp; ++itp)
00081 info += (*itp)->debugInfo();
00082
00083 QList<CategoryPtr> dcategories = categories();
00084 QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin();
00085 QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd();
00086
00087 for ( ; itc != endc; ++itc)
00088 info += (*itc)->debugInfo();
00089
00090 QList<EnclosurePtr> denclosures = enclosures();
00091 QList<EnclosurePtr>::ConstIterator ite = denclosures.constBegin();
00092 QList<EnclosurePtr>::ConstIterator ende = denclosures.constEnd();
00093
00094 for ( ; ite != ende; ++ite)
00095 info += (*ite)->debugInfo();
00096
00097 int dcommentsCount = commentsCount();
00098 if (dcommentsCount != -1)
00099 {
00100 info+= "commentsCount: #" + QString::number(dcommentsCount) + "#\n";
00101 }
00102
00103 QString dcommentsLink = commentsLink();
00104 if (!dcommentsLink.isNull())
00105 info+= "commentsLink: #" + dcommentsLink + "#\n";
00106
00107 QString dcommentsFeed = commentsFeed();
00108 if (!dcommentsFeed.isNull())
00109 info+= "commentsFeed: #" + dcommentsFeed + "#\n";
00110
00111 QString dcommentPostUri = commentPostUri();
00112 if (!dcommentPostUri.isNull())
00113 info+= "commentPostUri: #" + dcommentPostUri + "#\n";
00114
00115 info += "# Item end ########################\n";
00116
00117 return info;
00118 }
00119
00120 }