Panda3D

virtualFile.I
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file virtualFile.I
10 * @author drose
11 * @date 2002-08-03
12 */
13
14 /**
15 *
16 */
17 INLINE VirtualFile::
18 VirtualFile() {
19 }
20
21 /**
22 * Returns the original filename as it was used to locate this VirtualFile.
23 * This is usually, but not always, the same string returned by
24 * get_filename().
25 */
26 INLINE const Filename &VirtualFile::
27 get_original_filename() const {
28 return _original_filename;
29 }
30
31 /**
32 * Returns the entire contents of the file as a string.
33 */
34 INLINE std::string VirtualFile::
35 read_file(bool auto_unwrap) const {
36 std::string result;
37 read_file(result, auto_unwrap);
38 return result;
39 }
40
41 /**
42 * Writes the entire contents of the file as a string, if it is writable.
43 */
44 INLINE bool VirtualFile::
45 write_file(const std::string &data, bool auto_wrap) {
46 return write_file((const unsigned char *)data.data(), data.size(), auto_wrap);
47 }
48
49 /**
50 * Stores the original filename that was used to locate this VirtualFile.
51 * This is normally called only by the VirtualFileSystem, as it creates each
52 * VirtualFile.
53 */
54 INLINE void VirtualFile::
55 set_original_filename(const Filename &filename) {
56 _original_filename = filename;
57 }
58
59
60 INLINE std::ostream &
61 operator << (std::ostream &out, const VirtualFile &file) {
62 file.output(out);
63 return out;
64 }
Filename
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
VirtualFile
The abstract base class for a file or directory within the VirtualFileSystem.
Definition: virtualFile.h:35
VirtualFile::get_original_filename
const Filename & get_original_filename() const
Returns the original filename as it was used to locate this VirtualFile.
Definition: virtualFile.I:27
VirtualFile::read_file
std::string read_file(bool auto_unwrap) const
Returns the entire contents of the file as a string.
Definition: virtualFile.I:35
VirtualFile::set_original_filename
void set_original_filename(const Filename &filename)
Stores the original filename that was used to locate this VirtualFile.
Definition: virtualFile.I:55
VirtualFile::write_file
bool write_file(const std::string &data, bool auto_wrap)
Writes the entire contents of the file as a string, if it is writable.
Definition: virtualFile.I:45