File indexing completed on 2021-12-21 13:15:43

0001 /* This file is part of KDevelop
0002  *
0003  * Copyright 2008-2010 Alexander Dymo <adymo@kdevelop.org>
0004  * Copyright (C) 2011-2015 Miquel Sabaté Solà <mikisabate@gmail.com>
0005  *
0006  * This program is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU General Public License as published by
0008  * the Free Software Foundation; either version 2 of the License, or
0009  * (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License along
0017  * with this program; if not, write to the Free Software Foundation, Inc.,
0018  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0019  */
0020 
0021 #ifndef RUBY_PARSE_JOB_H
0022 #define RUBY_PARSE_JOB_H
0023 
0024 #include <language/backgroundparser/parsejob.h>
0025 
0026 namespace ruby {
0027 
0028 class LanguageSupport;
0029 class Parser;
0030 
0031 /**
0032  * @class ParseJob
0033  *
0034  * This is a subclass of KDevelop::ParseJob and does the parse
0035  * job for the Ruby language.
0036  */
0037 class ParseJob : public KDevelop::ParseJob
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     enum { Rescheduled = KDevelop::TopDUContext::LastFeature };
0043 
0044     /**
0045      * Constructor.
0046      *
0047      * @param url the url of the file to parse.
0048      * @param languageSupport the ILanguageSupport of this plugin.
0049      */
0050     ParseJob(const KDevelop::IndexedString &url,
0051              KDevelop::ILanguageSupport *languageSupport);
0052     ~ParseJob() override;
0053 
0054 protected:
0055     /**
0056      * Runs this ParseJob. Both of the parameters being passed come from
0057      * ThreadWeaver and they are both ignored in the implementation.
0058      */
0059     void run(ThreadWeaver::JobPointer pointer,
0060              ThreadWeaver::Thread *thread) override;
0061 
0062 private:
0063     /**
0064      * @return static accessor to avoid casting.
0065      */
0066     LanguageSupport * ruby() const;
0067 
0068     Parser *m_parser;
0069 
0070 private:
0071     KDevelop::ReferencedTopDUContext m_duContext;
0072 };
0073 
0074 }
0075 
0076 #endif // RUBY_PARSE_JOB_H
0077