Panda3D
 All Classes Functions Variables Enumerations
subfileInfo.I
00001 // Filename: subfileInfo.I
00002 // Created by:  drose (20Jun11)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: SubfileInfo::Default Constructor
00018 //       Access: Published
00019 //  Description: 
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE SubfileInfo::
00022 SubfileInfo() :
00023   _start(0),
00024   _size(0)
00025 {
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: SubfileInfo::Constructor
00030 //       Access: Published
00031 //  Description: 
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE SubfileInfo::
00034 SubfileInfo(const FileReference *file, streampos start, streamsize size) :
00035   _file(file),
00036   _start(start),
00037   _size(size)
00038 {
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: SubfileInfo::Constructor
00043 //       Access: Published
00044 //  Description: 
00045 ////////////////////////////////////////////////////////////////////
00046 INLINE SubfileInfo::
00047 SubfileInfo(const Filename &filename, streampos start, streamsize size) :
00048   _file(new FileReference(filename)),
00049   _start(start),
00050   _size(size)
00051 {
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: SubfileInfo::Copy Constructor
00056 //       Access: Published
00057 //  Description: 
00058 ////////////////////////////////////////////////////////////////////
00059 INLINE SubfileInfo::
00060 SubfileInfo(const SubfileInfo &copy) :
00061   _file(copy._file),
00062   _start(copy._start),
00063   _size(copy._size)
00064 {
00065 }
00066 
00067 ////////////////////////////////////////////////////////////////////
00068 //     Function: SubfileInfo::Copy Assignment Operator
00069 //       Access: Published
00070 //  Description: 
00071 ////////////////////////////////////////////////////////////////////
00072 INLINE void SubfileInfo::
00073 operator = (const SubfileInfo &copy) {
00074   _file = copy._file;
00075   _start = copy._start;
00076   _size = copy._size;
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: SubfileInfo::is_empty
00081 //       Access: Published
00082 //  Description: Returns true if this SubfileInfo doesn't define any
00083 //               file, false if it has real data.
00084 ////////////////////////////////////////////////////////////////////
00085 INLINE bool SubfileInfo::
00086 is_empty() const {
00087   return _file == (FileReference *)NULL;
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: SubfileInfo::get_file
00092 //       Access: Published
00093 //  Description: Returns the FileReference that represents this file.
00094 ////////////////////////////////////////////////////////////////////
00095 INLINE const FileReference *SubfileInfo::
00096 get_file() const {
00097   return _file;
00098 }
00099 
00100 ////////////////////////////////////////////////////////////////////
00101 //     Function: SubfileInfo::get_filename
00102 //       Access: Published
00103 //  Description: A shortcut to the filename.
00104 ////////////////////////////////////////////////////////////////////
00105 INLINE const Filename &SubfileInfo::
00106 get_filename() const {
00107   if (_file != (FileReference *)NULL) {
00108     return _file->get_filename();
00109   }
00110   static const Filename empty_filename;
00111   return empty_filename;
00112 }
00113 
00114 ////////////////////////////////////////////////////////////////////
00115 //     Function: SubfileInfo::get_start
00116 //       Access: Published
00117 //  Description: Returns the offset within the file at which this file
00118 //               data begins.
00119 ////////////////////////////////////////////////////////////////////
00120 INLINE streampos SubfileInfo::
00121 get_start() const {
00122   return _start;
00123 }
00124 
00125 ////////////////////////////////////////////////////////////////////
00126 //     Function: SubfileInfo::get_size
00127 //       Access: Published
00128 //  Description: Returns the number of consecutive bytes, beginning at
00129 //               get_start(), that correspond to this file data.
00130 ////////////////////////////////////////////////////////////////////
00131 INLINE streamsize SubfileInfo::
00132 get_size() const {
00133   return _size;
00134 }
00135 
00136 INLINE ostream &
00137 operator << (ostream &out, const SubfileInfo &info) {
00138   info.output(out);
00139   return out;
00140 }
 All Classes Functions Variables Enumerations