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 _KwCssSchema_h_
21 #define _KwCssSchema_h_
25 * @brief Schema of styles.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwCssScope.h"
41 * Constructors + destructor
44 /// Default constructor
53 /// Register a new property.
55 void registerProperty(const QString
& name
)
57 m_constructors
[name
] = &KwCssConstruct
<T
>;
60 /// Construct from an unprocessed string and a style name.
61 KwCssAbstractStyle
* construct(const QString
& name
, const KwCssUnprocessed
& value
) const
63 KwCssAbstractStyle
* result
= 0;
64 if (m_constructors
.contains(name
))
66 result
= m_constructors
[name
](value
);
70 result
= new KwCssStyle
<KwCssUnprocessed
>(value
);
81 /// Constructor function.
82 typedef KwCssAbstractStyle
* Constructor(const KwCssUnprocessed
& value
);
83 /// Hash of style names to constructors.
84 QHash
<QString
, Constructor
*> m_constructors
;
87 #endif // _KwCssSchema_h_