~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to filters/karbon/ai/aielement.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2002, Dirk Sch�nberger <dirk.schoenberger@sz-online.de>
 
3
 
 
4
   This library is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
9
   This library is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public License
 
15
   along with this library; see the file COPYING.LIB.  If not, write to
 
16
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
   Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
#ifndef AIELEMENT_H
 
21
#define AIELEMENT_H
 
22
 
 
23
// #include <qvaluelist.h>
 
24
#include <qvaluevector.h>
 
25
 
 
26
class QString;
 
27
class QCString;
 
28
 
 
29
/**
 
30
  *@author 
 
31
  */
 
32
 
 
33
class AIElement {
 
34
public:
 
35
    enum Type {
 
36
        Invalid,
 
37
//      List,
 
38
        String,
 
39
        Int,
 
40
  UInt,
 
41
        Double,
 
42
        CString,
 
43
  // Custom Types
 
44
  Operator,
 
45
  Reference,
 
46
  ElementArray,
 
47
  Block,
 
48
  ByteArray,
 
49
  Byte
 
50
    };
 
51
 
 
52
    AIElement();
 
53
    ~AIElement();
 
54
    AIElement( const AIElement& );
 
55
    AIElement( const QString&, Type type = String );
 
56
    AIElement( const QCString& );
 
57
    AIElement( const char* );
 
58
//    AIElement( const QValueList<AIElement>& );
 
59
    AIElement( const QValueVector<AIElement>&, Type type = ElementArray);
 
60
    AIElement( int );
 
61
    AIElement( uint );
 
62
    AIElement( double );
 
63
    AIElement( const QByteArray& );
 
64
    AIElement( uchar );
 
65
 
 
66
    AIElement& operator= ( const AIElement& );
 
67
    bool operator==( const AIElement& ) const;
 
68
    bool operator!=( const AIElement& ) const;
 
69
 
 
70
    Type type() const;
 
71
    const char* typeName() const;
 
72
 
 
73
    bool canCast( Type ) const;
 
74
    bool cast( Type );
 
75
 
 
76
    bool isValid() const;
 
77
 
 
78
    void clear();
 
79
 
 
80
    const QString toString() const;
 
81
    const QCString toCString() const;
 
82
    int toInt( bool * ok=0 ) const;
 
83
    uint toUInt( bool * ok=0 ) const;
 
84
    double toDouble( bool * ok=0 ) const;
 
85
//    const QValueList<AIElement> toList() const;
 
86
    const QValueVector<AIElement> toElementArray() const;
 
87
    const QValueVector<AIElement> toBlock() const;
 
88
 
 
89
    // Custom types
 
90
    const QString toReference() const;
 
91
    const QString toOperator() const;
 
92
    const QByteArray toByteArray() const;
 
93
    uchar toByte( bool * ok=0 ) const;
 
94
 
 
95
//    QValueListConstIterator<AIElement> listBegin() const;
 
96
//    QValueListConstIterator<AIElement> listEnd() const;
 
97
    QString& asString();
 
98
    QCString& asCString();
 
99
    int& asInt();
 
100
    uint& asUInt();
 
101
    double& asDouble();
 
102
//    QValueList<AIElement>& asList();
 
103
    QValueVector<AIElement>& asElementArray();
 
104
    QValueVector<AIElement>& asBlock();
 
105
 
 
106
    // Custom types
 
107
    QString& asReference();
 
108
    QString& asToken();
 
109
    QByteArray& asByteArray();
 
110
    uchar& asByte();
 
111
 
 
112
    static const char* typeToName( Type typ );
 
113
    static Type nameToType( const char* name );
 
114
 
 
115
private:
 
116
    void detach();
 
117
 
 
118
    class Private : public QShared
 
119
    {
 
120
    public:
 
121
        Private();
 
122
        Private( Private* );
 
123
        ~Private();
 
124
 
 
125
        void clear();
 
126
 
 
127
        Type typ;
 
128
        union
 
129
        {
 
130
            uint u;
 
131
            int i;
 
132
            double d;
 
133
      uchar b;
 
134
            void *ptr;
 
135
        } value;
 
136
    };
 
137
 
 
138
    Private* d;
 
139
};
 
140
 
 
141
inline AIElement::Type AIElement::type() const
 
142
{
 
143
    return d->typ;
 
144
}
 
145
 
 
146
inline bool AIElement::isValid() const
 
147
{
 
148
    return (d->typ != Invalid);
 
149
}
 
150
 
 
151
#endif