summaryrefslogtreecommitdiffstats
path: root/tdeioslave/mbox/stat.h
blob: 4e2c1f020ef0ed4a73ffcb3df77f468790c4db47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * This is a simple tdeioslave to handle mbox-files.
 * Copyright (C) 2004 Mart Kelder ([email protected])
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef STAT_H
#define STAT_H

#include <tdeio/global.h>

class ReadMBox;
class UrlInfo;

class KURL;

class TQString;

/**
 * This class is used to get the stats of a mbox-email or mbox-file.
 * This class only uses static members.
 */
class Stat
{
public:
	/**
	 * Empty constructor
	 */
	Stat()  {}

	/**
	 * Emtpy destructor
	 */
	~Stat() {}
	
	/**
	 * This functions gives information with a given UrlInfo.
	 * @param info The file information
	 * @return The information of the file as destribed in UrlInfo.
	 */
	static TDEIO::UDSEntry stat( const UrlInfo& info );
	/**
	 * This function gives information with a given ReadMBox and UrlInfo.
	 * Through this, it is possible to ask the stats of the next message,
	 * without reopening the mbox-file.
	 * @param mbox The ReadMBox instance, used to search the mbox-email in.
	 * @param info The url information.
	 * @return The requesteds information.
	 */
	static TDEIO::UDSEntry stat( ReadMBox& mbox, const UrlInfo& info );
	
	/**
	 * This function gets the stats of a given mbox-file in an UDSEntry.
	 * @param info The location of the mbox-file.
	 * @return A list of Atoms.
	 */
	static TDEIO::UDSEntry statDirectory( const UrlInfo& info );

	/**
	 * This function gets the stats of a geven mbox-message in a UDSEntry.
	 * @param info The url of the mbox-message.
	 * @return Information shipped in an UDSEntry.
	 */
	static TDEIO::UDSEntry statMessage( const UrlInfo& info );
private:
	static void addAtom( TDEIO::UDSEntry& entry, unsigned int key, const TQString& value );
	static void addAtom( TDEIO::UDSEntry& entry, unsigned int key, const long value );
};

#endif