Panda3D
 All Classes Functions Variables Enumerations
virtualFileList.I
1 // Filename: virtualFileList.I
2 // Created by: drose (03Aug02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: VirtualFileList::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE VirtualFileList::
22 VirtualFileList() {
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: VirtualFileList::Destructor
27 // Access: Published
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 INLINE VirtualFileList::
31 ~VirtualFileList() {
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: VirtualFileList::add_file
36 // Access: Public
37 // Description: Adds a new file to the list.
38 ////////////////////////////////////////////////////////////////////
39 INLINE void VirtualFileList::
41  _files.push_back(file);
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: VirtualFileList::get_num_files
46 // Access: Published
47 // Description: Returns the number of files in the list.
48 ////////////////////////////////////////////////////////////////////
49 INLINE int VirtualFileList::
50 get_num_files() const {
51  return _files.size();
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: VirtualFileList::get_file
56 // Access: Published
57 // Description: Returns the nth file in the list.
58 ////////////////////////////////////////////////////////////////////
60 get_file(int n) const {
61  nassertr(n >= 0 && n < (int)_files.size(), NULL);
62  return _files[n];
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: VirtualFileList::operator []
67 // Access: Published
68 // Description: Returns the nth file in the list.
69 ////////////////////////////////////////////////////////////////////
71 operator [](int n) const {
72  nassertr(n >= 0 && n < (int)_files.size(), NULL);
73  return _files[n];
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function: VirtualFileList::size
78 // Access: Published
79 // Description: Returns the number of files in the list.
80 ////////////////////////////////////////////////////////////////////
81 INLINE int VirtualFileList::
82 size() const {
83  return _files.size();
84 }
85 
86 ////////////////////////////////////////////////////////////////////
87 // Function: VirtualFileList::operator +=
88 // Access: Published
89 // Description: Appends the other list onto the end of this one.
90 ////////////////////////////////////////////////////////////////////
91 INLINE void VirtualFileList::
93  _files.insert(_files.end(), other._files.begin(), other._files.end());
94 }
95 
96 ////////////////////////////////////////////////////////////////////
97 // Function: VirtualFileList::operator +
98 // Access: Published
99 // Description: Returns a VirtualFileList representing the
100 // concatenation of the two lists.
101 ////////////////////////////////////////////////////////////////////
103 operator + (const VirtualFileList &other) const {
104  VirtualFileList a(*this);
105  a += other;
106  return a;
107 }
VirtualFile * get_file(int n) const
Returns the nth file in the list.
VirtualFile * operator[](int n) const
Returns the nth file in the list.
int get_num_files() const
Returns the number of files in the list.
void operator+=(const VirtualFileList &other)
Appends the other list onto the end of this one.
The abstract base class for a file or directory within the VirtualFileSystem.
Definition: virtualFile.h:37
VirtualFileList operator+(const VirtualFileList &other) const
Returns a VirtualFileList representing the concatenation of the two lists.
A list of VirtualFiles, as returned by VirtualFile::scan_directory().
int size() const
Returns the number of files in the list.
void add_file(VirtualFile *file)
Adds a new file to the list.