File indexing completed on 2024-04-21 04:34:27

0001 /***************************************************************************
0002  *   This file is part of KDevelop                                         *
0003  *   Copyright 2010 Niko Sams <niko.sams@gmail.com>                        *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU Library General Public License as       *
0007  *   published by the Free Software Foundation; either version 2 of the    *
0008  *   License, or (at your option) any later version.                       *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU Library General Public     *
0016  *   License along with this program; if not, write to the                 *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0019  ***************************************************************************/
0020 
0021 #ifndef CSS_HTMLPARSER_H
0022 #define CSS_HTMLPARSER_H
0023 
0024 #include <QString>
0025 #include <KTextEditor/Range>
0026 
0027 #include "parserexport.h"
0028 
0029 namespace Css {
0030 
0031 class KDEVCSSPARSER_EXPORT HtmlParser
0032 {
0033 public:
0034     HtmlParser();
0035     void setContents(const QString& contents);
0036 
0037     struct Part {
0038         enum Kind {
0039             Standalone,
0040             StyleElement,
0041             InlineStyle
0042         };
0043         Kind kind;
0044         KTextEditor::Range range;
0045         QString contents;
0046         QString tag; //only for InlineStyle
0047     };
0048     QList<Part> parse();
0049 
0050 private:
0051     QString m_contents;
0052 };
0053 
0054 }
0055 
0056 #endif // CSS_HTMLPARSER_H