Panda3D
Classes | Public Member Functions | Friends | List of all members
FindApproxPath Class Reference

This class is local to this package only; it doesn't get exported. More...

#include "findApproxPath.h"

Public Member Functions

bool add_component (std::string str_component)
 Adds a single component to the path sequence, defined by a string as might appear between slashes in the path string. More...
 
bool add_flags (const std::string &str_flags)
 Adds a sequence of control flags. More...
 
void add_match_exact_type (TypeHandle type, int flags)
 Adds a component that must match the type of a node exactly, with no derived types matching. More...
 
void add_match_inexact_type (TypeHandle type, int flags)
 Adds a component that must match the type of a node or be a base class of the node's type. More...
 
void add_match_many (int flags)
 Adds a component that will match a chain of zero or more consecutive nodes. More...
 
void add_match_name (const std::string &name, int flags)
 Adds a component that must match the name of a node exactly. More...
 
void add_match_name_glob (const std::string &glob, int flags)
 Adds a component that must match the name of a node using standard shell globbing rules, with wildcard characters accepted. More...
 
void add_match_one (int flags)
 Adds a component that will match any node (but not a chain of many nodes). More...
 
void add_match_pointer (PandaNode *pointer, int flags)
 Adds a component that must match a particular node exactly, by pointer. More...
 
void add_match_tag (const std::string &key, int flags)
 Adds a component that will match a node that has a tag with the indicated key, no matter what the value is. More...
 
void add_match_tag_value (const std::string &key, const std::string &value, int flags)
 Adds a component that will match a node that has a tag with the indicated key. More...
 
bool add_string (const std::string &str_path)
 Adds a sequence of components separated by slashes, followed optionally by a semicolon and a sequence of control flags, to the path sequence. More...
 
bool case_insensitive () const
 Returns true if the search is case-insensitive, false if it is case- sensitive. More...
 
int get_num_components () const
 Returns the number of components in the path. More...
 
bool is_component_match_many (int index) const
 Returns true if the nth component is of type match_many, which will require special handling. More...
 
bool matches_component (int index, PandaNode *node) const
 Returns true if the nth component of the path matches the indicated node, false otherwise. More...
 
bool matches_stashed (int index) const
 Returns true if the nth component of the path matches a stashed node only, false otherwise. More...
 
void output (std::ostream &out) const
 
void output_component (std::ostream &out, int index) const
 Formats the nth component of the path to the indicated output stream. More...
 
bool return_hidden () const
 Returns true if this path allows returning of hidden nodes, false otherwise. More...
 
bool return_stashed () const
 Returns true if this path allows returning of stashed nodes, false otherwise. More...
 

Friends

std::ostream & operator<< (std::ostream &, FindApproxPath::ComponentType)
 
std::ostream & operator<< (std::ostream &, const FindApproxPath::Component &)
 

Detailed Description

This class is local to this package only; it doesn't get exported.

It chops a string path, as supplied to find_up() or find_down(), and breaks it up into its component pieces.

Definition at line 31 of file findApproxPath.h.

Member Function Documentation

◆ add_component()

bool FindApproxPath::add_component ( std::string  str_component)

Adds a single component to the path sequence, defined by a string as might appear between slashes in the path string.

Returns true if successful, false if the string component was in some way invalid.

Definition at line 220 of file findApproxPath.cxx.

References add_match_exact_type(), add_match_inexact_type(), add_match_many(), add_match_name_glob(), add_match_one(), add_match_tag(), add_match_tag_value(), TypeRegistry::find_type(), and TypeRegistry::ptr().

Referenced by add_string().

◆ add_flags()

bool FindApproxPath::add_flags ( const std::string &  str_flags)

Adds a sequence of control flags.

This will be a sequence of letters preceded by either '+' or '-', with no intervening punctuation. Returns true if successful, false otherwise.

Definition at line 164 of file findApproxPath.cxx.

Referenced by add_string().

◆ add_match_exact_type()

void FindApproxPath::add_match_exact_type ( TypeHandle  type,
int  flags 
)

Adds a component that must match the type of a node exactly, with no derived types matching.

Definition at line 322 of file findApproxPath.cxx.

Referenced by add_component().

◆ add_match_inexact_type()

void FindApproxPath::add_match_inexact_type ( TypeHandle  type,
int  flags 
)

Adds a component that must match the type of a node or be a base class of the node's type.

Definition at line 335 of file findApproxPath.cxx.

Referenced by add_component().

◆ add_match_many()

void FindApproxPath::add_match_many ( int  flags)

Adds a component that will match a chain of zero or more consecutive nodes.

Definition at line 386 of file findApproxPath.cxx.

Referenced by add_component().

◆ add_match_name()

void FindApproxPath::add_match_name ( const std::string &  name,
int  flags 
)

Adds a component that must match the name of a node exactly.

Definition at line 288 of file findApproxPath.cxx.

Referenced by add_match_name_glob().

◆ add_match_name_glob()

void FindApproxPath::add_match_name_glob ( const std::string &  glob,
int  flags 
)

Adds a component that must match the name of a node using standard shell globbing rules, with wildcard characters accepted.

Definition at line 301 of file findApproxPath.cxx.

References add_match_name().

Referenced by add_component().

◆ add_match_one()

void FindApproxPath::add_match_one ( int  flags)

Adds a component that will match any node (but not a chain of many nodes).

Definition at line 375 of file findApproxPath.cxx.

Referenced by add_component().

◆ add_match_pointer()

void FindApproxPath::add_match_pointer ( PandaNode pointer,
int  flags 
)

Adds a component that must match a particular node exactly, by pointer.

Definition at line 397 of file findApproxPath.cxx.

◆ add_match_tag()

void FindApproxPath::add_match_tag ( const std::string &  key,
int  flags 
)

Adds a component that will match a node that has a tag with the indicated key, no matter what the value is.

Definition at line 348 of file findApproxPath.cxx.

Referenced by add_component().

◆ add_match_tag_value()

void FindApproxPath::add_match_tag_value ( const std::string &  key,
const std::string &  value,
int  flags 
)

Adds a component that will match a node that has a tag with the indicated key.

The value may be "*" to match any value, or a particular glob pattern to match only those nodes with the indicated value.

Definition at line 362 of file findApproxPath.cxx.

Referenced by add_component().

◆ add_string()

bool FindApproxPath::add_string ( const std::string &  str_path)

Adds a sequence of components separated by slashes, followed optionally by a semicolon and a sequence of control flags, to the path sequence.

Returns true if successful, false if the string contained an error.

Definition at line 117 of file findApproxPath.cxx.

References add_component(), and add_flags().

Referenced by NodePathCollection::find_all_matches().

◆ case_insensitive()

bool FindApproxPath::case_insensitive ( ) const
inline

Returns true if the search is case-insensitive, false if it is case- sensitive.

Definition at line 88 of file findApproxPath.I.

◆ get_num_components()

int FindApproxPath::get_num_components ( ) const
inline

Returns the number of components in the path.

Definition at line 28 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::is_solution().

◆ is_component_match_many()

bool FindApproxPath::is_component_match_many ( int  index) const
inline

Returns true if the nth component is of type match_many, which will require special handling.

Definition at line 37 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::consider_node().

◆ matches_component()

bool FindApproxPath::matches_component ( int  index,
PandaNode node 
) const
inline

Returns true if the nth component of the path matches the indicated node, false otherwise.

Definition at line 47 of file findApproxPath.I.

◆ matches_stashed()

bool FindApproxPath::matches_stashed ( int  index) const
inline

Returns true if the nth component of the path matches a stashed node only, false otherwise.

Definition at line 57 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::next_is_stashed().

◆ output_component()

void FindApproxPath::output_component ( std::ostream &  out,
int  index 
) const
inline

Formats the nth component of the path to the indicated output stream.

Definition at line 96 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::output().

◆ return_hidden()

bool FindApproxPath::return_hidden ( ) const
inline

Returns true if this path allows returning of hidden nodes, false otherwise.

Definition at line 70 of file findApproxPath.I.

◆ return_stashed()

bool FindApproxPath::return_stashed ( ) const
inline

Returns true if this path allows returning of stashed nodes, false otherwise.

Definition at line 79 of file findApproxPath.I.


The documentation for this class was generated from the following files: