~ubuntu-branches/ubuntu/wily/kbibtex/wily

« back to all changes in this revision

Viewing changes to src/value.h

  • Committer: Package Import Robot
  • Author(s): Michael Hanke
  • Date: 2011-07-18 09:29:48 UTC
  • mfrom: (1.1.6) (2.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20110718092948-ksxjmg7kdfamolmg
Tags: 0.3-1
* First upstream release for KDE4 (Closes: #634255). A number of search
  engines are still missing, in comparison to the 0.2 series.
* Bumped Standards-Version to 3.9.2, no changes necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
*   Copyright (C) 2004-2006 by Thomas Fischer                             *
3
 
*   fischer@unix-ag.uni-kl.de                                             *
4
 
*                                                                         *
5
 
*   This program 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.                                   *
9
 
*                                                                         *
10
 
*   This program 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.                          *
14
 
*                                                                         *
15
 
*   You should have received a copy of the GNU General Public License     *
16
 
*   along with this program; if not, write to the                         *
17
 
*   Free Software Foundation, Inc.,                                       *
18
 
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 
***************************************************************************/
20
 
#ifndef BIBTEXVALUE_H
21
 
#define BIBTEXVALUE_H
22
 
 
23
 
#include <qvaluelist.h>
24
 
 
25
 
class QStringList;
26
 
 
27
 
namespace BibTeX
28
 
{
29
 
    class ValueTextInterface
30
 
    {
31
 
    public:
32
 
        ValueTextInterface( const ValueTextInterface* other );
33
 
        ValueTextInterface( const QString& text );
34
 
        virtual ~ValueTextInterface() {};
35
 
 
36
 
        virtual void setText( const QString& text );
37
 
        virtual QString text() const;
38
 
        QString simplifiedText() const;
39
 
        virtual void replace( const QString &before, const QString &after );
40
 
        virtual bool containsPattern( const QString &pattern, bool caseSensitive );
41
 
 
42
 
    private:
43
 
        QString m_text;
44
 
    };
45
 
 
46
 
    class ValueItem: public ValueTextInterface
47
 
    {
48
 
    public:
49
 
        ValueItem( const QString& text );
50
 
 
51
 
        virtual ValueItem *clone()
52
 
        {
53
 
            return NULL;
54
 
        };
55
 
    };
56
 
 
57
 
    class Keyword: public ValueTextInterface
58
 
    {
59
 
    public:
60
 
        Keyword( Keyword *other );
61
 
        Keyword( const QString& text );
62
 
 
63
 
        Keyword *clone();
64
 
    };
65
 
 
66
 
    class KeywordContainer: public ValueItem
67
 
    {
68
 
    public:
69
 
        KeywordContainer();
70
 
        KeywordContainer( const QString& text );
71
 
        KeywordContainer( KeywordContainer *other );
72
 
        KeywordContainer( const QStringList& list );
73
 
 
74
 
        ValueItem *clone();
75
 
        void setList( const QStringList& list );
76
 
        void append( const QString& text );
77
 
        void remove( const QString& text );
78
 
        void setText( const QString& text );
79
 
        QString text() const;
80
 
        void replace( const QString &before, const QString &after );
81
 
 
82
 
        QValueList<Keyword*> keywords;
83
 
    };
84
 
 
85
 
    class Person: public ValueTextInterface
86
 
    {
87
 
    public:
88
 
        Person( const QString& text, bool firstNameFirst = FALSE );
89
 
        Person( const QString& firstName, const QString& lastName, bool firstNameFirst = FALSE );
90
 
 
91
 
        Person *clone();
92
 
        void setText( const QString& text );
93
 
        QString text() const;
94
 
        QString text( bool firstNameFirst ) const;
95
 
 
96
 
        QString firstName();
97
 
        QString lastName();
98
 
 
99
 
    protected:
100
 
        QString m_firstName;
101
 
        QString m_lastName;
102
 
        bool m_firstNameFirst;
103
 
 
104
 
        bool splitName( const QString& text, QStringList& segments );
105
 
    };
106
 
 
107
 
    class PersonContainer: public ValueItem
108
 
    {
109
 
    public:
110
 
        PersonContainer( bool firstNameFirst = FALSE );
111
 
        PersonContainer( const QString& text, bool firstNameFirst = FALSE );
112
 
 
113
 
        ValueItem *clone();
114
 
        void setText( const QString& text );
115
 
        QString text() const;
116
 
        void replace( const QString &before, const QString &after );
117
 
 
118
 
        QValueList<Person*> persons;
119
 
 
120
 
    private:
121
 
        bool m_firstNameFirst;
122
 
    };
123
 
 
124
 
    class MacroKey: public ValueItem
125
 
    {
126
 
    private:
127
 
        bool m_isValid;
128
 
        bool isValidInternal();
129
 
 
130
 
    public:
131
 
        MacroKey( const QString& text );
132
 
 
133
 
        ValueItem *clone();
134
 
 
135
 
        void setText( const QString& text );
136
 
        bool isValid();
137
 
    };
138
 
 
139
 
    class PlainText: public ValueItem
140
 
    {
141
 
    public:
142
 
        PlainText( const QString& text );
143
 
 
144
 
        ValueItem *clone();
145
 
    };
146
 
 
147
 
    class Value: public ValueTextInterface
148
 
    {
149
 
    public:
150
 
        Value();
151
 
        Value( const Value *other );
152
 
        Value( const QString& text, bool isMacroKey = false );
153
 
 
154
 
        void setText( const QString& text );
155
 
        QString text() const;
156
 
        void replace( const QString &before, const QString &after );
157
 
 
158
 
        QValueList<ValueItem*> items;
159
 
    };
160
 
}
161
 
 
162
 
#endif