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