Object validity checks
[melted] / mlt++ / src / MltProperties.cpp
1 /**
2 * MltProperties.cpp - MLT Wrapper
3 * Copyright (C) 2004-2005 Charles Yates
4 * Author: Charles Yates <charles.yates@pandora.be>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #include "MltProperties.h"
22 using namespace Mlt;
23
24 PropertiesInstance::PropertiesInstance( ) :
25 destroy( true ),
26 instance( NULL )
27 {
28 instance = mlt_properties_new( );
29 }
30
31 PropertiesInstance::PropertiesInstance( Properties &properties ) :
32 destroy( false ),
33 instance( properties.get_properties( ) )
34 {
35 }
36
37 PropertiesInstance::PropertiesInstance( mlt_properties properties ) :
38 destroy( false ),
39 instance( properties )
40 {
41 }
42
43 PropertiesInstance::~PropertiesInstance( )
44 {
45 if ( destroy )
46 mlt_properties_close( instance );
47 }
48
49 bool Properties::is_valid( )
50 {
51 return get_properties( ) != NULL;
52 }
53
54 int Properties::count( )
55 {
56 return mlt_properties_count( get_properties( ) );
57 }
58
59 char *Properties::get( char *name )
60 {
61 return mlt_properties_get( get_properties( ), name );
62 }
63
64 int Properties::get_int( char *name )
65 {
66 return mlt_properties_get_int( get_properties( ), name );
67 }
68
69 double Properties::get_double( char *name )
70 {
71 return mlt_properties_get_double( get_properties( ), name );
72 }
73
74 void *Properties::get_data( char *name, int &size )
75 {
76 return mlt_properties_get_data( get_properties( ), name, &size );
77 }
78
79 int Properties::set( char *name, char *value )
80 {
81 return mlt_properties_set( get_properties( ), name, value );
82 }
83
84 int Properties::set( char *name, int value )
85 {
86 return mlt_properties_set_int( get_properties( ), name, value );
87 }
88
89 int Properties::set( char *name, double value )
90 {
91 return mlt_properties_set_double( get_properties( ), name, value );
92 }
93
94 int Properties::set( char *name, void *value, int size, mlt_destructor destructor, mlt_serialiser serialiser )
95 {
96 return mlt_properties_set_data( get_properties( ), name, value, size, destructor, serialiser );
97 }
98
99 mlt_properties PropertiesInstance::get_properties( )
100 {
101 return instance;
102 }
103
104