]> git.sesse.net Git - vlc/blob - modules/gui/skins2/utils/var_bool.cpp
skins2: kill many compil warnings
[vlc] / modules / gui / skins2 / utils / var_bool.cpp
1 /*****************************************************************************
2  * var_bool.cpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #include "var_bool.hpp"
26
27
28 const string VarBool::m_type = "bool";
29
30
31 VarBoolImpl::VarBoolImpl( intf_thread_t *pIntf ):
32     VarBool( pIntf ), m_value( false )
33 {
34 }
35
36
37 void VarBoolImpl::set( bool value )
38 {
39     if( value != m_value )
40     {
41         m_value = value;
42         notify();
43     }
44 }
45
46
47 VarBoolAndBool::VarBoolAndBool( intf_thread_t *pIntf, VarBool &rVar1,
48                                 VarBool &rVar2 ):
49     VarBool( pIntf ), m_rVar1( rVar1 ), m_rVar2( rVar2 ),
50     m_value( rVar1.get() && rVar2.get() )
51 {
52     m_rVar1.addObserver( this );
53     m_rVar2.addObserver( this );
54 }
55
56
57 VarBoolAndBool::~VarBoolAndBool()
58 {
59     m_rVar1.delObserver( this );
60     m_rVar2.delObserver( this );
61 }
62
63
64 void VarBoolAndBool::onUpdate( Subject<VarBool> &rVariable, void *arg )
65 {
66     (void)rVariable; (void)arg;
67     if( m_value != ( m_rVar1.get() && m_rVar2.get() ) )
68     {
69         m_value = ( m_rVar1.get() && m_rVar2.get() );
70         notify();
71     }
72 }
73
74
75 VarBoolOrBool::VarBoolOrBool( intf_thread_t *pIntf, VarBool &rVar1,
76                               VarBool &rVar2 ):
77     VarBool( pIntf ), m_rVar1( rVar1 ), m_rVar2( rVar2 ),
78     m_value( rVar1.get() || rVar2.get() )
79 {
80     m_rVar1.addObserver( this );
81     m_rVar2.addObserver( this );
82 }
83
84
85 VarBoolOrBool::~VarBoolOrBool()
86 {
87     m_rVar1.delObserver( this );
88     m_rVar2.delObserver( this );
89 }
90
91
92 void VarBoolOrBool::onUpdate( Subject<VarBool> &rVariable, void *arg )
93 {
94     (void)rVariable; (void)arg;
95     if( m_value != ( m_rVar1.get() || m_rVar2.get() ) )
96     {
97         m_value = ( m_rVar1.get() || m_rVar2.get() );
98         notify();
99     }
100 }
101
102
103 VarNotBool::VarNotBool( intf_thread_t *pIntf, VarBool &rVar ):
104     VarBool( pIntf ), m_rVar( rVar )
105 {
106     m_rVar.addObserver( this );
107 }
108
109
110 VarNotBool::~VarNotBool()
111 {
112     m_rVar.delObserver( this );
113 }
114
115
116 void VarNotBool::onUpdate( Subject<VarBool> &rVariable, void *arg )
117 {
118     (void)rVariable; (void)arg;
119     notify();
120 }
121
122