File indexing completed on 2024-04-14 05:36:52

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef LANGUAGEMANAGER_H
0012 #define LANGUAGEMANAGER_H
0013 
0014 #include <QList>
0015 #include <QObject>
0016 
0017 #include "language.h"
0018 #include "logview.h"
0019 
0020 class FlowCode;
0021 class Gpasm;
0022 class Gpdasm;
0023 class KTechlab;
0024 class Language;
0025 class LanguageManager;
0026 class MessageInfo;
0027 class Microbe;
0028 class ProcessChain;
0029 class ProcessListChain;
0030 class ProcessOptions;
0031 namespace KateMDI
0032 {
0033 class ToolView;
0034 }
0035 
0036 /**
0037 @author David Saxton
0038 */
0039 class LanguageManager : public QObject
0040 {
0041     Q_OBJECT
0042 public:
0043     static LanguageManager *self(KateMDI::ToolView *parent = nullptr);
0044     static QString toolViewIdentifier()
0045     {
0046         return "LanguageManager";
0047     }
0048     ~LanguageManager() override;
0049 
0050     /**
0051      * Call to compile a file of one type all the way to another type, this can
0052      * also be used in reverse to disassemble code. Connect to the returned
0053      * ProcessChain for notification of compile success / failure
0054      * @return Pointer to the ProcessChain used to compile
0055      */
0056     ProcessChain *compile(ProcessOptions options);
0057     ProcessListChain *compile(ProcessOptionsList pol);
0058     /**
0059      * @return Pointer to the LogView that displays the output messages
0060      */
0061     LogView *logView() const
0062     {
0063         return m_logView;
0064     }
0065     /**
0066      * Clear any errors and clear the log view
0067      */
0068     void reset();
0069 
0070 public slots:
0071     /**
0072      * Called when the user clicks on any text in the LogView
0073      */
0074     void slotParaClicked(const QString &message, MessageInfo messageInfo);
0075     /**
0076      * Called by languages to report an error message
0077      * @param error Error message to report
0078      */
0079     void slotError(const QString &error, MessageInfo messageInfo);
0080     /**
0081      * Called by languages to report a warning message
0082      * @param warning Warning message to report
0083      */
0084     void slotWarning(const QString &warning, MessageInfo messageInfo);
0085     /**
0086      * Called by languages to report a general message
0087      * @param message General message to report
0088      */
0089     void slotMessage(const QString &message, MessageInfo messageInfo);
0090 
0091 protected:
0092     LanguageManager(KateMDI::ToolView *parent);
0093 
0094 private:
0095     LogView *m_logView;
0096     static LanguageManager *m_pSelf;
0097 };
0098 
0099 #endif