Panda3D
findApproxPath.I
1 // Filename: findApproxPath.I
2 // Created by: drose (13Mar02)
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: FindApproxPath::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE FindApproxPath::
22 FindApproxPath() {
23  _return_hidden = true;
24  _return_stashed = false;
25  _case_insensitive = false;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: FindApproxPath::get_num_components
30 // Access: Public
31 // Description: Returns the number of components in the path.
32 ////////////////////////////////////////////////////////////////////
33 INLINE int FindApproxPath::
35  return _path.size();
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: FindApproxPath::is_component_match_many
40 // Access: Public
41 // Description: Returns true if the nth component is of type
42 // match_many, which will require special handling.
43 ////////////////////////////////////////////////////////////////////
44 INLINE bool FindApproxPath::
45 is_component_match_many(int index) const {
46  nassertr(index >= 0 && index < (int)_path.size(), false);
47  return (_path[index]._type == CT_match_many);
48 }
49 
50 ////////////////////////////////////////////////////////////////////
51 // Function: FindApproxPath::matches_component
52 // Access: Public
53 // Description: Returns true if the nth component of the path matches
54 // the indicated node, false otherwise.
55 ////////////////////////////////////////////////////////////////////
56 INLINE bool FindApproxPath::
57 matches_component(int index, PandaNode *node) const {
58  nassertr(index >= 0 && index < (int)_path.size(), false);
59  return (_path[index].matches(node));
60 }
61 
62 ////////////////////////////////////////////////////////////////////
63 // Function: FindApproxPath::matches_stashed
64 // Access: Public
65 // Description: Returns true if the nth component of the path matches
66 // a stashed node only, false otherwise.
67 ////////////////////////////////////////////////////////////////////
68 INLINE bool FindApproxPath::
69 matches_stashed(int index) const {
70  if (index >= 0 && index < (int)_path.size()) {
71  return ((_path[index]._flags & CF_stashed) != 0);
72  } else {
73  return false;
74  }
75 }
76 
77 ////////////////////////////////////////////////////////////////////
78 // Function: FindApproxPath::return_hidden
79 // Access: Public
80 // Description: Returns true if this path allows returning of hidden
81 // nodes, false otherwise.
82 ////////////////////////////////////////////////////////////////////
83 INLINE bool FindApproxPath::
84 return_hidden() const {
85  return _return_hidden;
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: FindApproxPath::return_stashed
90 // Access: Public
91 // Description: Returns true if this path allows returning of stashed
92 // nodes, false otherwise.
93 ////////////////////////////////////////////////////////////////////
94 INLINE bool FindApproxPath::
95 return_stashed() const {
96  return _return_stashed;
97 }
98 
99 ////////////////////////////////////////////////////////////////////
100 // Function: FindApproxPath::case_insensitive
101 // Access: Public
102 // Description: Returns true if the search is case-insensitive, false
103 // if it is case-sensitive.
104 ////////////////////////////////////////////////////////////////////
105 INLINE bool FindApproxPath::
107  return _case_insensitive;
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: FindApproxPath::output_component
112 // Access: Public
113 // Description: Formats the nth component of the path to the
114 // indicated output stream.
115 ////////////////////////////////////////////////////////////////////
116 INLINE void FindApproxPath::
117 output_component(ostream &out, int index) const {
118  nassertv(index >= 0 && index < (int)_path.size());
119  out << _path[index];
120 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
bool case_insensitive() const
Returns true if the search is case-insensitive, false if it is case-sensitive.
bool matches_stashed(int index) const
Returns true if the nth component of the path matches a stashed node only, false otherwise.
bool return_stashed() const
Returns true if this path allows returning of stashed nodes, false otherwise.
bool is_component_match_many(int index) const
Returns true if the nth component is of type match_many, which will require special handling...
void output_component(ostream &out, int index) const
Formats the nth component of the path to the indicated output stream.
int get_num_components() const
Returns the number of components in the path.
bool return_hidden() const
Returns true if this path allows returning of hidden nodes, false otherwise.
bool matches_component(int index, PandaNode *node) const
Returns true if the nth component of the path matches the indicated node, false otherwise.