Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/qt_gui/src/lib/util/directory.h @ 7625

Last change on this file since 7625 was 7625, checked in by bensch, 18 years ago

qt_gui: Directory in File-style

File size: 2.8 KB
Line 
1/*!
2 * @file directory.h
3 * @brief Definition of the Directory Handler class
4 */
5
6
7/**
8 * Copyright (C) 2002 Bart Vanhauwaert
9 *
10 * Permission to use, copy, modify, distribute and sell this software
11 * for any purpose is hereby granted without fee. This license
12 * includes (but is not limited to) standalone compilation or as part
13 * of a larger project.
14 *
15 * This software is provided "as is" without express or implied warranty.
16 *
17 * For a full statement on warranty and terms and conditions for
18 * copying, distribution and modification, please see the comment block
19 * at the end of this file.
20 *
21 * Version 1
22 *
23 */
24
25#ifndef __DIRECTORY_H_
26#define __DIRECTORY_H_
27
28#include "file.h"
29
30#if not defined (__WIN32__)
31 #include <sys/types.h>
32 #include <dirent.h>
33#else
34 #include <windows.h>
35 #include <winbase.h>
36#endif
37
38class Directory : public File
39{
40public:
41  Directory(const std::string& directoryName = "");
42  ~Directory();
43
44  virtual bool open();
45  virtual bool close();
46  operator void*() const { return willfail ? (void*)0:(void*)(-1); }
47
48  std::string next();
49
50  bool create();
51
52private:
53#if not defined(__WIN32__)
54  DIR* handle;
55#else
56  HANDLE    handle;
57#endif
58  bool willfail;
59  std::string current;
60};
61
62
63
64#endif /* __DIRECTORY_H_ */
65
66/**
67 *
68 * The "library", above, refers to the collection of software functions
69 * and/or data contained in this file, prepared so as to be conveniently
70 * compiled and linked with application programs (which use some of those
71 * functions and data) to form executables.
72 *
73 *                             NO WARRANTY
74 *
75 * 1. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
76 * WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
77 * EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
78 * OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
79 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
80 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
81 * PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
82 * LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
83 * THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
84 *
85 * 2. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
86 * WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
87 * AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
88 * FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
89 * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
90 * LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
91 * RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
92 * FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
93 * SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
94 * DAMAGES.
95 *
96 * END OF TERMS AND CONDITIONS
97 *
98 */
99
Note: See TracBrowser for help on using the repository browser.