syndication/atom
content.h
00001 /* 00002 * This file is part of the syndication library 00003 * 00004 * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 00023 #ifndef SYNDICATION_ATOM_CONTENT_H 00024 #define SYNDICATION_ATOM_CONTENT_H 00025 00026 #include <syndication/elementwrapper.h> 00027 00028 #include <QtCore/QString> 00029 00030 #include <boost/shared_ptr.hpp> 00031 00032 class QByteArray; 00033 class QDomElement; 00034 00035 namespace Syndication { 00036 namespace Atom { 00037 00046 class SYNDICATION_EXPORT Content : public ElementWrapper 00047 { 00048 public: 00049 00053 enum Format 00054 { 00055 PlainText, 00058 EscapedHTML, 00060 XML, 00061 Binary 00062 }; 00063 00072 static Format mapTypeToFormat(const QString& type, 00073 const QString& src=QString()); 00074 00078 Content(); 00079 00086 explicit Content(const QDomElement& element); 00087 00093 Content(const Content& other); 00094 00098 ~Content(); 00099 00105 Content& operator=(const Content& other); 00106 00114 QString type() const; 00115 00127 QString src() const; 00128 00139 QString asString() const; 00140 00147 QByteArray asByteArray() const; 00148 00152 Format format() const; 00153 00159 bool isContained() const; 00160 00166 bool isXML() const; 00167 00172 bool isBinary() const; 00173 00178 bool isPlainText() const; 00179 00184 bool isEscapedHTML() const; 00185 00192 QString debugInfo() const; 00193 00194 private: 00195 class ContentPrivate; 00196 boost::shared_ptr<ContentPrivate> d; 00197 }; 00198 00199 } // namespace Atom 00200 } // namespace Syndication 00201 00202 #endif // SYNDICATION_ATOM_CONTENT_H