1 #ifndef _LOGFILE_H_ 2 #define _LOGFILE_H_ 3 //============================================================================= 4 // 5 // File : LogFile.h 6 // Creation date : Thu Apr 14 2011 19:16:59 by Elvio Basello 7 // 8 // This file is part of the KVIrc IRC client distribution 9 // Copyright (C) 2011 Elvio Basello (hellvis69 at gmail dot com) 10 // 11 // This program is FREE software. You can redistribute it and/or 12 // modify it under the terms of the GNU General Public License 13 // as published by the Free Software Foundation; either version 2 14 // of the License, or (at your option) any later version. 15 // 16 // This program is distributed in the HOPE that it will be USEFUL, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 // See the GNU General Public License for more details. 20 // 21 // You should have received a copy of the GNU General Public License 22 // along with this program. If not, write to the Free Software Foundation, 23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 // 25 //============================================================================= 26 27 /** 28 * \file LogFile.h 29 * \author Elvio Basello 30 * \brief Describes a log file 31 * 32 * This file was originally part of LogViewWindow.h 33 */ 34 35 #include <QDate> 36 37 class QString; 38 39 /** 40 * \struct _LogFileData 41 * \brief A struct that contains the data of a log 42 */ 43 struct LogFileData 44 { 45 QString szName; /**< the name of the log */ 46 QString szType; /**< the type of the log */ 47 QString szFile; /**< the name of the exported log */ 48 }; 49 50 /** 51 * \class LogFile 52 * \brief The LogFile class which handle any log file 53 * 54 * Log is in the format: 55 * $type_$nick.$network_$YYYY.$MM.$DD.log 56 * Examples: 57 * query_noldor.azzurra_2009.05.20.log 58 * channel_#slackware.azzurra_2009.11.03.log 59 */ 60 class LogFile 61 { 62 public: 63 /** 64 * \enum Type 65 * \brief Holds the type of the log file 66 */ 67 enum Type 68 { 69 Channel = 0, /**< the log file of a channel */ 70 Console = 1, /**< the log file of a console */ 71 Query = 2, /**< the log file of a query */ 72 DccChat = 3, /**< the log file of a dcc chat */ 73 Other = 4 /**< any other log file */ 74 }; 75 76 /** 77 * \enum ExportType 78 * \brief Holds the type of the exported log file 79 */ 80 enum ExportType 81 { 82 PlainText, /**< export log in plain text file */ 83 HTML /**< export log in a HTML archive */ 84 //XML /**< export log in a XML file */ 85 //DB /**< export log in a database file */ 86 }; 87 88 /** 89 * \brief Constructs the log file object 90 * \param szName The name of the log 91 * \return LogFile 92 */ 93 LogFile(const QString & szName); 94 95 private: 96 Type m_eType; 97 QString m_szType; 98 QString m_szFilename; 99 bool m_bCompressed; 100 QString m_szName; 101 QString m_szNetwork; 102 QDate m_date; 103 104 public: 105 /** 106 * \brief Returns the type of the log 107 * \return Type 108 */ type()109 Type type() const { return m_eType; }; 110 111 /** 112 * \brief Returns the type of the log 113 * \return const QString & 114 */ typeString()115 const QString & typeString() const { return m_szType; }; 116 117 /** 118 * \brief Returns the filename of the log 119 * \return const QString & 120 */ fileName()121 const QString & fileName() const { return m_szFilename; }; 122 123 /** 124 * \brief Returns the name of the log 125 * \return const QString & 126 */ name()127 const QString & name() const { return m_szName; }; 128 129 /** 130 * \brief Returns the network of the log 131 * \return const QString & 132 */ network()133 const QString & network() const { return m_szNetwork; }; 134 135 /** 136 * \brief Returns the date of the log 137 * \return const QDate & 138 */ date()139 const QDate & date() const { return m_date; }; 140 141 /** 142 * \brief Returns the text of the log file 143 * \param szText The buffer where to save the contents of the log 144 * \return void 145 */ 146 void getText(QString & szText); 147 }; 148 149 #endif // _LOGFILE_H_ 150