VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtRegularExpressionVisitor.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2007 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #ifndef DtRegularExpressionVisitor_H_
11 #define DtRegularExpressionVisitor_H_
12 
13 #include <vrvOsg/vrvOsg.h>
14 #include <osg/NodeVisitor>
15 #include <osg/Group>
16 #include <osg/Switch>
17 #include <boost/regex.hpp>
18 
19 namespace makVrv
20 {
24  class DT_DLL_VRVOSG DtRegularExpressionVisitor : public osg::NodeVisitor
25  {
26 
27  public:
28 
30  {
32  osg::Matrix localToWorldVector;
33  std::string match; // what matched the regular expression
34  };
35 
42  typedef std::vector< ExpressionNodeData > NodeVector;
43 
45  typedef std::vector<boost::regex> RegexVector;
46 
49  DtRegularExpressionVisitor(bool isRegEx = true);
50 
53  DtRegularExpressionVisitor(const std::string& searchExpression, bool isRegEx = true);
54 
57  DtRegularExpressionVisitor(const std::vector<std::string>& searchExpressions,bool isRegEx = true);
58 
60  virtual ~DtRegularExpressionVisitor();
61 
63  void setSearchNames(bool flag);
64 
66  void setSearchDescriptions(bool flag);
67 
69  void setSearchFilenames(bool flag);
70 
75  virtual void apply(osg::ProxyNode& searchNode);
76 
79  virtual void apply(osg::Node& searchNode);
80 
82  virtual void setExpressionToFind(const std::string &searchExpression);
83 
86  virtual NodeVector& nodeVector();
87 
89  virtual void setCutTraversal(bool b);
90 
93  virtual void reset();
94 
95  protected:
96 
98  virtual bool regexSearchAndAdd(const std::string& target, osg::Node* node);
99 
101  virtual bool searchNames(osg::Node* node);
102 
104  virtual bool searchDescriptions(osg::Node* node);
105 
107  virtual bool searchFilenames(osg::ProxyNode* proxyNode);
108 
109  protected:
110 
111  std::vector<std::string> mySearchForStrings;
112 
114  std::string myOriginalFileString;
115 
118 
120 
123 
126 
130  };
131 
132 }
133 
134 #endif
135 
std::vector< boost::regex > RegexVector
typdef a vector of regex for convenience
Definition: DtRegularExpressionVisitor.h:45
NodeVector myFoundNodeVector
Vector of nodes with names that match the searchForName string.
Definition: DtRegularExpressionVisitor.h:122
osg::ref_ptr< osg::Node > node
Definition: DtRegularExpressionVisitor.h:31
bool myExpressionIsRegEx
Definition: DtRegularExpressionVisitor.h:119
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
std::string myOriginalFileString
Definition: DtRegularExpressionVisitor.h:114
bool mySearchNames
Definition: DtRegularExpressionVisitor.h:127
std::string match
Definition: DtRegularExpressionVisitor.h:33
bool cutTraversal
Switch to make traversal stop after one node is matched.
Definition: DtRegularExpressionVisitor.h:125
std::vector< std::string > mySearchForStrings
Definition: DtRegularExpressionVisitor.h:111
Visitor that matches regular expressions against scene graph node data.
Definition: DtRegularExpressionVisitor.h:24
RegexVector mySearchForRegularExpressions
the names we are looking for
Definition: DtRegularExpressionVisitor.h:117
std::string myOriginalCacheFileString
Definition: DtRegularExpressionVisitor.h:113
osg::Matrix localToWorldVector
Definition: DtRegularExpressionVisitor.h:32
Contains DLL export macros.
Definition: DtRegularExpressionVisitor.h:29
bool mySearchFilenames
Definition: DtRegularExpressionVisitor.h:129
std::vector< ExpressionNodeData > NodeVector
typedef a vector of osg ref node pointers for convenience. This way if you use this visitor to store ...
Definition: DtRegularExpressionVisitor.h:42
bool mySearchDescriptions
Definition: DtRegularExpressionVisitor.h:128

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)