MCPcopy Create free account
hub / github.com/audacity/audacity / Dispatch

Function Dispatch

libraries/lib-wx-init/Journal.cpp:291–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291bool Dispatch()
292{
293 if ( GetError() )
294 // Don't repeatedly indicate error
295 // Do nothing
296 return false;
297
298 if ( !IsReplaying() )
299 return false;
300
301 // This will throw if no lines remain. A proper journal should exit the
302 // program before that happens.
303 auto words = GetTokens();
304
305 // Lookup dispatch function by the first field of the line
306 auto &table = GetDictionary();
307 auto &name = words[0];
308 auto iter = table.find( name );
309 if (iter == table.end())
310 throw SyncException(
311 wxString::Format("unknown command: %s", name.ToStdString().c_str()));
312
313 // Pass all the fields including the command name to the function
314 if (!iter->second(words))
315 throw SyncException(wxString::Format(
316 "command '%s' has failed", wxJoin(words, ',').ToStdString().c_str()));
317
318 return true;
319}
320
321void Sync( const wxString &string )
322{

Callers 3

NewFieldRegisteredMethod · 0.50
OnIdleMethod · 0.50
OnExitMethod · 0.50

Calls 6

GetErrorFunction · 0.85
IsReplayingFunction · 0.85
GetTokensFunction · 0.85
findMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected