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

Method processInclude

source/globjects/source/IncludeProcessor.cpp:203–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void IncludeProcessor::processInclude(std::string & include, CompositeStringSource * compositeSource, std::stringstream & destinationstream)
204{
205 if (m_includes.count(include) > 0)
206 {
207 return;
208 }
209
210 m_includes.insert(include);
211 compositeSource->appendSource(new StaticStringSource(destinationstream.str()));
212
213 NamedString * namedString = nullptr;
214 if (startsWith(include, '/'))
215 {
216 namedString = NamedString::obtain(include);
217 }
218 else
219 {
220 for (const std::string & prefix : m_includePaths)
221 {
222 namedString = NamedString::obtain(expandPath(include, prefix));
223 if (namedString)
224 {
225 break;
226 }
227 }
228 }
229
230 if (namedString)
231 {
232 compositeSource->appendSource(processComposite(namedString->stringSource()));
233 }
234 else
235 {
236 warning() << "Did not find include " << include;
237 }
238
239 destinationstream.str("");
240}
241
242std::string IncludeProcessor::expandPath(const std::string& include, const std::string & includePath)
243{

Callers

nothing calls this directly

Calls 6

startsWithFunction · 0.85
warningFunction · 0.85
appendSourceMethod · 0.80
strMethod · 0.80
stringSourceMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected