tdeioslave/mbox

readmbox.h
1 /*
2  * This is a simple tdeioslave to handle mbox-files.
3  * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl)
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 #ifndef READMBOX_H
20 #define READMBOX_H
21 
22 #include "mboxfile.h"
23 
24 class UrlInfo;
25 class MBox;
26 
27 class TQFile;
28 class TQString;
29 class TQTextStream;
30 
31 struct utimbuf;
32 
36 class ReadMBox : public MBoxFile
37 {
38 public:
47  ReadMBox( const UrlInfo* info, MBoxProtocol* parent, bool onlynew = false, bool savetime = false );
48 
52  ~ReadMBox();
53 
58  TQString currentLine() const;
59 
65  TQString currentID() const;
66 
73  bool nextLine();
74 
81  bool searchMessage( const TQString& id );
82 
89  unsigned int skipMessage();
90 
94  void rewind();
95 
100  bool atEnd() const;
101 
106  bool inListing() const;
107 private:
112  bool open( bool savetime );
113 
117  void close();
118 
119 private:
120  TQFile* m_file;
121  TQTextStream* m_stream;
122  TQString* m_current_line;
123  TQString* m_current_id;
124  bool m_atend;
125 
126  struct utimbuf* m_prev_time;
127 
128  bool m_only_new, m_savetime;
129 
130  bool m_status, m_prev_status, m_header;
131 };
132 #endif
This class can be used to lock files when implemented.
Definition: mboxfile.h:30
This class is the main class and implements all function which can be called through the user.
Definition: mbox.h:32
This class handels reading from a mbox-file.
Definition: readmbox.h:37
~ReadMBox()
Destructor.
Definition: readmbox.cpp:66
bool nextLine()
This function reads the next line.
Definition: readmbox.cpp:82
ReadMBox(const UrlInfo *info, MBoxProtocol *parent, bool onlynew=false, bool savetime=false)
Constructor.
Definition: readmbox.cpp:40
TQString currentID() const
This function returns the current id.
Definition: readmbox.cpp:77
void rewind()
Sets the cursor back to the beginning of the file.
Definition: readmbox.cpp:143
bool inListing() const
Return true if the message is a new message, or all messages are listed.
Definition: readmbox.cpp:160
TQString currentLine() const
This functions return the current line.
Definition: readmbox.cpp:72
bool atEnd() const
Returns true if the cursor is at EOF.
Definition: readmbox.cpp:152
unsigned int skipMessage()
Skips all lines which belongs to the current message.
Definition: readmbox.cpp:130
bool searchMessage(const TQString &id)
This function search the file for a certain id.
Definition: readmbox.cpp:119