00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Mike Heck (Apr 2000) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_SEARCHPATH_ACTION_ 00026 #define _SO_SEARCHPATH_ACTION_ 00027 00028 // Note: Not necessary to include SoSubAction.h because it is already 00029 // included by SoSearchAction.h 00030 #include <Inventor/actions/SoSearchAction.h> 00031 00117 class SoSearchPathAction : public SoSearchAction { 00118 00119 SO_ACTION_HEADER(SoSearchPathAction); 00120 00121 public: 00122 00127 SoSearchPathAction(); 00128 00132 virtual ~SoSearchPathAction(); 00133 00137 void reset(); 00138 00142 void setSearchString( const char *searchString ); 00146 const SbString& getSearchString() const 00147 { return m_strSearchString; }; 00148 00152 void setSeparatorChar( const char sepChar ) 00153 { m_cSepChar = sepChar; } 00157 char getSeparatorChar() const 00158 { return m_cSepChar; } 00159 00163 void setDerivedIsOK( const SbBool derivedIsOK ) 00164 { m_bDerivedIsOK = derivedIsOK; }; 00168 SbBool getDerivedIsOK() const 00169 { return m_bDerivedIsOK; }; 00170 00177 int getNumItemsFound() const 00178 { return m_nItemNum; }; 00179 00180 private: 00181 // Notifies action that the current node satisfies the current search item. 00182 virtual void setFound(); 00183 00184 private: 00185 static void initClass(); 00186 static void exitClass(); 00187 00188 // Static and instance-specific callbacks called during traversal 00189 static void searchStatic(SoAction *action, SoNode *node); 00190 virtual void search (SoNode *node); 00191 00192 private: 00193 // Initiates action on graph 00194 virtual void beginTraversal(SoNode *node); 00195 00196 // Classify search item and call appropriate SearchAction method 00197 SbBool setSearchParameters( const char* item ); 00198 00199 // Result of setupNextSearchItem 00200 enum ItemSetupResult { 00201 NO_MORE_ITEMS, 00202 VALID_ITEM, 00203 INVALID_ITEM 00204 }; 00205 00206 // Extract next search item from search string and get ready to go. 00207 ItemSetupResult setupNextSearchItem(); 00208 00209 SbString m_strSearchString; // Search string 00210 char *m_pStartChar; // Points to next search item 00211 char m_cSepChar; // Char that separates search items 00212 SbBool m_bDerivedIsOK; // Will type search match derived types 00213 int m_nItemNum; // Which search item is active (for error reporting) 00214 00215 private: 00216 00217 }; 00218 00219 #endif /* _SO_SEARCHPATH_ACTION_ */ 00220 00221