CppTools: moved some logic to ProjectFile

Simplifies code and makes it independent from mimetype names.

Change-Id: Ib56a07654df4986b1916c517e3862e6c3a3dd720
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Sergey Shambir
2013-03-27 10:32:28 +04:00
committed by Erik Verbruggen
parent d61bc4fcec
commit 0609333e02
7 changed files with 99 additions and 91 deletions

View File

@@ -33,8 +33,8 @@
#include "watchutils.h"
#include <texteditor/basetexteditor.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/abstracteditorsupport.h>
#include <cpptools/cppprojectfile.h>
#include <cpptools/ModelManagerInterface.h>
#include <cplusplus/ExpressionUnderCursor.h>
@@ -314,15 +314,11 @@ bool getUninitializedVariables(const CPlusPlus::Snapshot &snapshot,
// Editor tooltip support
bool isCppEditor(Core::IEditor *editor)
{
using namespace CppTools::Constants;
const Core::IDocument *document= editor->document();
if (!document)
return false;
const QByteArray mimeType = document->mimeType().toLatin1();
return mimeType == C_SOURCE_MIMETYPE
|| mimeType == CPP_SOURCE_MIMETYPE
|| mimeType == CPP_HEADER_MIMETYPE
|| mimeType == OBJECTIVE_CPP_SOURCE_MIMETYPE;
return CppTools::ProjectFile::classify(document->fileName()) != CppTools::ProjectFile::Unclassified;
}
// Return the Cpp expression, and, if desired, the function
@@ -330,7 +326,6 @@ QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
int *line, int *column, QString *function /* = 0 */)
{
using namespace CppTools;
using namespace CPlusPlus;
*line = *column = 0;
if (function)
function->clear();