From: lilo_booter Date: Fri, 14 Jan 2005 13:15:17 +0000 (+0000) Subject: Const string usage in properties X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=b2acc89d28aa0be283f242a137a3104448dfdd2e;p=melted Const string usage in properties git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@611 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/mlt++/src/MltProperties.cpp b/mlt++/src/MltProperties.cpp index 868b77a..e286f35 100644 --- a/mlt++/src/MltProperties.cpp +++ b/mlt++/src/MltProperties.cpp @@ -45,7 +45,7 @@ Properties::Properties( mlt_properties properties ) : inc_ref( ); } -Properties::Properties( char *file ) : +Properties::Properties( const char *file ) : instance( NULL ) { instance = mlt_properties_load( file ); @@ -101,52 +101,52 @@ int Properties::count( ) return mlt_properties_count( get_properties( ) ); } -char *Properties::get( char *name ) +char *Properties::get( const char *name ) { return mlt_properties_get( get_properties( ), name ); } -int Properties::get_int( char *name ) +int Properties::get_int( const char *name ) { return mlt_properties_get_int( get_properties( ), name ); } -double Properties::get_double( char *name ) +double Properties::get_double( const char *name ) { return mlt_properties_get_double( get_properties( ), name ); } -void *Properties::get_data( char *name, int &size ) +void *Properties::get_data( const char *name, int &size ) { return mlt_properties_get_data( get_properties( ), name, &size ); } -int Properties::set( char *name, char *value ) +int Properties::set( const char *name, const char *value ) { return mlt_properties_set( get_properties( ), name, value ); } -int Properties::set( char *name, int value ) +int Properties::set( const char *name, int value ) { return mlt_properties_set_int( get_properties( ), name, value ); } -int Properties::set( char *name, double value ) +int Properties::set( const char *name, double value ) { return mlt_properties_set_double( get_properties( ), name, value ); } -int Properties::set( char *name, void *value, int size, mlt_destructor destructor, mlt_serialiser serialiser ) +int Properties::set( const char *name, void *value, int size, mlt_destructor destructor, mlt_serialiser serialiser ) { return mlt_properties_set_data( get_properties( ), name, value, size, destructor, serialiser ); } -int Properties::pass_values( Properties &that, char *prefix ) +int Properties::pass_values( Properties &that, const char *prefix ) { return mlt_properties_pass( get_properties( ), that.get_properties( ), prefix ); } -int Properties::parse( char *namevalue ) +int Properties::parse( const char *namevalue ) { return mlt_properties_parse( get_properties( ), namevalue ); } @@ -176,7 +176,7 @@ int Properties::inherit( Properties &that ) return mlt_properties_inherit( get_properties( ), that.get_properties( ) ); } -int Properties::rename( char *source, char *dest ) +int Properties::rename( const char *source, const char *dest ) { return mlt_properties_rename( get_properties( ), source, dest ); } @@ -186,12 +186,20 @@ void Properties::dump( FILE *output ) mlt_properties_dump( get_properties( ), output ); } -void Properties::debug( char *title, FILE *output ) +void Properties::debug( const char *title, FILE *output ) { mlt_properties_debug( get_properties( ), title, output ); } -int Properties::save( char *file ) +void Properties::load( const char *file ) +{ + mlt_properties properties = mlt_properties_load( file ); + if ( properties != NULL ) + mlt_properties_pass( get_properties( ), properties, "" ); + mlt_properties_close( properties ); +} + +int Properties::save( const char *file ) { int error = 0; FILE *f = fopen( file, "w" ); diff --git a/mlt++/src/MltProperties.h b/mlt++/src/MltProperties.h index c8bb199..91570ae 100644 --- a/mlt++/src/MltProperties.h +++ b/mlt++/src/MltProperties.h @@ -42,7 +42,7 @@ namespace Mlt Properties( bool dummy ); Properties( Properties &properties ); Properties( mlt_properties properties ); - Properties( char *file ); + Properties( const char *file ); virtual ~Properties( ); int inc_ref( ); int dec_ref( ); @@ -52,25 +52,26 @@ namespace Mlt void fire_event( const char *event ); bool is_valid( ); int count( ); - char *get( char *name ); - int get_int( char *name ); - double get_double( char *name ); - void *get_data( char *name, int &size ); - int set( char *name, char *value ); - int set( char *name, int value ); - int set( char *name, double value ); - int set( char *name, void *value, int size, mlt_destructor destroy = NULL, mlt_serialiser serial = NULL ); - int pass_values( Properties &that, char *prefix ); - int parse( char *namevalue ); + char *get( const char *name ); + int get_int( const char *name ); + double get_double( const char *name ); + void *get_data( const char *name, int &size ); + int set( const char *name, const char *value ); + int set( const char *name, int value ); + int set( const char *name, double value ); + int set( const char *name, void *value, int size, mlt_destructor destroy = NULL, mlt_serialiser serial = NULL ); + int pass_values( Properties &that, const char *prefix ); + int parse( const char *namevalue ); char *get_name( int index ); char *get( int index ); void *get_data( int index, int &size ); void mirror( Properties &that ); int inherit( Properties &that ); - int rename( char *source, char *dest ); + int rename( const char *source, const char *dest ); void dump( FILE *output = stderr ); - void debug( char *title = "Object", FILE *output = stderr ); - int save( char *file ); + void debug( const char *title = "Object", FILE *output = stderr ); + void load( const char *file ); + int save( const char *file ); Event *listen( char *id, void *object, mlt_listener listener ); Event *setup_wait_for( char *id ); void wait_for( Event *, bool destroy = true );