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

Kate

katevicommand.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE libraries and the Kate part.
00002  *
00003  *  Copyright (C) 2008 Erlend Hamberg <ehamberg@gmail.com>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  *  Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #include "katevicommand.h"
00022 
00023 KateViCommand::KateViCommand( KateViNormalMode *parent, QString pattern,
00024     bool( KateViNormalMode::*commandMethod)(), unsigned int flags )
00025 {
00026   m_parent = parent;
00027   m_pattern = KateViKeyParser::getInstance()->encodeKeySequence( pattern );
00028   m_flags = flags;
00029   m_ptr2commandMethod = commandMethod;
00030 }
00031 
00032 KateViCommand::~KateViCommand()
00033 {
00034 }
00035 
00036 bool KateViCommand::execute() const
00037 {
00038   return ( m_parent->*m_ptr2commandMethod)();
00039 }
00040 
00041 bool KateViCommand::matches( const QString &pattern ) const
00042 {
00043   if ( !( m_flags & REGEX_PATTERN ) )
00044     return m_pattern.startsWith( pattern );
00045   else {
00046     QRegExp re( m_pattern );
00047     re.exactMatch( pattern );
00048     return ( re.matchedLength() == pattern.length() );
00049   }
00050 }
00051 
00052 bool KateViCommand::matchesExact( const QString &pattern ) const
00053 {
00054   if ( !( m_flags & REGEX_PATTERN ) )
00055     return ( m_pattern == pattern );
00056   else {
00057     QRegExp re( m_pattern );
00058     return re.exactMatch( pattern );
00059   }
00060 }

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal