MCPcopy Create free account
hub / github.com/cinder/Cinder / findIncludeStatement

Function findIncludeStatement

src/cinder/gl/ShaderPreprocessor.cpp:98–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98bool findIncludeStatement( const std::string &line, std::string *out )
99{
100 const int INCLUDE_KEYWORD_LEN = 7;
101 const char *resultStart = nullptr;
102 const char *c = line.c_str();
103 consumeWhiteSpace( &c );
104 // leading '#'
105 if( ( isTerminated( c ) ) || ( *c != '#' ) )
106 return false;
107 ++c;
108 consumeWhiteSpace( &c );
109 if( isTerminated( c ) )
110 return false;
111 // include keyword
112 if( strncmp( c, "include", INCLUDE_KEYWORD_LEN ) )
113 return false;
114 c += INCLUDE_KEYWORD_LEN;
115 consumeWhiteSpace( &c );
116 // leading quote or angle bracket
117 if( ( isTerminated( c ) ) || ( *c != '\"' && *c != '<' ) )
118 return false;
119 ++c;
120 resultStart = c;
121 while( ( ! isTerminated( c ) ) && *c != '\"' && *c != '>' )
122 ++c;
123 if( isTerminated( c ) ) // we hit the terminus before the closing symbol
124 return false;
125 if( out )
126 *out = std::string( resultStart, c );
127 return true;
128}
129
130bool findVersionStatement( const char *lineStart, int *versionNumberOut )
131{

Callers 1

readStreamMethod · 0.85

Calls 4

consumeWhiteSpaceFunction · 0.85
isTerminatedFunction · 0.85
stringFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected