GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Filter.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2007, 2013 by Robert Knight <robertknight@gmail.com>
3
4 Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
5 Adoption to octave by Torsten <mttl@mailbox.org>, Copyright (c) 2017
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301 USA.
21*/
22
23// Own
24#include "unix/Filter.h"
25
26// Qt
27#include <QDesktopServices>
28#include <QAction>
29#include <QApplication>
30#include <QClipboard>
31#include <QtCore/QString>
32
33#include <QtCore/QSharedData>
34#include <QtCore>
35
36// Konsole
38
40{
41 QMutableListIterator<Filter*> iter(*this);
42
43 while ( iter.hasNext() )
44 {
45 Filter* filter = iter.next();
46 iter.remove();
47 delete filter;
48 }
49}
50
52{
53 append(filter);
54}
56{
57 removeAll(filter);
58}
60{
61 return contains(filter);
62}
64{
65 QListIterator<Filter*> iter(*this);
66 while (iter.hasNext())
67 iter.next()->reset();
68}
69void FilterChain::setBuffer(const QString* buffer , const QList<int>* linePositions)
70{
71 QListIterator<Filter*> iter(*this);
72 while (iter.hasNext())
73 iter.next()->setBuffer(buffer,linePositions);
74}
76{
77 QListIterator<Filter*> iter(*this);
78 while (iter.hasNext())
79 iter.next()->process();
80}
82{
84}
85Filter::HotSpot* FilterChain::hotSpotAt(int line , int column) const
86{
87 QListIterator<Filter*> iter(*this);
88 while (iter.hasNext())
89 {
90 Filter* filter = iter.next();
91 Filter::HotSpot* spot = filter->hotSpotAt(line,column);
92 if ( spot != nullptr )
93 {
94 return spot;
95 }
96 }
97
98 return nullptr;
99}
100
102{
104 QListIterator<Filter*> iter(*this);
105 while (iter.hasNext())
106 {
107 Filter* filter = iter.next();
108 list << filter->hotSpots();
109 }
110 return list;
111}
112
114: _buffer(nullptr)
115, _linePositions(nullptr)
116{
117}
118
120{
121 delete _buffer;
122 delete _linePositions;
123}
124
125void TerminalImageFilterChain::setImage(const Character* const image , int lines , int columns, const QVector<LineProperty>& lineProperties)
126{
127//qDebug("%s %d", __FILE__, __LINE__);
128 if (empty())
129 return;
130//qDebug("%s %d", __FILE__, __LINE__);
131
132 // reset all filters and hotspots
133 reset();
134//qDebug("%s %d", __FILE__, __LINE__);
135
136 PlainTextDecoder decoder;
137 decoder.setTrailingWhitespace(false);
138
139//qDebug("%s %d", __FILE__, __LINE__);
140 // setup new shared buffers for the filters to process on
141 QString* newBuffer = new QString();
142 QList<int>* newLinePositions = new QList<int>();
143 setBuffer( newBuffer , newLinePositions );
144
145 // free the old buffers
146 delete _buffer;
147 delete _linePositions;
148
149 _buffer = newBuffer;
150 _linePositions = newLinePositions;
151
152 QTextStream lineStream(_buffer);
153 decoder.begin(&lineStream);
154
155 for (int i=0 ; i < lines ; i++)
156 {
157 _linePositions->append(_buffer->length());
158 decoder.decodeLine(image + i*columns,columns,LINE_DEFAULT);
159
160 // pretend that each line ends with a newline character.
161 // this prevents a link that occurs at the end of one line
162 // being treated as part of a link that occurs at the start of the next line
163 //
164 // the downside is that links which are spread over more than one line are not
165 // highlighted.
166 //
167 // TODO - Use the "line wrapped" attribute associated with lines in a
168 // terminal image to avoid adding this imaginary character for wrapped
169 // lines
170 if ( !(lineProperties.value(i,LINE_DEFAULT) & LINE_WRAPPED) )
171 lineStream << QChar('\n');
172 }
173 decoder.end();
174// qDebug("%s %d", __FILE__, __LINE__);
175}
176
178_linePositions(nullptr),
179_buffer(nullptr)
180{
181}
182
184{
185 QListIterator<HotSpot*> iter(_hotspotList);
186 while (iter.hasNext())
187 {
188 delete iter.next();
189 }
190}
192{
193 _hotspots.clear();
194 _hotspotList.clear();
195}
196
197void Filter::setBuffer(const QString* buffer , const QList<int>* linePositions)
198{
199 _buffer = buffer;
200 _linePositions = linePositions;
201}
202
203void Filter::getLineColumn(int position , int& startLine , int& startColumn)
204{
205 Q_ASSERT( _linePositions );
206 Q_ASSERT( _buffer );
207
208
209 for (int i = 0 ; i < _linePositions->count() ; i++)
210 {
211 //kDebug() << "line position at " << i << " = " << _linePositions[i];
212 int nextLine = 0;
213
214 if ( i == _linePositions->count()-1 )
215 {
216 nextLine = _buffer->length() + 1;
217 }
218 else
219 {
220 nextLine = _linePositions->value(i+1);
221 }
222
223 // kDebug() << "pos - " << position << " line pos(" << i<< ") " << _linePositions->value(i) <<
224 // " next = " << nextLine << " buffer len = " << _buffer->length();
225
226 if ( _linePositions->value(i) <= position && position < nextLine )
227 {
228 startLine = i;
229 startColumn = position - _linePositions->value(i);
230 return;
231 }
232 }
233}
234
235
236/*void Filter::addLine(const QString& text)
237{
238 _linePositions << _buffer.length();
239 _buffer.append(text);
240}*/
241
242const QString* Filter::buffer()
243{
244 return _buffer;
245}
247{
248}
250{
251 _hotspotList << spot;
252
253 for (int line = spot->startLine() ; line <= spot->endLine() ; line++)
254 {
255 _hotspots.insert(line,spot);
256 }
257}
259{
260 return _hotspotList;
261}
263{
264 return _hotspots.values(line);
265}
266
267Filter::HotSpot* Filter::hotSpotAt(int line , int column) const
268{
269 QListIterator<HotSpot*> spotIter(_hotspots.values(line));
270
271 while (spotIter.hasNext())
272 {
273 HotSpot* spot = spotIter.next();
274
275 if ( spot->startLine() == line && spot->startColumn() > column )
276 continue;
277 if ( spot->endLine() == line && spot->endColumn() < column )
278 continue;
279
280 return spot;
281 }
282
283 return nullptr;
284}
285
286Filter::HotSpot::HotSpot(int startLine , int startColumn , int endLine , int endColumn)
287 : _startLine(startLine)
288 , _startColumn(startColumn)
289 , _endLine(endLine)
290 , _endColumn(endColumn)
291 , _type(NotSpecified)
292{
293}
295{
296 return QString();
297}
299{
300 return QList<QAction*>();
301}
303{
304 return _startLine;
305}
307{
308 return _endLine;
309}
311{
312 return _startColumn;
313}
315{
316 return _endColumn;
317}
319{
320 return _type;
321}
323{
324 _type = type;
325}
326
328 : _type (t)
329{
330}
331
332RegExpFilter::HotSpot::HotSpot(int startLine,int startColumn,
333 int endLine,int endColumn, Filter::Type t)
334 : Filter::HotSpot(startLine,startColumn,endLine,endColumn)
335{
336 setType(t);
337}
338
340{
341}
342
343void RegExpFilter::HotSpot::setCapturedTexts(const QStringList& texts)
344{
345 _capturedTexts = texts;
346}
348{
349 return _capturedTexts;
350}
351
352void RegExpFilter::setRegExp(const QRegExp& regExp)
353{
355}
356QRegExp RegExpFilter::regExp() const
357{
358 return _searchText;
359}
360/*void RegExpFilter::reset(int)
361{
362 _buffer = QString();
363}*/
365{
366 int pos = 0;
367 const QString* text = buffer();
368
369 Q_ASSERT( text );
370
371 // ignore any regular expressions which match an empty string.
372 // otherwise the while loop below will run indefinitely
373 static const QString emptyString("");
374 if ( _searchText.exactMatch(emptyString) )
375 return;
376
377 while(pos >= 0)
378 {
379 pos = _searchText.indexIn(*text,pos);
380
381 if ( pos >= 0 )
382 {
383
384 int startLine = 0;
385 int endLine = 0;
386 int startColumn = 0;
387 int endColumn = 0;
388
389
390 //kDebug() << "pos from " << pos << " to " << pos + _searchText.matchedLength();
391
392 getLineColumn(pos,startLine,startColumn);
393 getLineColumn(pos + _searchText.matchedLength(),endLine,endColumn);
394
395 RegExpFilter::HotSpot* spot = newHotSpot(startLine,startColumn,
396 endLine,endColumn,_type);
397 spot->setCapturedTexts(_searchText.capturedTexts());
398
399 addHotSpot( spot );
400 pos += _searchText.matchedLength();
401
402 // if matchedLength == 0, the program will get stuck in an infinite loop
403 Q_ASSERT( _searchText.matchedLength() > 0 );
404 }
405 }
406}
407
408RegExpFilter::HotSpot* RegExpFilter::newHotSpot(int startLine,int startColumn,
409 int endLine,int endColumn,
410 Filter::Type t)
411{
412 return new RegExpFilter::HotSpot(startLine,startColumn,
413 endLine,endColumn, t);
414}
415UrlFilter::HotSpot* UrlFilter::newHotSpot(int startLine,int startColumn,int endLine,
416 int endColumn, Filter::Type t)
417{
418 return new UrlFilter::HotSpot(startLine,startColumn,
419 endLine,endColumn,t);
420}
421
423{
424 int pos = 0;
425 const QString* text = buffer();
426
427 Q_ASSERT( text );
428
429 // ignore any regular expressions which match an empty string.
430 // otherwise the while loop below will run indefinitely
431 static const QString emptyString("");
432 if ( _searchText.exactMatch(emptyString) )
433 return;
434
435 while(pos >= 0)
436 {
437 pos = _searchText.indexIn(*text,pos);
438
439 if ( pos >= 0 )
440 {
441
442 int startLine = 0;
443 int endLine = 0;
444 int startColumn = 0;
445 int endColumn = 0;
446
447
448 //kDebug() << "pos from " << pos << " to " << pos + _searchText.matchedLength();
449
450 getLineColumn(pos,startLine,startColumn);
451 getLineColumn(pos + _searchText.matchedLength(),endLine,endColumn);
452
453 UrlFilter::HotSpot* spot = newHotSpot(startLine,startColumn,
454 endLine,endColumn,_type);
455 spot->setCapturedTexts(_searchText.capturedTexts());
456
457 // Connect the signal of the urlobject to the slot of the filter;
458 // the filter is then signaling to the main window
459 connect (spot->get_urlObject (),
460 SIGNAL (request_open_file_signal (const QString&, int)),
461 this, SLOT (request_open_file (const QString&, int)));
462
463 addHotSpot( spot );
464 pos += _searchText.matchedLength();
465
466 // if matchedLength == 0, the program will get stuck in an infinite loop
467 Q_ASSERT( _searchText.matchedLength() > 0 );
468 }
469 }
470}
471
472UrlFilter::HotSpot::HotSpot(int startLine,int startColumn,
473 int endLine,int endColumn,Type t)
474: RegExpFilter::HotSpot(startLine,startColumn,endLine,endColumn,t)
475, _urlObject(new FilterObject(this))
476{
477}
478
480{
481 QString url = capturedTexts().first();
482
483 const UrlType kind = urlType();
484
485 if ( kind == StandardUrl )
486 return QString();
487 else if ( kind == Email )
488 return QString();
489 else
490 return QString();
491}
493{
494 QString url = capturedTexts().first();
495
496 if ( FullUrlRegExp.exactMatch(url) )
497 return StandardUrl;
498 else if ( EmailAddressRegExp.exactMatch(url) )
499 return Email;
500 else if ( ErrorLinkRegExp.exactMatch(url) )
501 return ErrorLink;
502 else if ( ParseErrorLinkRegExp.exactMatch(url) )
503 return ParseErrorLink;
504 else
505 return Unknown;
506}
507
509{
510 QString url = capturedTexts().first();
511
512 const UrlType kind = urlType();
513
514 const QString& actionName = object ? object->objectName() : QString();
515
516 if ( actionName == "copy-action" )
517 {
518 //kDebug() << "Copying url to clipboard:" << url;
519
520 QApplication::clipboard()->setText(url);
521 return;
522 }
523
524 if ( !object || actionName == "open-action" )
525 {
526 if ( kind == StandardUrl )
527 {
528 // if the URL path does not include the protocol ( eg. "www.kde.org" ) then
529 // prepend http:// ( eg. "www.kde.org" --> "http://www.kde.org" )
530 if (!url.contains("://"))
531 url.prepend("http://");
532 QDesktopServices::openUrl (QUrl (url));
533 }
534 else if ( kind == Email )
535 {
536 url.prepend("mailto:");
537 QDesktopServices::openUrl (QUrl (url));
538 }
539 else if (kind == ErrorLink)
540 {
541 int pos = ErrorLinkRegExp.indexIn (url);
542 if (pos > -1)
543 {
544 QString file_name = ErrorLinkRegExp.cap (1);
545 QString line = ErrorLinkRegExp.cap (2);
546 // call the urlobject's method for opening a file; this
547 // method then signals to the filter
548 _urlObject->request_open_file (file_name, line.toInt ());
549 }
550 }
551 else if (kind == ParseErrorLink)
552 {
553 int pos = ParseErrorLinkRegExp.indexIn (url);
554 if (pos > -1)
555 {
556 QString line = ParseErrorLinkRegExp.cap (1);
557 QString file_name = ParseErrorLinkRegExp.cap (2);
558 // call the urlobject's method for opening a file; this
559 // method then signals to the filter
560 _urlObject->request_open_file (file_name, line.toInt ());
561 }
562 }
563
564
565 }
566
567}
568
569// Note: Altering these regular expressions can have a major effect on the performance of the filters
570// used for finding URLs in the text, especially if they are very general and could match very long
571// pieces of text.
572// Please be careful when altering them.
573
574//regexp matches:
575// full url:
576// protocolname:// or www. followed by anything other than whitespaces, <, >, ' or ", and ends before whitespaces, <, >, ', ", ], !, comma and dot
577const QRegExp UrlFilter::FullUrlRegExp("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]]");
578// email address:
579// [word chars, dots or dashes]@[word chars, dots or dashes].[word chars]
580const QRegExp UrlFilter::EmailAddressRegExp("\\b(\\w|\\.|-)+@(\\w|\\.|-)+\\.\\w+\\b");
581// matches full url or email address
582const QRegExp UrlFilter::CompleteUrlRegExp('('+FullUrlRegExp.pattern()+'|'+
583 EmailAddressRegExp.pattern()+')');
584// error link:
585// normal error
586const QRegExp UrlFilter::ErrorLinkRegExp ("(\\S+) at line (\\d+) column (?:\\d+)");
587// parse error
588const QRegExp UrlFilter::ParseErrorLinkRegExp ("parse error near line (\\d+) of file (\\S+)");
589// complete regexp
590const QRegExp UrlFilter::CompleteErrorLinkRegExp ('('+ErrorLinkRegExp.pattern ()+'|'+
591 ParseErrorLinkRegExp.pattern ()+')');
592
593
595 : RegExpFilter (t)
596{
597 if (_type == ErrorLink)
599 else
601}
603{
604 delete _urlObject;
605}
607{
608 _filter->activate(sender());
609}
611{
612 QList<QAction*> list;
613
614 const UrlType kind = urlType();
615
616 QAction* openAction = new QAction(_urlObject);
617 QAction* copyAction = new QAction(_urlObject);;
618
619 Q_ASSERT (kind == StandardUrl || kind == Email
620 || kind == ErrorLink
621 || kind == ParseErrorLink);
622
623 if ( kind == StandardUrl )
624 {
625 openAction->setText(tr ("Open Link"));
626 copyAction->setText(tr ("Copy Link Address"));
627 }
628 else if ( kind == Email )
629 {
630 openAction->setText(tr ("Send Email To..."));
631 copyAction->setText(tr ("Copy Email Address"));
632 }
633 else if ( kind == ErrorLink )
634 {
635 QString url = capturedTexts().first();
636 int pos = ErrorLinkRegExp.indexIn (url);
637 if (pos >= 0)
638 {
639 QString file_name = ErrorLinkRegExp.cap (1);
640 QString line = ErrorLinkRegExp.cap (2);
641 openAction->setText(tr ("Edit %1 at line %2")
642 .arg (file_name).arg (line));
643 }
644 }
645 else if ( kind == ParseErrorLink )
646 {
647 QString url = capturedTexts().first();
648 int pos = ParseErrorLinkRegExp.indexIn (url);
649 if (pos >= 0)
650 {
651 QString line = ParseErrorLinkRegExp.cap (1);
652 QString file_name = ParseErrorLinkRegExp.cap (2);
653 openAction->setText(tr ("Edit %1 at line %2")
654 .arg (file_name).arg (line));
655 }
656 }
657
658 // object names are set here so that the hotspot performs the
659 // correct action when activated() is called with the triggered
660 // action passed as a parameter.
661 openAction->setObjectName("open-action");
662 copyAction->setObjectName("copy-action");
663
664 QObject::connect( openAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()) );
665 list << openAction;
666
667 if (kind != ErrorLink && kind != ParseErrorLink)
668 {
669 QObject::connect ( copyAction , SIGNAL(triggered()) ,
670 _urlObject , SLOT(activated()) );
671 list << copyAction;
672 }
673 return list;
674}
675
676void
677UrlFilter::request_open_file (const QString& file, int line)
678{
679 QFileInfo file_info = QFileInfo (file);
680
681 // We have to distinguish between a parse error, where we get the full
682 // path of the file or a general error in a script, where we only get
683 // the function name. depending on this we have to invoke different
684 // slots in main_window
685 if (file_info.isAbsolute () && file_info.exists ())
686 emit request_open_file_signal (file, QString (), line);
687 else
688 emit request_edit_mfile_signal (file, line);
689}
690
691//#include "moc_Filter.cpp"
static const int LINE_WRAPPED
Definition: Character.h:37
static const int LINE_DEFAULT
Definition: Character.h:36
A single character in the terminal which consists of a unicode character value, foreground and backgr...
Definition: Character.h:56
void process()
Processes each filter in the chain.
Definition: Filter.cpp:75
bool containsFilter(Filter *filter)
Returns true if the chain contains filter.
Definition: Filter.cpp:59
void addFilter(Filter *filter)
Adds a new filter to the chain.
Definition: Filter.cpp:51
void removeFilter(Filter *filter)
Removes a filter from the chain.
Definition: Filter.cpp:55
void reset()
Resets each filter in the chain.
Definition: Filter.cpp:63
Filter::HotSpot * hotSpotAt(int line, int column) const
Returns the first hotspot which occurs at line, column or 0 if no hotspot was found.
Definition: Filter.cpp:85
virtual ~FilterChain()
Definition: Filter.cpp:39
QList< Filter::HotSpot * > hotSpots() const
Returns a list of all the hotspots in all the chain's filters.
Definition: Filter.cpp:101
void setBuffer(const QString *buffer, const QList< int > *linePositions)
Sets the buffer for each filter in the chain to process.
Definition: Filter.cpp:69
void clear()
Removes all filters from the chain.
Definition: Filter.cpp:81
void activated()
Definition: Filter.cpp:606
virtual QString tooltip() const
Returns the text of a tooltip to be shown when the mouse moves over the hotspot, or an empty string i...
Definition: Filter.cpp:294
int endLine() const
Returns the line where the hotspot area ends.
Definition: Filter.cpp:306
int startLine() const
Returns the line when the hotspot area starts.
Definition: Filter.cpp:302
virtual ~HotSpot()
Definition: Filter.cpp:246
int endColumn() const
Returns the column on endLine() where the hotspot area ends.
Definition: Filter.cpp:314
virtual QList< QAction * > actions()
Returns a list of actions associated with the hotspot which can be used in a menu or toolbar.
Definition: Filter.cpp:298
void setType(Type type)
Sets the type of a hotspot.
Definition: Filter.cpp:322
Type type() const
Returns the type of the hotspot.
Definition: Filter.cpp:318
HotSpot(int startLine, int startColumn, int endLine, int endColumn)
Constructs a new hotspot which covers the area from (startLine,startColumn) to (endLine,...
Definition: Filter.cpp:286
int startColumn() const
Returns the column on startLine() where the hotspot area starts.
Definition: Filter.cpp:310
A filter processes blocks of text looking for certain patterns (such as URLs or keywords from a list)...
Definition: Filter.h:56
QList< HotSpot * > _hotspotList
Definition: Filter.h:186
const QString * _buffer
Definition: Filter.h:189
void setBuffer(const QString *buffer, const QList< int > *linePositions)
TODO: Document me.
Definition: Filter.cpp:197
virtual ~Filter()
Definition: Filter.cpp:183
QList< HotSpot * > hotSpotsAtLine(int line) const
Returns the list of hotspots identified by the filter which occur on a given line.
Definition: Filter.cpp:262
HotSpot * hotSpotAt(int line, int column) const
Adds a new line of text to the filter and increments the line count.
Definition: Filter.cpp:267
const QString * buffer()
Returns the internal buffer.
Definition: Filter.cpp:242
QMultiHash< int, HotSpot * > _hotspots
Definition: Filter.h:185
Type
Represents an area of text which matched the pattern a particular filter has been looking for.
Definition: Filter.h:75
@ NotSpecified
Definition: Filter.h:77
@ ErrorLink
Definition: Filter.h:83
const QList< int > * _linePositions
Definition: Filter.h:188
QList< HotSpot * > hotSpots() const
Returns the list of hotspots identified by the filter.
Definition: Filter.cpp:258
Filter()
Constructs a new filter.
Definition: Filter.cpp:177
void reset()
Empties the filters internal buffer and resets the line count back to 0.
Definition: Filter.cpp:191
void getLineColumn(int position, int &startLine, int &startColumn)
Converts a character position within buffer() to a line and column.
Definition: Filter.cpp:203
void addHotSpot(HotSpot *)
Adds a new hotspot to the list.
Definition: Filter.cpp:249
A terminal character decoder which produces plain text, ignoring colours and other appearance-related...
void setTrailingWhitespace(bool enable)
Set whether trailing whitespace at the end of lines should be included in the output.
virtual void decodeLine(const Character *const characters, int count, LineProperty properties)
Converts a line of terminal characters with associated properties into a text string and writes the s...
virtual void begin(QTextStream *output)
Begin decoding characters.
virtual void end()
End decoding.
Type of hotspot created by RegExpFilter.
Definition: Filter.h:210
virtual void activate(QObject *object=nullptr)
Causes the an action associated with a hotspot to be triggered.
Definition: Filter.cpp:339
HotSpot(int startLine, int startColumn, int endLine, int endColumn, Filter::Type)
Definition: Filter.cpp:332
QStringList capturedTexts() const
Returns the texts found by the filter when matching the filter's regular expression.
Definition: Filter.cpp:347
void setCapturedTexts(const QStringList &texts)
Sets the captured texts associated with this hotspot.
Definition: Filter.cpp:343
A filter which searches for sections of text matching a regular expression and creates a new RegExpFi...
Definition: Filter.h:200
virtual void process()
Reimplemented to search the filter's text buffer for text matching regExp()
Definition: Filter.cpp:364
void setRegExp(const QRegExp &text)
Sets the regular expression which the filter searches for in blocks of text.
Definition: Filter.cpp:352
void request_edit_mfile_signal(const QString &, int)
void request_open_file_signal(const QString &, const QString &, int)
QRegExp regExp() const
Returns the regular expression which the filter searches for in blocks of text.
Definition: Filter.cpp:356
RegExpFilter(Type)
Constructs a new regular expression filter.
Definition: Filter.cpp:327
Type _type
Definition: Filter.h:257
QRegExp _searchText
Definition: Filter.h:259
virtual RegExpFilter::HotSpot * newHotSpot(int startLine, int startColumn, int endLine, int endColumn, Type)
Called when a match for the regular expression is encountered.
Definition: Filter.cpp:408
QList< int > * _linePositions
Definition: Filter.h:413
void setImage(const Character *const image, int lines, int columns, const QVector< LineProperty > &lineProperties)
Set the current terminal image to image.
Definition: Filter.cpp:125
virtual ~TerminalImageFilterChain()
Definition: Filter.cpp:119
Hotspot type created by UrlFilter instances.
Definition: Filter.h:276
FilterObject * get_urlObject()
Definition: Filter.h:291
FilterObject * _urlObject
Definition: Filter.h:304
UrlType urlType() const
Definition: Filter.cpp:492
virtual void activate(QObject *object=nullptr)
Open a web browser at the current URL.
Definition: Filter.cpp:508
virtual QString tooltip() const
Returns the text of a tooltip to be shown when the mouse moves over the hotspot, or an empty string i...
Definition: Filter.cpp:479
virtual ~HotSpot()
Definition: Filter.cpp:602
HotSpot(int startLine, int startColumn, int endLine, int endColumn, Type t)
Definition: Filter.cpp:472
virtual QList< QAction * > actions()
Returns a list of actions associated with the hotspot which can be used in a menu or toolbar.
Definition: Filter.cpp:610
void request_open_file(const QString &, int)
Definition: Filter.cpp:677
static const QRegExp FullUrlRegExp
Definition: Filter.h:319
virtual void process()
Reimplemented to search the filter's text buffer for text matching regExp()
Definition: Filter.cpp:422
UrlFilter(Type t=Link)
Definition: Filter.cpp:594
static const QRegExp CompleteUrlRegExp
Definition: Filter.h:326
static const QRegExp ErrorLinkRegExp
Definition: Filter.h:321
static const QRegExp ParseErrorLinkRegExp
Definition: Filter.h:322
virtual HotSpot * newHotSpot(int, int, int, int, Type)
Called when a match for the regular expression is encountered.
Definition: Filter.cpp:415
static const QRegExp CompleteErrorLinkRegExp
Definition: Filter.h:323
static const QRegExp EmailAddressRegExp
Definition: Filter.h:320
OCTAVE_NAMESPACE_BEGIN MArray< T > filter(MArray< T > &b, MArray< T > &a, MArray< T > &x, MArray< T > &si, int dim=0)
Definition: filter.cc:48