Chris@629
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@629
|
2
|
Chris@629
|
3 /*
|
Chris@629
|
4 Sonic Visualiser
|
Chris@629
|
5 An audio file viewer and annotation editor.
|
Chris@629
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@629
|
7
|
Chris@629
|
8 This program is free software; you can redistribute it and/or
|
Chris@629
|
9 modify it under the terms of the GNU General Public License as
|
Chris@629
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@629
|
11 License, or (at your option) any later version. See the file
|
Chris@629
|
12 COPYING included with this distribution for more information.
|
Chris@629
|
13 */
|
Chris@629
|
14
|
Chris@629
|
15 /*
|
Chris@629
|
16 This is a modified version of a source file from the
|
Chris@629
|
17 Rosegarden MIDI and audio sequencer and notation editor.
|
Chris@629
|
18 This file copyright 2000-2010 Chris Cannam.
|
Chris@629
|
19 */
|
Chris@629
|
20
|
Chris@1524
|
21 #ifndef SV_STRING_BITS_H
|
Chris@1524
|
22 #define SV_STRING_BITS_H
|
Chris@629
|
23
|
Chris@629
|
24 #include <QString>
|
Chris@629
|
25 #include <QStringList>
|
Chris@629
|
26 #include <QChar>
|
Chris@629
|
27
|
Chris@629
|
28 class StringBits
|
Chris@629
|
29 {
|
Chris@629
|
30 public:
|
Chris@629
|
31 /**
|
Chris@629
|
32 * Convert a string to a double using basic "C"-locale syntax,
|
Chris@629
|
33 * i.e. always using '.' as a decimal point. We use this as a
|
Chris@629
|
34 * fallback when parsing files from an unknown source, if
|
Chris@629
|
35 * locale-specific conversion fails. Does not support e notation.
|
Chris@629
|
36 * If ok is non-NULL, *ok will be set to true if conversion
|
Chris@629
|
37 * succeeds or false otherwise.
|
Chris@629
|
38 */
|
Chris@629
|
39 static double stringToDoubleLocaleFree(QString s, bool *ok = 0);
|
Chris@629
|
40
|
Chris@629
|
41 /**
|
Chris@629
|
42 * Split a string at the given separator character, allowing
|
Chris@629
|
43 * quoted sections that contain the separator. If the separator
|
Chris@629
|
44 * is ' ', any (amount of) whitespace will be considered as a
|
Chris@629
|
45 * single separator. If the separator is another whitespace
|
Chris@629
|
46 * character such as '\t', it will be used literally.
|
Chris@629
|
47 */
|
Chris@629
|
48 static QStringList splitQuoted(QString s, QChar separator);
|
Chris@629
|
49
|
Chris@629
|
50 /**
|
Chris@629
|
51 * Split a string at the given separator character. If quoted is
|
Chris@629
|
52 * true, do so by calling splitQuoted (above). If quoted is
|
Chris@629
|
53 * false, use QString::split; if separator is ' ', use
|
Chris@629
|
54 * SkipEmptyParts behaviour, otherwise use KeepEmptyParts (this is
|
Chris@629
|
55 * analogous to the behaviour of splitQuoted).
|
Chris@629
|
56 */
|
Chris@629
|
57 static QStringList split(QString s, QChar separator, bool quoted);
|
Chris@629
|
58 };
|
Chris@629
|
59
|
Chris@629
|
60 #endif
|