• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

cantor/src/lib

  • sources
  • kde-4.14
  • kdeedu
  • cantor
  • src
  • lib
session.cpp
Go to the documentation of this file.
1 /*
2  This program is free software; you can redistribute it and/or
3  modify it under the terms of the GNU General Public License
4  as published by the Free Software Foundation; either version 2
5  of the License, or (at your option) any later version.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor,
15  Boston, MA 02110-1301, USA.
16 
17  ---
18  Copyright (C) 2009 Alexander Rieder <alexanderrieder@gmail.com>
19  */
20 
21 #include "session.h"
22 using namespace Cantor;
23 
24 #include "backend.h"
25 
26 class Cantor::SessionPrivate
27 {
28  public:
29  SessionPrivate()
30  {
31  backend=0;
32  expressionCount=0;
33  typesettingEnabled=false;
34  }
35 
36  Backend* backend;
37  Session::Status status;
38  bool typesettingEnabled;
39  int expressionCount;
40 };
41 
42 Session::Session( Backend* backend ) : QObject(backend),
43  d(new SessionPrivate)
44 {
45  d->backend=backend;
46 }
47 
48 Session::~Session()
49 {
50  delete d;
51 }
52 
53 Expression* Session::evaluateExpression(const QString& command)
54 {
55  return evaluateExpression(command, Expression::DoNotDelete);
56 }
57 
58 Backend* Session::backend()
59 {
60  return d->backend;
61 }
62 
63 Cantor::Session::Status Session::status()
64 {
65  return d->status;
66 }
67 
68 void Session::changeStatus(Session::Status newStatus)
69 {
70  d->status=newStatus;
71  emit statusChanged(newStatus);
72 }
73 
74 void Session::setTypesettingEnabled(bool enable)
75 {
76  d->typesettingEnabled=enable;
77 }
78 
79 bool Session::isTypesettingEnabled()
80 {
81  return d->typesettingEnabled;
82 }
83 
84 CompletionObject* Session::completionFor(const QString& cmd, int index)
85 {
86  Q_UNUSED(cmd);
87  Q_UNUSED(index);
88  //Return 0 per default, so Backends not offering tab completions don't have
89  //to reimplement this. This method should only be called on backends with
90  //the Completion Capability flag
91 
92  return 0;
93 }
94 
95 SyntaxHelpObject* Session::syntaxHelpFor(const QString& cmd)
96 {
97  Q_UNUSED(cmd);
98 
99  //Return 0 per default, so Backends not offering tab completions don't have
100  //to reimplement this. This method should only be called on backends with
101  //the SyntaxHelp Capability flag
102  return 0;
103 }
104 
105 QSyntaxHighlighter* Session::syntaxHighlighter(QObject* parent)
106 {
107  Q_UNUSED(parent);
108  return 0;
109 }
110 
111 QAbstractItemModel* Session::variableModel()
112 {
113  //Return 0 per default, so Backends not offering variable management don't
114  //have to reimplement this. This method should only be called on backends with
115  //VariableManagement Capability flag
116  return 0;
117 }
118 
119 int Session::nextExpressionId()
120 {
121  return d->expressionCount++;
122 }
123 
124 #include "session.moc"
125 
Cantor::CompletionObject
This Object is used to provide a Tab Completion, in an asynchroneous way.
Definition: completionobject.h:41
Cantor::Session::~Session
~Session()
Destructor.
Definition: session.cpp:48
Cantor::Session::evaluateExpression
virtual Expression * evaluateExpression(const QString &command, Expression::FinishingBehavior finishingBehavior)=0
Passes the given command to the backend and returns a Pointer to a new Expression object...
session.h
Cantor::Session::backend
Backend * backend()
Returns the Backend, this Session is for.
Definition: session.cpp:58
Cantor::Expression
An Expression object is used, to store the information needed when running a command of a Session Eva...
Definition: expression.h:49
QSyntaxHighlighter
Cantor::Session::changeStatus
void changeStatus(Cantor::Session::Status newStatus)
Change the status of the Session.
Definition: session.cpp:68
Cantor::Session::nextExpressionId
int nextExpressionId()
Returns the next available Expression id It is basically a counter, incremented for each new Expressi...
Definition: session.cpp:119
QObject
Cantor::Session::syntaxHelpFor
virtual SyntaxHelpObject * syntaxHelpFor(const QString &cmd)
Returns Syntax help, for this command.
Definition: session.cpp:95
Cantor::Session::Session
Session(Backend *backend)
Create a new Session.
Definition: session.cpp:42
Cantor::Session::Status
Status
Definition: session.h:54
QString
Cantor::Expression::DoNotDelete
This Expression will not be deleted. This is the normal behaviour.
Definition: expression.h:63
Cantor::Session::statusChanged
void statusChanged(Cantor::Session::Status newStatus)
Cantor::SyntaxHelpObject
Object, used to display Syntax informtion to a given command It is designed for asynchroneous use...
Definition: syntaxhelpobject.h:39
Cantor::Session::setTypesettingEnabled
virtual void setTypesettingEnabled(bool enable)
Enables/disables Typesetting for this session.
Definition: session.cpp:74
Cantor::Session::isTypesettingEnabled
bool isTypesettingEnabled()
Returns wether typesetting is enabled or not.
Definition: session.cpp:79
Cantor::Session::variableModel
virtual QAbstractItemModel * variableModel()
returns a Model to interact with the variables
Definition: session.cpp:111
Cantor::Session::status
Cantor::Session::Status status()
Returns the status this Session has.
Definition: session.cpp:63
QAbstractItemModel
backend.h
Cantor::Backend
The Backend class provides access to information about the backend.
Definition: backend.h:52
Cantor::Session::syntaxHighlighter
virtual QSyntaxHighlighter * syntaxHighlighter(QObject *parent)
returns a syntax highlighter for this session
Definition: session.cpp:105
Cantor::Session::completionFor
virtual CompletionObject * completionFor(const QString &cmd, int index=-1)
Returns tab-completion, for this command/command-part.
Definition: session.cpp:84
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

cantor/src/lib

Skip menu "cantor/src/lib"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal