MCPcopy Create free account
hub / github.com/cginternals/globjects / parseInclude

Method parseInclude

source/globjects/source/IncludeProcessor.cpp:163–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163void IncludeProcessor::parseInclude(std::string & trimmedLine, CompositeStringSource * compositeSource, std::stringstream & destinationstream)
164{
165 size_t leftBracketPosition = trimmedLine.find_first_of('<');
166 size_t rightBracketPosition = trimmedLine.find_last_of('>');
167 size_t leftQuotePosition = trimmedLine.find_first_of('"');
168 size_t rightQuotePosition = trimmedLine.find_last_of('"');
169
170 size_t leftDelimiter = std::string::npos;
171 size_t rightDelimiter = std::string::npos;
172
173 if (leftBracketPosition != std::string::npos && rightBracketPosition != std::string::npos)
174 {
175 leftDelimiter = leftBracketPosition;
176 rightDelimiter = rightBracketPosition;
177 }
178 else if (leftQuotePosition != std::string::npos && rightQuotePosition != std::string::npos && leftQuotePosition < rightQuotePosition)
179 {
180 leftDelimiter = leftQuotePosition;
181 rightDelimiter = rightQuotePosition;
182 }
183
184 if (leftDelimiter != std::string::npos && rightDelimiter != std::string::npos)
185 {
186 std::string include = trimmedLine.substr(leftDelimiter+1, rightDelimiter - leftDelimiter - 1);
187
188 if (include.size() != 0 && !endsWith(include, '/'))
189 {
190 processInclude(include, compositeSource, destinationstream);
191 }
192 else
193 {
194 warning() << "Malformed #include " << include;
195 }
196 }
197 else
198 {
199 warning() << "Malformed #include " << trimmedLine;
200 }
201}
202
203void IncludeProcessor::processInclude(std::string & include, CompositeStringSource * compositeSource, std::stringstream & destinationstream)
204{

Callers

nothing calls this directly

Calls 3

endsWithFunction · 0.85
warningFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected