LMMS
Loading...
Searching...
No Matches
rtosc::savefile_dispatcher_t Class Reference

#include <ports.h>

Protected Types

enum  proceed { abort = -2 , discard = -1 }
enum  dependency_t { no_dependencies , has_dependencies , not_specified }

Protected Member Functions

void operator() (const char *msg)
 call this to dispatch a message

Static Protected Member Functions

static int default_response (size_t nargs, bool first_round, dependency_t dependency)

Protected Attributes

rtosc_version rtosc_filever
 rtosc versinon savefile was written with
rtosc_version rtosc_curver
 rtosc version of this library
rtosc_version app_filever
 app version savefile was written with
rtosc_version app_curver
 current app version

Private Member Functions

virtual int on_dispatch (size_t portname_max, char *portname, size_t maxargs, size_t nargs, rtosc_arg_val_t *args, bool round2, dependency_t dependency)

Private Attributes

const Portsports
voidruntime
char loc [1024]

Friends

int dispatch_printed_messages (const char *messages, const Ports &ports, void *runtime, savefile_dispatcher_t *dispatcher=NULL)
int load_from_file (const char *file_content, const Ports &ports, void *runtime, const char *appname, rtosc_version appver, savefile_dispatcher_t *dispatcher=NULL)

Detailed Description

Class to modify messages loaded from savefiles. Objects of this class shall be passed to savefile loading routines. You can inherit to change the behaviour, e.g. to modify or discard such messages.

Member Enumeration Documentation

◆ dependency_t

Enumerator
no_dependencies 
has_dependencies 

default values don't depend on others

not_specified 

default values do depend on others

it's not know which of the other enum values fit

◆ proceed

Enumerator
abort 

the message shall lead to abort the savefile loading

discard 

the message shall not be dispatched

Member Function Documentation

◆ default_response()

int savefile_dispatcher_t::default_response ( size_t nargs,
bool first_round,
savefile_dispatcher_t::dependency_t dependency )
staticprotected

◆ on_dispatch()

int savefile_dispatcher_t::on_dispatch ( size_t portname_max,
char * portname,
size_t maxargs,
size_t nargs,
rtosc_arg_val_t * args,
bool round2,
dependency_t dependency )
privatevirtual

callback for when a message shall be dispatched implement this if you need to change a message

◆ operator()()

void rtosc::savefile_dispatcher_t::operator() ( const char * msg)
protected

call this to dispatch a message

◆ dispatch_printed_messages

int dispatch_printed_messages ( const char * messages,
const Ports & ports,
void * runtime,
savefile_dispatcher_t * dispatcher = NULL )
friend

Scan OSC messages from human readable format and dispatch them.

Parameters
messagesThe OSC messages, whitespace-separated
portsThe static ports structure
runtimeThe runtime object
dispatcherObject to modify messages prior to dispatching, or NULL. You can overwrite its virtual functions, and you should specify any of the version structs if needed. All other members shall not be initialized.
Returns
The number of messages read, or, if there was a read error, the number of bytes read until the read error occured minus one

◆ load_from_file

int load_from_file ( const char * file_content,
const Ports & ports,
void * runtime,
const char * appname,
rtosc_version appver,
savefile_dispatcher_t * dispatcher = NULL )
friend

Read save file and dispatch contained parameters.

Parameters
file_contentThe file as a C string
portsThe static ports structure
runtimeThe runtime object
appnameName of the application calling this function; must match the file's application name
appverVersion of the application calling this function
dispatcherModifier for the messages; NULL if no modifiers are needed
Returns
The number of messages read, or, if there was a read error, the negated number of bytes read until the read error occured minus one

Member Data Documentation

◆ app_curver

rtosc_version rtosc::savefile_dispatcher_t::app_curver
protected

current app version

◆ app_filever

rtosc_version rtosc::savefile_dispatcher_t::app_filever
protected

app version savefile was written with

◆ loc

char rtosc::savefile_dispatcher_t::loc[1024]
private

◆ ports

const Ports* rtosc::savefile_dispatcher_t::ports
private

◆ rtosc_curver

rtosc_version rtosc::savefile_dispatcher_t::rtosc_curver
protected

rtosc version of this library

◆ rtosc_filever

rtosc_version rtosc::savefile_dispatcher_t::rtosc_filever
protected

rtosc versinon savefile was written with

◆ runtime

void* rtosc::savefile_dispatcher_t::runtime
private

The documentation for this class was generated from the following files: