more cosmetic changes

This commit is contained in:
hjk
2008-12-02 14:09:21 +01:00
parent 1472bdb0cc
commit f61e8672db
262 changed files with 912 additions and 633 deletions

View File

@@ -40,6 +40,7 @@
#include <Symbols.h>
#include <AST.h>
#include <Scope.h>
#include <QByteArray>
#include <QFile>
#include <QtDebug>
@@ -47,50 +48,52 @@
using namespace CPlusPlus;
namespace {
class DocumentDiagnosticClient: public DiagnosticClient
class DocumentDiagnosticClient : public DiagnosticClient
{
enum { MAX_MESSAGE_COUNT = 10 };
public:
DocumentDiagnosticClient(Document *doc, QList<Document::DiagnosticMessage> *messages)
: doc(doc),
messages(messages)
{ }
virtual void report(int level,
StringLiteral *fileId,
unsigned line, unsigned column,
const char *format, va_list ap)
{
enum { MAX_MESSAGE_COUNT = 10 };
if (messages->count() == MAX_MESSAGE_COUNT)
return;
public:
DocumentDiagnosticClient(Document *doc, QList<Document::DiagnosticMessage> *messages)
: doc(doc),
messages(messages)
{ }
const QString fileName = QString::fromUtf8(fileId->chars(), fileId->size());
virtual void report(int level,
StringLiteral *fileId,
unsigned line, unsigned column,
const char *format, va_list ap)
{
if (messages->count() == MAX_MESSAGE_COUNT)
return;
if (fileName != doc->fileName())
return;
const QString fileName = QString::fromUtf8(fileId->chars(), fileId->size());
QString message;
message.vsprintf(format, ap);
if (fileName != doc->fileName())
return;
Document::DiagnosticMessage m(convertLevel(level), doc->fileName(),
line, column, message);
messages->append(m);
}
QString message;
message.vsprintf(format, ap);
Document::DiagnosticMessage m(convertLevel(level), doc->fileName(),
line, column, message);
messages->append(m);
static int convertLevel(int level) {
switch (level) {
case Warning: return Document::DiagnosticMessage::Warning;
case Error: return Document::DiagnosticMessage::Error;
case Fatal: return Document::DiagnosticMessage::Fatal;
default: return Document::DiagnosticMessage::Error;
}
}
static int convertLevel(int level) {
switch (level) {
case Warning: return Document::DiagnosticMessage::Warning;
case Error: return Document::DiagnosticMessage::Error;
case Fatal: return Document::DiagnosticMessage::Fatal;
default: return Document::DiagnosticMessage::Error;
}
}
Document *doc;
QList<Document::DiagnosticMessage> *messages;
};
Document *doc;
QList<Document::DiagnosticMessage> *messages;
};
} // end of anonymous namespace
} // anonymous namespace
Document::Document(const QString &fileName)
: _fileName(fileName),
@@ -116,19 +119,29 @@ Document::~Document()
}
Control *Document::control() const
{ return _control; }
{
return _control;
}
QString Document::fileName() const
{ return _fileName; }
{
return _fileName;
}
QStringList Document::includedFiles() const
{ return _includedFiles; }
{
return _includedFiles;
}
void Document::addIncludeFile(const QString &fileName)
{ _includedFiles.append(fileName); }
{
_includedFiles.append(fileName);
}
QByteArray Document::definedMacros() const
{ return _definedMacros; }
{
return _definedMacros;
}
void Document::appendMacro(const QByteArray &macroName, const QByteArray &text)
{
@@ -141,13 +154,19 @@ void Document::appendMacro(const QByteArray &macroName, const QByteArray &text)
}
TranslationUnit *Document::translationUnit() const
{ return _translationUnit; }
{
return _translationUnit;
}
bool Document::skipFunctionBody() const
{ return _translationUnit->skipFunctionBody(); }
{
return _translationUnit->skipFunctionBody();
}
void Document::setSkipFunctionBody(bool skipFunctionBody)
{ _translationUnit->setSkipFunctionBody(skipFunctionBody); }
{
_translationUnit->setSkipFunctionBody(skipFunctionBody);
}
unsigned Document::globalSymbolCount() const
{
@@ -158,7 +177,9 @@ unsigned Document::globalSymbolCount() const
}
Symbol *Document::globalSymbolAt(unsigned index) const
{ return _globalNamespace->memberAt(index); }
{
return _globalNamespace->memberAt(index);
}
Scope *Document::globalSymbols() const
{
@@ -169,10 +190,14 @@ Scope *Document::globalSymbols() const
}
Namespace *Document::globalNamespace() const
{ return _globalNamespace; }
{
return _globalNamespace;
}
Symbol *Document::findSymbolAt(unsigned line, unsigned column) const
{ return findSymbolAt(line, column, globalSymbols()); }
{
return findSymbolAt(line, column, globalSymbols());
}
Symbol *Document::findSymbolAt(unsigned line, unsigned column, Scope *scope) const
{
@@ -203,10 +228,14 @@ Document::Ptr Document::create(const QString &fileName)
}
void Document::setSource(const QByteArray &source)
{ _translationUnit->setSource(source.constBegin(), source.size()); }
{
_translationUnit->setSource(source.constBegin(), source.size());
}
void Document::startSkippingBlocks(unsigned start)
{ _skippedBlocks.append(Block(start, 0)); }
{
_skippedBlocks.append(Block(start, 0));
}
void Document::stopSkippingBlocks(unsigned stop)
{
@@ -218,10 +247,14 @@ void Document::stopSkippingBlocks(unsigned stop)
}
QSet<QByteArray> Document::macroNames() const
{ return _macroNames; }
{
return _macroNames;
}
void Document::parse()
{ _translationUnit->parse(); }
{
_translationUnit->parse();
}
void Document::check()
{
@@ -239,4 +272,6 @@ void Document::check()
}
void Document::releaseTranslationUnit()
{ _translationUnit->release(); }
{
_translationUnit->release();
}

View File

@@ -30,16 +30,18 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CPPDOCUMENT_H
#define CPPDOCUMENT_H
#include <CPlusPlusForwardDeclarations.h>
#include <QByteArray>
#include <QList>
#include <QSet>
#include <QSharedPointer>
#include <QString>
#include <QStringList>
#include <QList>
#include <QSet>
namespace CPlusPlus {

View File

@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef EXPRESSIONUNDERCURSOR_H
#define EXPRESSIONUNDERCURSOR_H

View File

@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CPLUSPLUS_ICONS_H
#define CPLUSPLUS_ICONS_H

View File

@@ -39,6 +39,7 @@
#include <Scope.h>
#include <Control.h>
#include <cplusplus/Overview.h>
#include <QFile>
#include <QtDebug>

View File

@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CPLUSPLUS_LOOKUPCONTEXT_H
#define CPLUSPLUS_LOOKUPCONTEXT_H
@@ -45,8 +46,7 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT LookupUtils
{
public:
static bool isNameCompatibleWithIdentifier(Name *name,
Identifier *id);
static bool isNameCompatibleWithIdentifier(Name *name, Identifier *id);
};
class CPLUSPLUS_EXPORT LookupContext: LookupUtils

View File

@@ -44,6 +44,7 @@
#include <CoreTypes.h>
#include <TypeVisitor.h>
#include <NameVisitor.h>
#include <QList>
#include <QtDebug>

View File

@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CPLUSPLUS_NAMEOFEXPRESSION_H
#define CPLUSPLUS_NAMEOFEXPRESSION_H

View File

@@ -30,7 +30,9 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "NamePrettyPrinter.h"
#include <Names.h>
#include <Overview.h>
#include <NameVisitor.h>
@@ -46,7 +48,9 @@ NamePrettyPrinter::~NamePrettyPrinter()
{ }
const Overview *NamePrettyPrinter::overview() const
{ return _overview; }
{
return _overview;
}
QString NamePrettyPrinter::operator()(Name *name)
{

View File

@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CPLUSPLUS_NAMEPRETTYPRINTER_H
#define CPLUSPLUS_NAMEPRETTYPRINTER_H

View File

@@ -49,25 +49,39 @@ Overview::~Overview()
{ }
bool Overview::showArgumentNames() const
{ return _showArgumentNames; }
{
return _showArgumentNames;
}
void Overview::setShowArgumentNames(bool showArgumentNames)
{ _showArgumentNames = showArgumentNames; }
{
_showArgumentNames = showArgumentNames;
}
void Overview::setShowReturnTypes(bool showReturnTypes)
{ _showReturnTypes = showReturnTypes; }
{
_showReturnTypes = showReturnTypes;
}
bool Overview::showReturnTypes() const
{ return _showReturnTypes; }
{
return _showReturnTypes;
}
void Overview::setMarkArgument(unsigned position)
{ _markArgument = position; }
{
_markArgument = position;
}
bool Overview::showFunctionSignatures() const
{ return _showFunctionSignatures; }
{
return _showFunctionSignatures;
}
void Overview::setShowFunctionSignatures(bool showFunctionSignatures)
{ _showFunctionSignatures = showFunctionSignatures; }
{
_showFunctionSignatures = showFunctionSignatures;
}
QString Overview::prettyName(Name *name) const
{
@@ -75,9 +89,10 @@ QString Overview::prettyName(Name *name) const
return pp(name);
}
QString Overview::prettyType(const FullySpecifiedType &ty,
Name *name) const
{ return prettyType(ty, prettyName(name)); }
QString Overview::prettyType(const FullySpecifiedType &ty, Name *name) const
{
return prettyType(ty, prettyName(name));
}
QString Overview::prettyType(const FullySpecifiedType &ty,
const QString &name) const

View File

@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef OVERVIEW_H
#define OVERVIEW_H

View File

@@ -33,10 +33,12 @@
#include "OverviewModel.h"
#include "Overview.h"
#include <Scope.h>
#include <Semantic.h>
#include <Literals.h>
#include <Symbols.h>
#include <QFile>
#include <QtDebug>
@@ -50,10 +52,14 @@ OverviewModel::~OverviewModel()
{ }
bool OverviewModel::hasDocument() const
{ return _cppDocument; }
{
return _cppDocument;
}
Document::Ptr OverviewModel::document() const
{ return _cppDocument; }
{
return _cppDocument;
}
unsigned OverviewModel::globalSymbolCount() const
{
@@ -124,7 +130,9 @@ int OverviewModel::rowCount(const QModelIndex &parent) const
}
int OverviewModel::columnCount(const QModelIndex &) const
{ return 1; }
{
return 1;
}
QVariant OverviewModel::data(const QModelIndex &index, int role) const
{
@@ -174,7 +182,9 @@ QVariant OverviewModel::data(const QModelIndex &index, int role) const
}
Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const
{ return static_cast<Symbol *>(index.internalPointer()); }
{
return static_cast<Symbol *>(index.internalPointer());
}
void OverviewModel::rebuild(Document::Ptr doc)
{

View File

@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CPLUSPLUS_OVERVIEWMODEL_H
#define CPLUSPLUS_OVERVIEWMODEL_H
@@ -42,7 +43,7 @@
namespace CPlusPlus {
class CPLUSPLUS_EXPORT OverviewModel: public QAbstractItemModel
class CPLUSPLUS_EXPORT OverviewModel : public QAbstractItemModel
{
Q_OBJECT

View File

@@ -44,6 +44,7 @@
#include <CoreTypes.h>
#include <TypeVisitor.h>
#include <NameVisitor.h>
#include <QList>
#include <QtDebug>

View File

@@ -30,10 +30,12 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CPLUSPLUS_RESOLVEEXPRESSION_H
#define CPLUSPLUS_RESOLVEEXPRESSION_H
#include "LookupContext.h"
#include <ASTVisitor.h>
#include <Semantic.h>
#include <FullySpecifiedType.h>

View File

@@ -32,6 +32,7 @@
***************************************************************************/
#include "SimpleLexer.h"
#include <Lexer.h>
#include <Token.h>
#include <QtDebug>
@@ -39,13 +40,19 @@
using namespace CPlusPlus;
bool SimpleToken::isLiteral() const
{ return _kind >= T_FIRST_LITERAL && _kind <= T_LAST_LITERAL; }
{
return _kind >= T_FIRST_LITERAL && _kind <= T_LAST_LITERAL;
}
bool SimpleToken::isOperator() const
{ return _kind >= T_FIRST_OPERATOR && _kind <= T_LAST_OPERATOR; }
{
return _kind >= T_FIRST_OPERATOR && _kind <= T_LAST_OPERATOR;
}
bool SimpleToken::isKeyword() const
{ return _kind >= T_FIRST_KEYWORD && _kind < T_FIRST_QT_KEYWORD; }
{
return _kind >= T_FIRST_KEYWORD && _kind < T_FIRST_QT_KEYWORD;
}
SimpleLexer::SimpleLexer()
: _lastState(0),
@@ -57,16 +64,24 @@ SimpleLexer::~SimpleLexer()
{ }
bool SimpleLexer::qtMocRunEnabled() const
{ return _qtMocRunEnabled; }
{
return _qtMocRunEnabled;
}
void SimpleLexer::setQtMocRunEnabled(bool enabled)
{ _qtMocRunEnabled = enabled; }
{
_qtMocRunEnabled = enabled;
}
bool SimpleLexer::skipComments() const
{ return _skipComments; }
{
return _skipComments;
}
void SimpleLexer::setSkipComments(bool skipComments)
{ _skipComments = skipComments; }
{
_skipComments = skipComments;
}
QList<SimpleToken> SimpleLexer::operator()(const QString &text, int state)
{

View File

@@ -34,6 +34,7 @@
#define SIMPLELEXER_H
#include <CPlusPlusForwardDeclarations.h>
#include <QString>
#include <QList>