1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwCssStyle_h_
21 #define _KwCssStyle_h_
25 * @brief Typed cascading style property.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwCssAbstractStyle.h"
30 #include "KwCssUnprocessed.h"
34 KwCssUnprocessed
KwCssStringify(const T
& value
);
36 /// Unstringify a type.
38 T
KwCssUnstringify(const KwCssUnprocessed
& value
, bool* success
);
40 /// Typed cascading style property.
42 * @param T The type of the property.
45 class KwCssStyle
: public KwCssAbstractStyle
63 * Constructors + destructors
66 /// Default constructor.
68 : KwCssAbstractStyle()
75 KwCssStyle(const KwCssStyle
& copy
)
76 : KwCssAbstractStyle(copy
)
77 , m_operation(copy
.m_operation
)
78 , m_value(copy
.m_value
)
82 /// Primary constructor.
83 KwCssStyle(const T
& value
, Operation op
= override
)
84 : KwCssAbstractStyle()
90 /// Primary constructor.
91 KwCssStyle(Operation op
)
92 : KwCssAbstractStyle()
108 virtual KwCssAbstractStyleState
* getNewState() const;
111 virtual KwCssAbstractStyle
* duplicate() const
113 return new KwCssStyle
<T
>(*this);
117 virtual QString
toString() const
128 return KwCssStringify(m_value
);
149 /// Get the operation type.
150 Operation
getOperation() const
167 /// Type of operation.
168 Operation m_operation
;
170 /// Initial or overrided value.
174 #include "KwCssStyleState.h"
177 template <typename T
>
178 KwCssAbstractStyleState
* KwCssStyle
<T
>::getNewState() const
180 return new KwCssStyleState
<T
>();
183 #endif // _KwCssStyle_h_