VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtRegularExpressionVisitor Class Reference

Visitor that matches regular expressions against scene graph node data. More...

Inheritance diagram for makVrv::DtRegularExpressionVisitor:
Inheritance graph
[legend]

Classes

struct  ExpressionNodeData
 

Public Types

typedef std::vector
< ExpressionNodeData
NodeVector
 typedef a vector of osg ref node pointers for convenience. More...
 
typedef std::vector< boost::regex > RegexVector
 typdef a vector of regex for convenience More...
 

Public Member Functions

 DtRegularExpressionVisitor (bool isRegEx=true)
 Default constructor. More...
 
 DtRegularExpressionVisitor (const std::string &searchExpression, bool isRegEx=true)
 Constructor that accepts string argument. More...
 
 DtRegularExpressionVisitor (const std::vector< std::string > &searchExpressions, bool isRegEx=true)
 Constructor that accepts string vector argument. More...
 
virtual ~DtRegularExpressionVisitor ()
 DTOR. More...
 
void setSearchNames (bool flag)
 Set to true to include node names. More...
 
void setSearchDescriptions (bool flag)
 Set to true to include description. More...
 
void setSearchFilenames (bool flag)
 Set to true to include proxy node file names. More...
 
virtual void apply (osg::ProxyNode &searchNode)
 The 'apply' method for 'ProxyNode' type instances. More...
 
virtual void apply (osg::Node &searchNode)
 Compare the 'mySearchForRegularExpressions' data member against the node's name and description list (depending on the values of member control variables). More...
 
virtual void setExpressionToFind (const std::string &searchExpression)
 Set the mySearchForRegularExpressions to user-defined string. More...
 
virtual NodeVectornodeVector ()
 return a reference to the ProxyNodeVector of Groups we found. More...
 
virtual void setCutTraversal (bool b)
 Set value of cutTraversal. More...
 
virtual void reset ()
 Reset the visitor; Must be called after a traversal if the visitor will be used more than once. More...
 

Protected Member Functions

virtual bool regexSearchAndAdd (const std::string &target, osg::Node *node)
 Test the target against mySearchForRegularExpressions. More...
 
virtual bool searchNames (osg::Node *node)
 Search the node's name(s) for the target expressions. More...
 
virtual bool searchDescriptions (osg::Node *node)
 Search the node's description(s) for the target expressions. More...
 
virtual bool searchFilenames (osg::ProxyNode *proxyNode)
 Search the proxy node's filename(s) for the target expressions. More...
 

Protected Attributes

std::vector< std::string > mySearchForStrings
 
std::string myOriginalCacheFileString
 
std::string myOriginalFileString
 
RegexVector mySearchForRegularExpressions
 the names we are looking for More...
 
bool myExpressionIsRegEx
 
NodeVector myFoundNodeVector
 Vector of nodes with names that match the searchForName string. More...
 
bool cutTraversal
 Switch to make traversal stop after one node is matched. More...
 
bool mySearchNames
 
bool mySearchDescriptions
 
bool mySearchFilenames
 

Detailed Description

Visitor that matches regular expressions against scene graph node data.

Member Typedef Documentation

typedef a vector of osg ref node pointers for convenience.

This way if you use this visitor to store nodes for removal, as you remove them they aren't actually deleted until the visitor is. I've had weird problems when extracting nodes and just keeping osg::node* around where removing the child causes it to be deleted but it's really some other node's parent.

typedef std::vector<boost::regex> makVrv::DtRegularExpressionVisitor::RegexVector

typdef a vector of regex for convenience

Constructor & Destructor Documentation

makVrv::DtRegularExpressionVisitor::DtRegularExpressionVisitor ( bool  isRegEx = true)

Default constructor.

Initialize mySearchForRegularExpressions to "" and set the traversal mode to TRAVERSE_ALL_CHILDREN

makVrv::DtRegularExpressionVisitor::DtRegularExpressionVisitor ( const std::string &  searchExpression,
bool  isRegEx = true 
)

Constructor that accepts string argument.

Initializes mySearchForRegularExpressions to user string set the traversal mode to TRAVERSE_ALL_CHILDREN

makVrv::DtRegularExpressionVisitor::DtRegularExpressionVisitor ( const std::vector< std::string > &  searchExpressions,
bool  isRegEx = true 
)

Constructor that accepts string vector argument.

Initializes mySearchForRegularExpressions to user strings set the traversal mode to TRAVERSE_ALL_CHILDREN

virtual makVrv::DtRegularExpressionVisitor::~DtRegularExpressionVisitor ( )
virtual

DTOR.

Member Function Documentation

void makVrv::DtRegularExpressionVisitor::setSearchNames ( bool  flag)

Set to true to include node names.

void makVrv::DtRegularExpressionVisitor::setSearchDescriptions ( bool  flag)

Set to true to include description.

void makVrv::DtRegularExpressionVisitor::setSearchFilenames ( bool  flag)

Set to true to include proxy node file names.

virtual void makVrv::DtRegularExpressionVisitor::apply ( osg::ProxyNode &  searchNode)
virtual

The 'apply' method for 'ProxyNode' type instances.

Compare the 'mySearchForRegularExpressions' data member against the node's name, description, and filename list (depending on the values of member control variables). If the strings match, add this node to our list

virtual void makVrv::DtRegularExpressionVisitor::apply ( osg::Node &  searchNode)
virtual

Compare the 'mySearchForRegularExpressions' data member against the node's name and description list (depending on the values of member control variables).

virtual void makVrv::DtRegularExpressionVisitor::setExpressionToFind ( const std::string &  searchExpression)
virtual

Set the mySearchForRegularExpressions to user-defined string.

virtual NodeVector& makVrv::DtRegularExpressionVisitor::nodeVector ( )
virtual

return a reference to the ProxyNodeVector of Groups we found.

Nodes are returned in the order they are found.

virtual void makVrv::DtRegularExpressionVisitor::setCutTraversal ( bool  b)
virtual

Set value of cutTraversal.

virtual void makVrv::DtRegularExpressionVisitor::reset ( )
virtual

Reset the visitor; Must be called after a traversal if the visitor will be used more than once.

virtual bool makVrv::DtRegularExpressionVisitor::regexSearchAndAdd ( const std::string &  target,
osg::Node *  node 
)
protectedvirtual

Test the target against mySearchForRegularExpressions.

virtual bool makVrv::DtRegularExpressionVisitor::searchNames ( osg::Node *  node)
protectedvirtual

Search the node's name(s) for the target expressions.

virtual bool makVrv::DtRegularExpressionVisitor::searchDescriptions ( osg::Node *  node)
protectedvirtual

Search the node's description(s) for the target expressions.

virtual bool makVrv::DtRegularExpressionVisitor::searchFilenames ( osg::ProxyNode *  proxyNode)
protectedvirtual

Search the proxy node's filename(s) for the target expressions.

Member Data Documentation

std::vector<std::string> makVrv::DtRegularExpressionVisitor::mySearchForStrings
protected
std::string makVrv::DtRegularExpressionVisitor::myOriginalCacheFileString
protected
std::string makVrv::DtRegularExpressionVisitor::myOriginalFileString
protected
RegexVector makVrv::DtRegularExpressionVisitor::mySearchForRegularExpressions
protected

the names we are looking for

bool makVrv::DtRegularExpressionVisitor::myExpressionIsRegEx
protected
NodeVector makVrv::DtRegularExpressionVisitor::myFoundNodeVector
protected

Vector of nodes with names that match the searchForName string.

bool makVrv::DtRegularExpressionVisitor::cutTraversal
protected

Switch to make traversal stop after one node is matched.

bool makVrv::DtRegularExpressionVisitor::mySearchNames
protected
bool makVrv::DtRegularExpressionVisitor::mySearchDescriptions
protected
bool makVrv::DtRegularExpressionVisitor::mySearchFilenames
protected

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

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)