~ubuntu-branches/ubuntu/oneiric/kalgebra/oneiric-updates

« back to all changes in this revision

Viewing changes to analitza/stringexpressionwriter.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-08 20:10:34 UTC
  • Revision ID: james.westby@ubuntu.com-20110708201034-0cqpagx7uz4pu82n
Tags: upstream-4.6.90+repack1
Import upstream version 4.6.90+repack1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************************
 
2
 *  Copyright (C) 2008 by Aleix Pol <aleixpol@kde.org>                               *
 
3
 *                                                                                   *
 
4
 *  This program is free software; you can redistribute it and/or                    *
 
5
 *  modify it under the terms of the GNU General Public License                      *
 
6
 *  as published by the Free Software Foundation; either version 2                   *
 
7
 *  of the License, or (at your option) any later version.                           *
 
8
 *                                                                                   *
 
9
 *  This program 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                    *
 
12
 *  GNU General Public License for more details.                                     *
 
13
 *                                                                                   *
 
14
 *  You should have received a copy of the GNU General Public License                *
 
15
 *  along with this program; if not, write to the Free Software                      *
 
16
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
 
17
 *************************************************************************************/
 
18
 
 
19
#ifndef STRINGEXPRESSIONWRITER_H
 
20
#define STRINGEXPRESSIONWRITER_H
 
21
 
 
22
#include "expressionwriter.h"
 
23
#include "operator.h"
 
24
 
 
25
namespace Analitza
 
26
{
 
27
 
 
28
/**
 
29
 *      This class represents the string expression writer.
 
30
 *
 
31
 *      @author Aleix Pol <aleixpol@kde.org>  
 
32
 */
 
33
 
 
34
class StringExpressionWriter : public ExpressionWriter
 
35
{
 
36
        public:
 
37
                StringExpressionWriter(const Object* o);
 
38
                
 
39
                virtual QString accept(const Ci* var);
 
40
                virtual QString accept(const Cn* var);
 
41
                virtual QString accept(const Container* var);
 
42
                virtual QString accept(const Operator* var);
 
43
                virtual QString accept(const Vector* var);
 
44
                virtual QString accept(const List* l);
 
45
                virtual QString accept(const Apply* a);
 
46
                virtual QString accept(const CustomObject* c);
 
47
                
 
48
                QString result() const { return m_result; }
 
49
                
 
50
                static int weight(const Operator* op, int size);
 
51
                static const QMap<Operator::OperatorType, QString> s_operators;
 
52
        private:
 
53
                template <class T>
 
54
                        static QStringList allValues(T it, const T& itEnd, ExpressionWriter* writer);
 
55
 
 
56
                QString m_result;
 
57
};
 
58
 
 
59
}
 
60
#endif