KDevelop API Documentation

parenmatcher.h

Go to the documentation of this file.
00001  /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qt Designer.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file COPYING included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #ifndef PARENMATCHER_H
00022 #define PARENMATCHER_H
00023 
00024 #include <qstring.h>
00025 #include <qvaluelist.h>
00026 #include "dlldefs.h"
00027 
00028 class QTextCursor;
00029 
00030 struct EDITOR_EXPORT Paren
00031 {
00032     Paren() : type( Open ), chr( ' ' ), pos( -1 ) {}
00033     Paren( int t, const QChar &c, int p ) : type( (Type)t ), chr( c ), pos( p ) {}
00034     enum Type { Open, Closed };
00035     Type type;
00036     QChar chr;
00037     int pos;
00038 };
00039 
00040 typedef QValueList<Paren> ParenList;
00041 
00042 class EDITOR_EXPORT ParenMatcher
00043 {
00044 public:
00045     enum Selection {
00046     Match = 1,
00047     Mismatch
00048     };
00049 
00050     ParenMatcher();
00051 
00052     virtual bool match( QTextCursor *c );
00053 
00054     void setEnabled( bool b ) { enabled = b; }
00055 
00056 private:
00057     bool checkOpenParen( QTextCursor *c );
00058     bool checkClosedParen( QTextCursor *c );
00059 
00060     bool enabled;
00061 
00062 };
00063 
00064 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:24 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003