Commit 57a1a4d6 authored by dt's avatar dt
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 94280509 907ab960
......@@ -399,17 +399,17 @@ static void addDeclaration(const QString &docFileName, const Class *cl, const QS
if (const Declaration *decl = cl->memberAt(j)->asDeclaration())
if (const Function *fun = decl->type()->asFunctionType()) {
// we are only interested in declarations of methods.
// fun->column() returns always 0, what can cause trouble in case in one
// line if there is: "private slots: void foo();"
if (fun->isSlot() && fun->isPrivate()) {
const int line = fun->line(); // [1..n]
const int line = fun->line(); // this is the beginning of function name: "void ^foo(...)"
const int column = fun->column();
if (ITextEditable *editable = editableAt(docFileName, line, column)) {
// Figure out indentation (symbol - len("void ")) and insert after
editable->gotoLine(line + 1, 1);
unsigned dl, dc; // this position is the beginning of return value: "^void foo(...)"
decl->getStartPosition(&dl, &dc);
dc--; // if the first character in line is 'v' comming from "void" getStartPosition returns 1, not 0, so we always decrement it.
editable->gotoLine(dl, dc);
editable->position(ITextEditor::StartOfLine);
const QString indentation = QString(qMax(0, column - 6), QLatin1Char(' '));
editable->insert(indentation + declaration);
const QString indentation = QString(dc, QLatin1Char(' '));
editable->insert(declaration + indentation);
}
return;
}
......
......@@ -247,13 +247,13 @@ StringLiteral *Symbol::fileId() const
return fileId;
}
void Symbol::getPosition(unsigned *line, unsigned *column, StringLiteral **fileId)
void Symbol::getPosition(unsigned *line, unsigned *column, StringLiteral **fileId) const
{ translationUnit()->getPosition(_sourceOffset, line, column, fileId); }
void Symbol::getStartPosition(unsigned *line, unsigned *column, StringLiteral **fileId)
void Symbol::getStartPosition(unsigned *line, unsigned *column, StringLiteral **fileId) const
{ translationUnit()->getPosition(_startOffset, line, column, fileId); }
void Symbol::getEndPosition(unsigned *line, unsigned *column, StringLiteral **fileId)
void Symbol::getEndPosition(unsigned *line, unsigned *column, StringLiteral **fileId) const
{ translationUnit()->getPosition(_endOffset, line, column, fileId); }
const char *Symbol::fileName() const
......
......@@ -115,9 +115,9 @@ public:
unsigned endOffset() const;
void setEndOffset(unsigned offset);
void getPosition(unsigned *line, unsigned *column = 0, StringLiteral **fileId = 0);
void getStartPosition(unsigned *line, unsigned *column = 0, StringLiteral **fileId = 0);
void getEndPosition(unsigned *line, unsigned *column = 0, StringLiteral **fileId = 0);
void getPosition(unsigned *line, unsigned *column = 0, StringLiteral **fileId = 0) const;
void getStartPosition(unsigned *line, unsigned *column = 0, StringLiteral **fileId = 0) const;
void getEndPosition(unsigned *line, unsigned *column = 0, StringLiteral **fileId = 0) const;
/// Returns this Symbol's name.
Name *name() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment