Panda3D
Loading...
Searching...
No Matches
datagramInputFile.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 datagramInputFile.I
10 * @author drose
11 * @date 2000-10-30
12 */
13
14/**
15 *
16 */
17INLINE DatagramInputFile::
18DatagramInputFile() {
19 _error = false;
20 _read_first_datagram = false;
21 _in = nullptr;
22 _owns_in = false;
23 _timestamp = 0;
24}
25
26/**
27 *
28 */
29INLINE DatagramInputFile::
30~DatagramInputFile() {
31 close();
32}
33
34/**
35 * Opens the indicated filename for reading. Returns true on success, false
36 * on failure.
37 */
39open(const Filename &filename) {
40 return open(new FileReference(filename));
41}
42
43/**
44 * Returns the istream represented by the input file.
45 */
46INLINE std::istream &DatagramInputFile::
47get_stream() {
48 static std::ifstream null_stream;
49 nassertr(_in != nullptr, null_stream);
50 return *_in;
51}
void close()
Closes the file.
bool open(const FileReference *file)
Opens the indicated filename for reading.
std::istream & get_stream()
Returns the istream represented by the input file.
Keeps a reference-counted pointer to a file on disk.
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44