Scribus
Open source desktop publishing at your fingertips
desaxe_conf.h
1 /*
2  * desaxe_conf.h
3  *
4  *
5  * Created by Andreas Vox on 02.06.06.
6  * Copyright 2006 under GPL2. All rights reserved.
7  *
8  */
9 
10 #ifndef DESAXE_CONF_H
11 #define DESAXE_CONF_H
12 
13 
14 // disable lots of diagnostic messages
15 #undef DESAXE_DEBUG
16 
17 
18 // choose datatypes for element tags and attributes
19 #define DESAXE_QT
20 
21 #ifdef DESAXE_QT
22 
23 #include <string>
24 #include <QString>
25 #include <QMap>
26 
27 typedef QString Xml_string;
28 typedef QMap<Xml_string, Xml_string> Xml_attr;
29 
30 inline Xml_string Xml_key(Xml_attr::iterator& it) { return it.key(); }
31 inline Xml_string Xml_data(Xml_attr::iterator& it) { return it.value(); }
32 inline std::string fromXMLString(const Xml_string& s) { QByteArray ba(s.toUtf8()); return std::string(ba.constData()); }
33 inline Xml_string fromSTLString(const std::string& s) { return QString::fromUtf8(s.c_str()); }
34 
35 #else
36 
37 #include <string>
38 #include <utility>
39 #include <map>
40 
41 typedef std::string Xml_string;
42 typedef std::map<Xml_string, Xml_string> Xml_attr;
43 
44 inline Xml_string Xml_key(Xml_attr::iterator& it) { return it->first; }
45 inline Xml_string Xml_data(Xml_attr::iterator& it) { return it->second; }
46 inline const char* fromXMLString(const Xml_string& s) { return s.c_str(); }
47 inline Xml_string fromSTLString(const std::string& s) { return s; }
48 
49 #endif
50 
51 #endif