MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / parseScript

Method parseScript

Components/Overlay/src/OgreOverlayManager.cpp:209–290  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

207 }
208 //---------------------------------------------------------------------
209 void OverlayManager::parseScript( DataStreamPtr &stream, const String &groupName )
210 {
211 // check if we've seen this script before (can happen if included
212 // multiple times)
213 if( !stream->getName().empty() &&
214 mLoadedScripts.find( stream->getName() ) != mLoadedScripts.end() )
215 {
216 LogManager::getSingleton().logMessage( "Skipping loading overlay include: '" +
217 stream->getName() + " as it is already loaded." );
218 return;
219 }
220 String line;
221 Overlay *pOverlay = 0;
222
223 while( !stream->eof() )
224 {
225 bool isATemplate = false;
226 bool skipLine = false;
227 line = stream->getLine();
228 // Ignore comments & blanks
229 if( !( line.length() == 0 || line.substr( 0, 2 ) == "//" ) )
230 {
231 if( line.substr( 0, 8 ) == "#include" )
232 {
233 vector<String>::type params = StringUtil::split( line, "\t\n ()<>" );
234 DataStreamPtr includeStream =
235 ResourceGroupManager::getSingleton().openResource( params[1], groupName );
236 parseScript( includeStream, groupName );
237 continue;
238 }
239 if( !pOverlay )
240 {
241 // No current overlay
242
243 // check to see if there is a template
244 if( line.substr( 0, 8 ) == "template" )
245 {
246 isATemplate = true;
247 }
248 else
249 {
250 // So first valid data should be overlay name
251 if( StringUtil::startsWith( line, "overlay " ) )
252 {
253 // chop off the 'particle_system ' needed by new compilers
254 line = line.substr( 8 );
255 }
256 pOverlay = create( line );
257 pOverlay->_notifyOrigin( stream->getName() );
258 // Skip to and over next {
259 skipToNextOpenBrace( stream );
260 skipLine = true;
261 }
262 }
263 if( ( pOverlay && !skipLine ) || isATemplate )
264 {
265 // Already in overlay
266 vector<String>::type params = StringUtil::split( line, "\t\n ()" );

Callers

nothing calls this directly

Calls 13

parseScriptFunction · 0.85
startsWithFunction · 0.85
getLineMethod · 0.80
openResourceMethod · 0.80
emptyMethod · 0.45
getNameMethod · 0.45
findMethod · 0.45
endMethod · 0.45
logMessageMethod · 0.45
eofMethod · 0.45
lengthMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected