KDevelop API Documentation

simple_indent.cpp

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 
00022 /* $Id: simple_indent.cpp,v 1.11 2002/12/19 22:02:39 raggi Exp $
00023  *
00024  *  This file is part of Klint
00025  *  Copyright (C) 2001 Roberto Raggi (roberto@kdevelop.org)
00026  *
00027  *  This program is free software; you can redistribute it and/or
00028  *  modify it under the terms of the GNU General Public
00029  *  License as published by the Free Software Foundation; either
00030  *  version 2 of the License, or (at your option) any later version.
00031  *
00032  *  This program is distributed in the hope that it will be useful,
00033  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00034  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00035  *  General Public License for more details.
00036  *
00037  *  You should have received a copy of the GNU General Public License
00038  *  along with this program; see the file COPYING.LIB.  If not, write to
00039  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00040  *  Boston, MA 02111-1307, USA.
00041  *
00042  */
00043 
00044 
00045 #include "qeditor_view.h"
00046 #include "simple_indent.h"
00047 #include "qsourcecolorizer.h"
00048 #include "paragdata.h"
00049 #include "qeditor.h"
00050 
00051 #include <kdebug.h>
00052 
00053 SimpleIndent::SimpleIndent( QEditor* ed )
00054     : QEditorIndenter( ed )
00055 {
00056 
00057 }
00058 
00059 SimpleIndent::~SimpleIndent()
00060 {
00061 
00062 }
00063 
00064 int SimpleIndent::indentForLine( int line )
00065 {
00066     int ind = 0;
00067 
00068     --line;
00069     while( line>=0 ){
00070         QString raw_text = editor()->text( line );
00071         if( !raw_text.stripWhiteSpace().isEmpty() ){
00072             ind = indentation( raw_text );
00073             break;
00074         }
00075     --line;
00076     }
00077     return ind;
00078 }
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