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

Method process

source/globjects/source/IncludeProcessor.cpp:80–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80CompositeStringSource* IncludeProcessor::process(const AbstractStringSource* source)
81{
82 CompositeStringSource* compositeSource = new CompositeStringSource();
83
84 std::istringstream sourcestream(source->string());
85 std::stringstream destinationstream;
86
87 bool inMultiLineComment = false;
88
89 do
90 {
91 std::string line;
92
93 std::getline(sourcestream, line);
94
95 std::string trimmedLine = trim(line);
96
97 if (trimmedLine.size() > 0)
98 {
99 if (contains(trimmedLine, "/*"))
100 {
101 inMultiLineComment = true;
102 }
103
104 if (contains(trimmedLine, "*/"))
105 {
106 inMultiLineComment = false;
107 }
108
109 if (!inMultiLineComment)
110 {
111 if (trimmedLine[0] == '#')
112 {
113 if (contains(trimmedLine, "#extension"))
114 {
115 // #extension GL_ARB_shading_language_include : require
116 if (contains(trimmedLine, "GL_ARB_shading_language_include"))
117 {
118 destinationstream << "//" << trimmedLine << '\n';
119 }
120 else
121 {
122 destinationstream << line << '\n';
123 }
124 }
125 else if (contains(trimmedLine, "#include"))
126 {
127 parseInclude(trimmedLine, compositeSource, destinationstream);
128 }
129 else
130 {
131 // other macro
132 destinationstream << line << '\n';
133 }
134 }
135 else
136 {
137 // normal line

Callers 1

eFunction · 0.80

Calls 6

trimFunction · 0.85
containsFunction · 0.85
strMethod · 0.80
appendSourceMethod · 0.80
stringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected