~ubuntu-branches/ubuntu/wily/kid3/wily-proposed

« back to all changes in this revision

Viewing changes to kid3/importparser.h

  • Committer: Package Import Robot
  • Author(s): Ana Beatriz Guerrero Lopez, Patrick Matthäi, Ana Beatriz Guerrero Lopez
  • Date: 2011-11-13 16:34:13 UTC
  • mfrom: (1.1.13) (2.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20111113163413-5y0anlc4dqf511uh
Tags: 2.0.1-1
* New upstream release.

[ Patrick Matthäi ]
* Adjust build system.
* Add build dependency xsltproc.

[ Ana Beatriz Guerrero Lopez ]
* Some more adjustments to the build system taken from upstream's deb/
* directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * \file importparser.h
3
 
 * Import parser.
4
 
 *
5
 
 * \b Project: Kid3
6
 
 * \author Urs Fleisch
7
 
 * \date 17 Sep 2003
8
 
 *
9
 
 * Copyright (C) 2003-2007  Urs Fleisch
10
 
 *
11
 
 * This file is part of Kid3.
12
 
 *
13
 
 * Kid3 is free software; you can redistribute it and/or modify
14
 
 * it under the terms of the GNU General Public License as published by
15
 
 * the Free Software Foundation; either version 2 of the License, or
16
 
 * (at your option) any later version.
17
 
 *
18
 
 * Kid3 is distributed in the hope that it will be useful,
19
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 
 * GNU General Public License for more details.
22
 
 *
23
 
 * You should have received a copy of the GNU General Public License
24
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 
 */
26
 
 
27
 
#ifndef IMPORTPARSER_H
28
 
#define IMPORTPARSER_H
29
 
 
30
 
#include <qstring.h>
31
 
#include <qregexp.h>
32
 
#include <qmap.h>
33
 
#include "qtcompatmac.h"
34
 
/** The list type depends on the Qt version. */
35
 
#if QT_VERSION >= 0x040000
36
 
#include <QList>
37
 
typedef QList<int> TrackDurationList;
38
 
#else
39
 
#include <qvaluelist.h>
40
 
typedef QValueList<int> TrackDurationList;
41
 
#endif
42
 
 
43
 
class FrameCollection;
44
 
 
45
 
/**
46
 
 * Import parser.
47
 
 */
48
 
class ImportParser {
49
 
public:
50
 
        /**
51
 
         * Set import format.
52
 
         *
53
 
         * @param fmt format regexp
54
 
         * @param enableTrackIncr enable automatic track increment if no %t is found
55
 
         */
56
 
        void setFormat(const QString& fmt, bool enableTrackIncr = false);
57
 
 
58
 
        /**
59
 
         * Get next tags in text buffer.
60
 
         *
61
 
         * @param text text buffer containing data from file or clipboard
62
 
         * @param frames frames for output
63
 
         * @param pos  current position in buffer, will be updated to point
64
 
         *             behind current match (to be used for next call)
65
 
         * @return true if tags found (pos is index behind match).
66
 
         */
67
 
        bool getNextTags(const QString& text, FrameCollection& frames, int& pos);
68
 
 
69
 
        /**
70
 
         * Get list with track durations.
71
 
         *
72
 
         * @return list with track durations.
73
 
         */
74
 
        TrackDurationList* getTrackDurations() { return &m_trackDuration; }
75
 
 
76
 
        /**
77
 
         * Get help text for format codes supported by setFormat().
78
 
         *
79
 
         * @return help text.
80
 
         */
81
 
        static QString getFormatToolTip();
82
 
 
83
 
private:
84
 
        /** track regexp pattern */
85
 
        QString m_pattern;
86
 
        /** regexp object */
87
 
        QRegExp m_re;
88
 
        /** true if automatic track number incrementing is used */
89
 
        bool m_trackIncrEnabled;
90
 
        /** automatically incremented track number */
91
 
        int m_trackIncrNr;
92
 
        QMap<QString, int> m_codePos;
93
 
        TrackDurationList m_trackDuration;
94
 
};
95
 
 
96
 
#endif