moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kiten / kloader.h
blob5682b21f5c2b9b4978ef337c1d6036dbc15b1fd3
1 // Copyright (C) 2001 Neil Stevens <neil@qualityassistant.com>
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
17 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Except as contained in this notice, the name(s) of the author(s) shall not be
21 // used in advertising or otherwise to promote the sale, use or other dealings
22 // in this Software without prior written authorization from the author(s).
24 #ifndef KLOADER_H
25 #define KLOADER_H
27 #include <qfile.h>
29 /**
30 * KLoader provides a way to load files in the most efficient way for
31 * both local and remote URLs.
33 class KLoader
35 public:
36 /**
37 * The constructor takes the url and decides the best way to save,
38 * which will mean using something like KIO::NetAccess or QFile.
40 KLoader(const KURL &_target);
42 /**
43 * The destructor closes if necessary.
45 ~KLoader();
47 /**
48 * open actually tries to open the file
50 * true on success, false on failure (get the error in @ref error)
52 bool open(void);
54 /**
55 * close closes the file.
57 void close(void);
59 /**
60 * If open or close returns false, there was an error, and error
61 * returns what the error was, when available.
63 QString error(void);
65 /**
66 * file returns a QFile open for reading, which may be for a temporary
67 * file on the local filesystem.
69 * If this is called before the file is opened, you will crash.
71 QFile &file(void);
73 /**
74 * You can use this to read in your data.
76 * If this is called before the file is opened, you will crash.
78 QTextStream &textStream(void);
80 /**
81 * You can use this to read in your data.
83 * If this is called before the file is opened, you will crash.
85 QDataStream &dataStream(void);
86 private:
87 class KLoaderPrivate;
88 KLoaderPrivate *d;
91 #endif