~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to formatters/astyle_plugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of KDevelop
 
2
*  Copyright (C) 2008 Cédric Pasteur <cedric.pasteur@free.fr>
 
3
Copyright (C) 2001 Matthias Hölzer-Klüpfel <mhk@caldera.de>
 
4
 
 
5
   This program is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (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 GNU
 
13
    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; see the file COPYING.  If not, write to
 
17
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
   Boston, MA 02110-1301, USA.
 
19
 
 
20
 */
 
21
 
 
22
#ifndef ASTYLEPLUGIN_H
 
23
#define ASTYLEPLUGIN_H
 
24
 
 
25
#include <interfaces/iplugin.h>
 
26
#include <interfaces/isourceformatter.h>
 
27
 
 
28
class AStyleFormatter;
 
29
 
 
30
class AStylePlugin : public KDevelop::IPlugin, public KDevelop::ISourceFormatter
 
31
{
 
32
    Q_OBJECT
 
33
    Q_INTERFACES(KDevelop::ISourceFormatter)
 
34
 
 
35
    public:
 
36
        explicit AStylePlugin(QObject *parent, const QVariantList & = QVariantList());
 
37
        ~AStylePlugin();
 
38
 
 
39
        virtual QString name();
 
40
        virtual QString caption();
 
41
        virtual QString description();
 
42
 
 
43
        virtual QString highlightModeForMime(const KMimeType::Ptr &mime);
 
44
 
 
45
        /** Formats using the current style.
 
46
        */
 
47
        virtual QString formatSource(const QString &text, const KMimeType::Ptr &mime, const QString& leftContext, const QString& rightContext);
 
48
 
 
49
        /** \return A map of predefined styles (a key and a caption for each type)
 
50
        */
 
51
        virtual QList<KDevelop::SourceFormatterStyle> predefinedStyles();
 
52
 
 
53
        /** \return The widget to edit a style.
 
54
        */
 
55
        virtual KDevelop::SettingsWidget* editStyleWidget(const KMimeType::Ptr &mime);
 
56
 
 
57
        virtual QString formatSourceWithStyle(KDevelop::SourceFormatterStyle, const QString& text,
 
58
                                              const KMimeType::Ptr &mime,
 
59
                                              const QString& leftContext = QString(),
 
60
                                              const QString& rightContext = QString() );
 
61
        
 
62
        /** \return The text used in the config dialog to preview the current style.
 
63
        */
 
64
        virtual QString previewText(const KMimeType::Ptr &mime);
 
65
        
 
66
        /** \return The indentation type of the currently selected style.
 
67
        */
 
68
        virtual IndentationType indentationType();
 
69
        /** \return The number of spaces used for indentation if IndentWithSpaces is used,
 
70
        * or the number of spaces per tab if IndentWithTabs is selected.
 
71
        */
 
72
        virtual int indentationLength();
 
73
 
 
74
        static QString formattingSample();
 
75
        static QString indentingSample();
 
76
 
 
77
    private:
 
78
        AStyleFormatter *m_formatter;
 
79
        KDevelop::SourceFormatterStyle currentStyle;
 
80
};
 
81
 
 
82
#endif // ASTYLEPLUGIN_H