Panda3D
findApproxPath.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 findApproxPath.I
10  * @author drose
11  * @date 2002-03-13
12  */
13 
14 /**
15  *
16  */
17 INLINE FindApproxPath::
18 FindApproxPath() {
19  _return_hidden = true;
20  _return_stashed = false;
21  _case_insensitive = false;
22 }
23 
24 /**
25  * Returns the number of components in the path.
26  */
27 INLINE int FindApproxPath::
29  return _path.size();
30 }
31 
32 /**
33  * Returns true if the nth component is of type match_many, which will require
34  * special handling.
35  */
36 INLINE bool FindApproxPath::
37 is_component_match_many(int index) const {
38  nassertr(index >= 0 && index < (int)_path.size(), false);
39  return (_path[index]._type == CT_match_many);
40 }
41 
42 /**
43  * Returns true if the nth component of the path matches the indicated node,
44  * false otherwise.
45  */
46 INLINE bool FindApproxPath::
47 matches_component(int index, PandaNode *node) const {
48  nassertr(index >= 0 && index < (int)_path.size(), false);
49  return (_path[index].matches(node));
50 }
51 
52 /**
53  * Returns true if the nth component of the path matches a stashed node only,
54  * false otherwise.
55  */
56 INLINE bool FindApproxPath::
57 matches_stashed(int index) const {
58  if (index >= 0 && index < (int)_path.size()) {
59  return ((_path[index]._flags & CF_stashed) != 0);
60  } else {
61  return false;
62  }
63 }
64 
65 /**
66  * Returns true if this path allows returning of hidden nodes, false
67  * otherwise.
68  */
69 INLINE bool FindApproxPath::
70 return_hidden() const {
71  return _return_hidden;
72 }
73 
74 /**
75  * Returns true if this path allows returning of stashed nodes, false
76  * otherwise.
77  */
78 INLINE bool FindApproxPath::
79 return_stashed() const {
80  return _return_stashed;
81 }
82 
83 /**
84  * Returns true if the search is case-insensitive, false if it is case-
85  * sensitive.
86  */
87 INLINE bool FindApproxPath::
89  return _case_insensitive;
90 }
91 
92 /**
93  * Formats the nth component of the path to the indicated output stream.
94  */
95 INLINE void FindApproxPath::
96 output_component(std::ostream &out, int index) const {
97  nassertv(index >= 0 && index < (int)_path.size());
98  out << _path[index];
99 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
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(std::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.