MCPcopy Create free account
hub / github.com/ImageEngine/cortex / stringFindSubstitutions

Function stringFindSubstitutions

src/IECoreScene/ShaderNetwork.cpp:96–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96bool stringFindSubstitutions( const std::string &target, std::unordered_set< InternedString > &requestedAttributes )
97{
98 bool found = false;
99 boost::sregex_iterator matches( target.begin(), target.end(), attributeRegex(), boost::match_default );
100 for( boost::sregex_iterator i = matches; i != boost::sregex_iterator(); i++ )
101 {
102 found = true;
103
104 // The one group in the expression gives us the token we're looking for
105 requestedAttributes.insert( InternedString( (*i)[1] ) );
106 }
107
108 // Strings with escaped substitutions don't require attributes, but we do need call
109 // stringApplySubstitutions on them so that the escape symbols get removed
110 if( target.find( "\\<" ) != string::npos )
111 {
112 found = true;
113 }
114 if( target.find( "\\>" ) != string::npos )
115 {
116 found = true;
117 }
118 return found;
119}
120
121std::string stringApplySubstitutions( const std::string &target, const IECore::CompoundObject *attributes )
122{

Callers 1

updateMethod · 0.85

Calls 6

attributeRegexFunction · 0.85
InternedStringFunction · 0.85
insertMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected