Removed deprecated PrettyPrinter. We need a way to generate the pretty printer from the C++ parser.

This commit is contained in:
Roberto Raggi
2009-10-09 11:44:12 +02:00
parent 97c6671ea8
commit 88f3fa09be
6 changed files with 3 additions and 1344 deletions

View File

@@ -43,8 +43,8 @@
#include <Control.h>
#include <CoreTypes.h>
#include <Literals.h>
#include <PrettyPrinter.h>
#include <Semantic.h>
#include <ASTVisitor.h>
#include <SymbolVisitor.h>
#include <TranslationUnit.h>
#include <cplusplus/ExpressionUnderCursor.h>
@@ -705,34 +705,6 @@ void CPPEditor::onDocumentUpdated(Document::Ptr doc)
updateMethodBoxIndexNow();
}
void CPPEditor::reformatDocument()
{
using namespace CPlusPlus;
QByteArray source = toPlainText().toUtf8();
Control control;
StringLiteral *fileId = control.findOrInsertStringLiteral("<file>");
TranslationUnit unit(&control, fileId);
unit.setQtMocRunEnabled(true);
unit.setSource(source.constData(), source.length());
unit.parse();
if (! unit.ast())
return;
std::ostringstream s;
TranslationUnitAST *ast = unit.ast()->asTranslationUnit();
PrettyPrinter pp(&control, s);
pp(ast, source);
const std::string str = s.str();
QTextCursor c = textCursor();
c.setPosition(0);
c.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
c.insertText(QString::fromUtf8(str.c_str(), str.length()));
}
CPlusPlus::Symbol *CPPEditor::findCanonicalSymbol(const QTextCursor &cursor,
Document::Ptr doc,
const Snapshot &snapshot) const