Panda3D
Loading...
Searching...
No Matches
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.
 
bool add_flags (const std::string &str_flags)
 Adds a sequence of control flags.
 
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.
 
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.
 
void add_match_many (int flags)
 Adds a component that will match a chain of zero or more consecutive nodes.
 
void add_match_name (const std::string &name, int flags)
 Adds a component that must match the name of a node exactly.
 
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.
 
void add_match_one (int flags)
 Adds a component that will match any node (but not a chain of many nodes).
 
void add_match_pointer (PandaNode *pointer, int flags)
 Adds a component that must match a particular node exactly, by pointer.
 
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.
 
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.
 
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.
 
bool case_insensitive () const
 Returns true if the search is case-insensitive, false if it is case- sensitive.
 
int get_num_components () const
 Returns the number of components in the path.
 
bool is_component_match_many (int index) const
 Returns true if the nth component is of type match_many, which will require special handling.
 
bool matches_component (int index, PandaNode *node) const
 Returns true if the nth component of the path matches the indicated node, false otherwise.
 
bool matches_stashed (int index) const
 Returns true if the nth component of the path matches a stashed node only, false otherwise.
 
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.
 
bool return_hidden () const
 Returns true if this path allows returning of hidden nodes, false otherwise.
 
bool return_stashed () const
 Returns true if this path allows returning of stashed nodes, false otherwise.
 

Friends

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

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.

Constructor & Destructor Documentation

◆ FindApproxPath()

FindApproxPath::FindApproxPath ( )
inline

Definition at line 17 of file findApproxPath.I.

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 219 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 163 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 321 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 334 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 385 of file findApproxPath.cxx.

Referenced by add_component(), NodePath::find_all_paths_to(), and NodePath::find_path_to().

◆ 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 287 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 300 of file findApproxPath.cxx.

References add_match_name(), GlobPattern::has_glob_characters(), GlobPattern::set_case_sensitive, and GlobPattern::set_pattern.

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 374 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 396 of file findApproxPath.cxx.

Referenced by NodePath::find_all_paths_to(), and NodePath::find_path_to().

◆ 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 347 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 361 of file findApproxPath.cxx.

References GlobPattern::set_pattern.

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 116 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 87 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 27 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::consider_next_step(), and 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 36 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::consider_next_step(), and 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 46 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::consider_next_step().

◆ 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 56 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::next_is_stashed().

◆ output()

void FindApproxPath::output ( std::ostream & out) const

Definition at line 408 of file findApproxPath.cxx.

◆ 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 95 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 69 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::consider_next_step().

◆ return_stashed()

bool FindApproxPath::return_stashed ( ) const
inline

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

Definition at line 78 of file findApproxPath.I.

Referenced by FindApproxLevelEntry::consider_node().

Friends And Related Symbol Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & out,
const FindApproxPath::Component & component )
friend

Definition at line 110 of file findApproxPath.h.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & ,
FindApproxPath::ComponentType  )
friend

Definition at line 423 of file findApproxPath.cxx.


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