You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
262 lines
12 KiB
262 lines
12 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
|
||
11 years ago
|
Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
|
||
|
Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
|
||
15 years ago
|
Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
|
||
11 years ago
|
Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
|
||
15 years ago
|
Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
|
||
11 years ago
|
Copyright (C) 2003-2004 Alexander Dymo <adymo@kdevelop.org>
|
||
15 years ago
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
15 years ago
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
15 years ago
|
*/
|
||
11 years ago
|
#ifndef TDEVLANGUAGESUPPORT_H
|
||
|
#define TDEVLANGUAGESUPPORT_H
|
||
15 years ago
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqstringlist.h>
|
||
15 years ago
|
#include <kmimetype.h>
|
||
11 years ago
|
#include "tdevplugin.h"
|
||
15 years ago
|
#include "codemodel.h"
|
||
|
#include <designer.h>
|
||
|
|
||
|
/**
|
||
11 years ago
|
@file tdevlanguagesupport.h
|
||
15 years ago
|
Interface to programming language specific features.
|
||
|
*/
|
||
|
|
||
|
class Tag;
|
||
11 years ago
|
class TDevDesignerIntegration;
|
||
15 years ago
|
|
||
|
using namespace KInterfaceDesigner;
|
||
|
|
||
|
/**
|
||
|
KDevelop language support interface - the base class for all programming language support plugins.
|
||
|
Language support is used to load facilities specific to certain programming language.
|
||
|
Language supports are usually loaded among with a project. In this case project file defines
|
||
|
which language support to load.
|
||
|
|
||
|
Language support plugin is a good place for:
|
||
|
- a language parser which fills memory and persistent symbol store
|
||
11 years ago
|
(see @ref CodeModel and @ref TDevCodeRepository);
|
||
15 years ago
|
- code wizards specific to a programming language (like new class wizard);
|
||
11 years ago
|
- GUI designer integration (see @ref TDevLanguageSupport::designer method
|
||
|
documentation and @ref TDevDesignerIntegration class documentation;
|
||
15 years ago
|
- symbol (class, function, etc.) name formatting to a human-readable convention (pretty
|
||
|
formatted name).
|
||
|
.
|
||
|
*/
|
||
11 years ago
|
class TDevLanguageSupport: public TDevPlugin
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
|
||
|
public:
|
||
|
|
||
|
/**Features supported by this language support.*/
|
||
|
enum Features {
|
||
|
/*features of the language itself*/
|
||
|
Classes=1 /**<Language has classes (or class-like packages).*/,
|
||
|
Structs=2 /**<Language has structures or records.*/,
|
||
|
Functions=4 /**<Language has functions.*/,
|
||
|
Variables=8 /**<Language has variables.*/,
|
||
|
|
||
|
Namespaces=16 /**<Language has namespaces.*/,
|
||
|
Signals=32 /**<Language has signals (or qt library bindings are available).*/,
|
||
|
Slots=64 /**<Language has slots (or qt library bindings are available).*/,
|
||
|
Declarations=128 /**<Language has function declarations (like c, c++ and pascal).*/,
|
||
|
|
||
|
/*features of the language support part*/
|
||
|
NewClass=512 /**<Language support can create classes.*/,
|
||
|
AddMethod=1024 /**<Language support can create methods.*/,
|
||
|
AddAttribute=2048 /**<Language support can create class attributes.*/,
|
||
|
CreateAccessMethods=4096 /**<Language support can create get/set methods for attributes.*/
|
||
|
};
|
||
|
|
||
|
/**Constructs a language support plugin.
|
||
|
@param info Important information about the plugin - plugin internal and generic
|
||
|
(GUI) name, description, a list of authors, etc. That information is used to show
|
||
|
plugin information in various places like "about application" dialog, plugin selector
|
||
|
dialog, etc. Plugin does not take ownership on info object, also its lifetime should
|
||
|
be equal to the lifetime of the plugin.
|
||
11 years ago
|
@param parent The parent object for the plugin. Parent object must implement @ref TDevApi
|
||
15 years ago
|
interface. Otherwise the plugin will not be constructed.
|
||
|
@param name The internal name which identifies the plugin.*/
|
||
11 years ago
|
TDevLanguageSupport(const TDevPluginInfo *info, TQObject *parent, const char *name);
|
||
15 years ago
|
/**Destructor.*/
|
||
11 years ago
|
~TDevLanguageSupport();
|
||
15 years ago
|
|
||
|
/**@return The feature set of the language. This is e.g. used
|
||
|
by the class view to decide which organizer items to display and which not.*/
|
||
|
virtual Features features();
|
||
|
|
||
|
/**@return A typical mimetype list for the support language, this list
|
||
|
should be configurable in the languagesupport dialog.*/
|
||
|
virtual KMimeType::List mimeTypes();
|
||
|
|
||
|
/**Formats a Tag as used by the persistent symbol store to the human-readable convention.
|
||
|
@param tag Tag to format.*/
|
||
15 years ago
|
virtual TQString formatTag(const Tag& tag);
|
||
15 years ago
|
|
||
|
/**Formats a CodeModelItem as used by the CodeModel to the human-readable convention.
|
||
|
@param item Symbol to format.
|
||
|
@param shortDescription Show short description of a symbol. For example, when
|
||
|
formatting functions short description could be a function signature without
|
||
|
the return type and argument default values.*/
|
||
15 years ago
|
virtual TQString formatModelItem(const CodeModelItem *item, bool shortDescription=false);
|
||
15 years ago
|
|
||
|
/**Formats a canonicalized class path as used by the symbol store to the
|
||
|
human-readable convention. For example, the C++ support part formats the
|
||
|
string "KParts.Part" into "KParts::Part".
|
||
|
@param name Class name.*/
|
||
15 years ago
|
virtual TQString formatClassName(const TQString &name);
|
||
15 years ago
|
|
||
|
/**The opposite of @ref formatClassName. Reverts formatting.
|
||
|
@param name Class name.*/
|
||
15 years ago
|
virtual TQString unformatClassName(const TQString &name);
|
||
15 years ago
|
|
||
|
/**Determines whether the document should be opened in a split view. The
|
||
|
language part can determine this internally and then set the active document
|
||
|
and if so, set the active document so that the newly opened one will be split
|
||
|
with it.
|
||
|
@param name URL of the document in question.*/
|
||
|
virtual bool shouldSplitDocument( const KURL &url );
|
||
|
|
||
|
/**Returns the language parts Split View orientation.
|
||
|
By default Qt::Vertical.*/
|
||
|
virtual Qt::Orientation splitOrientation() const;
|
||
|
|
||
|
/**Opens a "New class" dialog and adds the configured class to the sources.
|
||
|
Define NewClass feature if you reimplement this method.*/
|
||
|
virtual void addClass();
|
||
|
|
||
|
/**Opens an "Add method" dialog and adds the configured method to the sources.
|
||
|
Define AddMethod feature if you reimplement this method.
|
||
|
@param klass The class DOM to add a method to.*/
|
||
|
virtual void addMethod(ClassDom klass);
|
||
|
|
||
|
/**Opens an "Implement Virtual Methods" dialog and adds the configured methods
|
||
|
to the sources. Define AddMethod feature if you reimplement this method.
|
||
|
@param klass The class DOM to add a virtual method to.*/
|
||
|
virtual void implementVirtualMethods(ClassDom klass);
|
||
|
|
||
|
/**Opens an "Add attribute" dialog and adds the configured attribute to the sources.
|
||
|
Define AddAttribute feature if you reimplement this method.
|
||
|
@param klass The class DOM to add an attribute to.*/
|
||
|
virtual void addAttribute(ClassDom klass);
|
||
|
|
||
|
/**
|
||
|
* Opens an "create get/set methods" dialog and adds the configured methods to the sources.
|
||
|
* Define CreateAccessMethods feature if you reimplement this method.
|
||
|
* @param theClass The class the methods should be added to.
|
||
|
* @param theVariable The attribute the access methods should be generated for.
|
||
|
*/
|
||
|
virtual void createAccessMethods(ClassDom theClass, VariableDom theVariable);
|
||
|
|
||
14 years ago
|
/**Opens an "Subclass Widget" dialog for given TQt .ui file (formName)
|
||
15 years ago
|
and propmts to implement it's slots.
|
||
|
@param formName The name of a form to subclass.
|
||
|
@return A list of newly created files.*/
|
||
15 years ago
|
virtual TQStringList subclassWidget(const TQString& formName);
|
||
15 years ago
|
|
||
14 years ago
|
/**Opens an "Update Widget" dialog for given TQt .ui file (formName)
|
||
15 years ago
|
and prompts to add missing slot implementations
|
||
|
in the subclass located in fileName.
|
||
|
@param formName The name of a form which is being subclassed.
|
||
|
@param fileName The name of a file with a subclass.
|
||
|
@return A list of updated files. Can be empty because usually no additional
|
||
|
actions are required on updated files.*/
|
||
15 years ago
|
virtual TQStringList updateWidget(const TQString& formName, const TQString& fileName);
|
||
15 years ago
|
|
||
|
/**Reimplement this method if you want to use integrated GUI designer for the language.
|
||
|
Implementation could look like (in pseudo code):
|
||
|
@code
|
||
11 years ago
|
TDevDesignerIntegration *des = 0;
|
||
15 years ago
|
switch (type)
|
||
|
{
|
||
14 years ago
|
case KInterfaceDesigner::TQtDesigner:
|
||
15 years ago
|
des = getDesignerFromCache(type);
|
||
|
if (des == 0)
|
||
|
{
|
||
|
MyLanguageImplementationWidget *impl = new MyLanguageImplementationWidget(this);
|
||
14 years ago
|
des = new TQtDesignerMyLanguageIntegration(this, impl);
|
||
15 years ago
|
des->loadSettings(*project()->projectDom(), "kdevmylangsupport/designerintegration");
|
||
|
saveDesignerToCache(type, des);
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
return des;
|
||
|
@endcode
|
||
14 years ago
|
@ref ImplementationWidget and @ref TQtDesignerIntegration classes are available
|
||
15 years ago
|
from designerintegration support library.
|
||
|
@param type The type of the designer to integrate.
|
||
|
@return The pointer to designer integration of given type or 0.*/
|
||
11 years ago
|
virtual TDevDesignerIntegration *designer(KInterfaceDesigner::DesignerType type);
|
||
15 years ago
|
|
||
|
public slots:
|
||
|
/**Adds a function requested by a GUI designer. No need to reimplement this slot
|
||
11 years ago
|
unless you want to use specific implementation of TDevDesignerIntegration interface.
|
||
15 years ago
|
@param type The type of integrated designer.
|
||
|
@param formName The name of a GUI form.
|
||
|
@param function The function to implement (add).*/
|
||
15 years ago
|
void addFunction(DesignerType type, const TQString &formName, Function function);
|
||
15 years ago
|
|
||
|
/**Removes a function requested by a GUI designer. No need to reimplement this slot
|
||
11 years ago
|
unless you want to use specific implementation of TDevDesignerIntegration interface.
|
||
15 years ago
|
@param type The type of integrated designer.
|
||
|
@param formName The name of a GUI form.
|
||
|
@param function The function to remove.*/
|
||
15 years ago
|
void removeFunction(DesignerType type, const TQString &formName, Function function);
|
||
15 years ago
|
|
||
|
/**Edits a function requested by a GUI designer. No need to reimplement this slot
|
||
11 years ago
|
unless you want to use specific implementation of TDevDesignerIntegration interface.
|
||
15 years ago
|
@param type The type of integrated designer.
|
||
|
@param formName The name of a GUI form.
|
||
|
@param oldFunction The old function signature before editing.
|
||
|
@param function The new function signature after editing.*/
|
||
15 years ago
|
void editFunction(DesignerType type, const TQString &formName, Function oldFunction, Function function);
|
||
15 years ago
|
|
||
|
/**Opens a function requested by a GUI designer. No need to reimplement this slot
|
||
11 years ago
|
unless you want to use specific implementation of TDevDesignerIntegration interface.
|
||
15 years ago
|
@param type The type of integrated designer.
|
||
|
@param formName The name of a GUI form.
|
||
|
@param functionName The name of a function to seek in the code for.*/
|
||
15 years ago
|
void openFunction(DesignerType type, const TQString &formName, const TQString &functionName);
|
||
15 years ago
|
|
||
|
/**Opens a form source requested by a GUI designer. No need to reimplement this slot
|
||
11 years ago
|
unless you want to use specific implementation of TDevDesignerIntegration interface.
|
||
15 years ago
|
@param type The type of integrated designer.
|
||
|
@param formName The name of a GUI form.*/
|
||
15 years ago
|
void openSource(DesignerType type, const TQString &formName);
|
||
15 years ago
|
|
||
|
signals:
|
||
|
/**Emitted when the content of the memory symbol store has been modified.*/
|
||
|
void updatedSourceInfo();
|
||
|
|
||
|
/**Emitted before removing the file from the memory symbol store.*/
|
||
15 years ago
|
void aboutToRemoveSourceInfo(const TQString& fileName);
|
||
15 years ago
|
|
||
|
/**Emitted when a file has been removed from the memory symbol store.*/
|
||
15 years ago
|
void removedSourceInfo(const TQString& fileName);
|
||
15 years ago
|
|
||
|
/**Emitted when a file has been added to the memory symbol store.*/
|
||
15 years ago
|
void addedSourceInfo( const TQString& fileName );
|
||
15 years ago
|
|
||
|
/**Emitted when the language part changes the Split View orientation.*/
|
||
|
void splitOrientationChanged( Qt::Orientation orientation );
|
||
|
};
|
||
|
|
||
|
#endif
|