Syndication Library
tools.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_TOOLS_H 00024 #define SYNDICATION_TOOLS_H 00025 00026 #include <syndication/person.h> 00027 #include "ksyndication_export.h" 00028 00029 00030 #include <QtCore/QString> 00031 00032 #include <ctime> 00033 00034 class QByteArray; 00035 class QString; 00036 00037 namespace Syndication { 00038 00041 enum DateFormat 00042 { 00043 ISODate, 00047 RFCDate 00048 }; 00049 00059 SYNDICATION_EXPORT 00060 time_t parseISODate(const QString& str); 00061 00070 SYNDICATION_EXPORT 00071 time_t parseRFCDate(const QString& str); 00072 00086 SYNDICATION_EXPORT 00087 time_t parseDate(const QString& str, DateFormat hint=RFCDate); 00088 00089 00099 SYNDICATION_EXPORT 00100 QString dateTimeToString(time_t date); 00101 00107 SYNDICATION_EXPORT 00108 QString resolveEntities(const QString& str); 00109 00115 SYNDICATION_EXPORT 00116 QString escapeSpecialCharacters(const QString& str); 00117 00122 SYNDICATION_EXPORT 00123 QString convertNewlines(const QString& str); 00124 00130 SYNDICATION_EXPORT 00131 QString plainTextToHtml(const QString& plainText); 00132 00139 SYNDICATION_EXPORT 00140 QString htmlToPlainText(const QString& html); 00141 00149 SYNDICATION_EXPORT 00150 bool isHtml(const QString& str); 00151 00161 SYNDICATION_EXPORT 00162 bool stringContainsMarkup(const QString& str); 00163 00173 SYNDICATION_EXPORT 00174 QString normalize(const QString& str); 00175 00194 SYNDICATION_EXPORT 00195 QString normalize(const QString& str, bool isCDATA, bool containsMarkup); 00196 00205 SYNDICATION_EXPORT 00206 PersonPtr personFromString(const QString& str); 00207 00212 unsigned int calcHash(const QString& str); 00213 00218 unsigned int calcHash(const QByteArray& array); 00219 00224 QString calcMD5Sum(const QString& str); 00225 00226 //@cond PRIVATE 00231 struct ElementType 00232 { 00233 ElementType(const QString& localnamep, 00234 const QString& nsp=QString()); // implicit 00235 00236 bool operator==(const ElementType& other) const; 00237 00238 QString ns; 00239 QString localname; 00240 }; 00241 //@endcond 00242 00243 } // namespace Syndication 00244 00245 #endif // SYNDICATION_TOOLS_H
KDE 4.0 API Reference