Panda3D
virtualFileList.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 virtualFileList.I
10  * @author drose
11  * @date 2002-08-03
12  */
13 
14 /**
15  *
16  */
17 INLINE VirtualFileList::
18 VirtualFileList() {
19 }
20 
21 /**
22  *
23  */
24 INLINE VirtualFileList::
25 ~VirtualFileList() {
26 }
27 
28 /**
29  * Adds a new file to the list.
30  */
31 INLINE void VirtualFileList::
33  _files.push_back(file);
34 }
35 
36 /**
37  * Returns the number of files in the list.
38  */
39 INLINE size_t VirtualFileList::
40 get_num_files() const {
41  return _files.size();
42 }
43 
44 /**
45  * Returns the nth file in the list.
46  */
48 get_file(size_t n) const {
49  nassertr(n < _files.size(), nullptr);
50  return _files[n];
51 }
52 
53 /**
54  * Returns the nth file in the list.
55  */
57 operator [](size_t n) const {
58  nassertr(n < _files.size(), nullptr);
59  return _files[n];
60 }
61 
62 /**
63  * Returns the number of files in the list.
64  */
65 INLINE size_t VirtualFileList::
66 size() const {
67  return _files.size();
68 }
69 
70 /**
71  * Appends the other list onto the end of this one.
72  */
73 INLINE void VirtualFileList::
75  _files.insert(_files.end(), other._files.begin(), other._files.end());
76 }
77 
78 /**
79  * Returns a VirtualFileList representing the concatenation of the two lists.
80  */
82 operator + (const VirtualFileList &other) const {
83  VirtualFileList a(*this);
84  a += other;
85  return a;
86 }
size_t size() const
Returns the number of files in the list.
VirtualFile * operator [](size_t n) const
Returns the nth file in the list.
void operator+=(const VirtualFileList &other)
Appends the other list onto the end of this one.
VirtualFileList operator+(const VirtualFileList &other) const
Returns a VirtualFileList representing the concatenation of the two lists.
The abstract base class for a file or directory within the VirtualFileSystem.
Definition: virtualFile.h:35
A list of VirtualFiles, as returned by VirtualFile::scan_directory().
get_file
Returns the nth file in the list.
void add_file(VirtualFile *file)
Adds a new file to the list.