25 FltExternalReference::
50 if (!_bead_id.empty()) {
51 out <<
" (" << _bead_id <<
")";
60 return _converted_filename;
68 _converted_filename = filename;
77 bool FltExternalReference::
79 if (!FltBead::extract_record(reader)) {
83 nassertr(reader.
get_opcode() == FO_external_ref,
false);
87 iterator.skip_bytes(1 + 1);
88 iterator.skip_bytes(2);
89 _flags = iterator.get_be_uint32();
90 iterator.skip_bytes(2);
91 iterator.skip_bytes(2);
93 _orig_filename = name;
95 if (!name.empty() && name[name.length() - 1] ==
'>') {
97 size_t open = name.rfind(
'<');
98 if (open != std::string::npos) {
99 _orig_filename = name.substr(0, open);
100 _bead_id = name.substr(open + 1, name.length() - open - 2);
114 bool FltExternalReference::
116 if (!FltBead::build_record(writer)) {
123 std::string name = _orig_filename;
124 if (!_bead_id.empty()) {
125 name +=
"<" + _bead_id +
">";
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void check_remaining_size(const DatagramIterator &di, const std::string &name=std::string()) const
Checks that the iterator has no bytes left, as it should at the end of a successfully read record.
virtual void apply_converted_filenames()
Walks the hierarchy at this record and below and copies the _converted_filename record into the _orig...
virtual void apply_converted_filenames()
Walks the hierarchy at this record and below and copies the _converted_filename record into the _orig...
void set_ref_filename(const Filename &filename)
Changes the name of the referenced file.
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
DatagramIterator & get_iterator()
Returns an iterator suitable for extracting data from the current record.
void pad_bytes(size_t size)
Adds the indicated number of zero bytes to the datagram.
std::string to_os_generic() const
This is similar to to_os_specific(), but it is designed to generate a filename that can be understood...
virtual void output(std::ostream &out) const
Writes a quick one-line description of the record, but not its children.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_be_uint32(uint32_t value)
Adds an unsigned 32-bit big-endian integer to the datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Filename get_ref_filename() const
Returns the name of the referenced file.
FltOpcode get_opcode() const
Returns the opcode associated with the current record.
A class to retrieve the individual data elements previously stored in a Datagram.
void add_fixed_string(const std::string &str, size_t size)
Adds a fixed-length string to the datagram.
TypeHandle is the identifier used to differentiate C++ class types.
void set_opcode(FltOpcode opcode)
Sets the opcode associated with the current record.
Datagram & update_datagram()
Returns a modifiable reference to the datagram associated with the current record.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
static Filename from_os_specific(const std::string &os_specific, Type type=T_general)
This named constructor returns a Panda-style filename (that is, using forward slashes,...
std::string get_fixed_string(size_t size)
Extracts a fixed-length string.