~ubuntu-branches/ubuntu/quantal/kdevelop-php/quantal-proposed

« back to all changes in this revision

Viewing changes to duchain/navigation/magicconstantnavigationcontext.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-12-20 14:59:02 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20101220145902-a6cmovse1qmue52p
Tags: 1.1.80-0ubuntu1
* New upstream release
* Build-dep on kdevplatform >= 1.1.80
* Get rid of l10n packages, not relevant in Ubuntu, put locale files into main package

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
MagicConstantNavigationContext::MagicConstantNavigationContext(TopDUContextPointer topContext,
34
34
                                                                const SimpleCursor& position,
35
35
                                                                const QString& constant)
36
 
    : AbstractNavigationContext(topContext, 0), m_position(position), m_constant(constant)
 
36
    : AbstractNavigationContext(topContext, 0), m_position(position.line, position.column), m_constant(constant)
37
37
{
38
38
}
39
39
 
43
43
    return m_constant;
44
44
}
45
45
 
46
 
DUContext* findContext(TopDUContextPointer topCtx, const SimpleCursor& pos, DUContext::ContextType type) {
 
46
DUContext* findContext(TopDUContextPointer topCtx, const CursorInRevision& pos, DUContext::ContextType type) {
47
47
    DUContext* ctx = topCtx->findContextAt(pos);
48
48
    while ( ctx && ctx->type() != type ) {
49
49
        ctx = ctx->parentContext();
55
55
    }
56
56
}
57
57
 
58
 
QString MagicConstantNavigationContext::html(bool shorten)
 
58
QString MagicConstantNavigationContext::html(bool /*shorten*/)
59
59
{
60
60
    QString html = "<html><body><p><small><small>";
61
61
    html += typeHighlight(i18n("magic constant"));
76
76
            value = commentHighlight(i18n("empty (not inside a class)"));
77
77
        }
78
78
    } else if ( m_constant == "__METHOD__" ) {
79
 
        SimpleCursor pos = m_position;
 
79
        CursorInRevision pos = m_position;
80
80
        while ( DUContext* ctx = findContext(m_topContext, pos, DUContext::Other) ) {
81
81
            if ( !ctx->parentContext() ) {
82
82
                break;
95
95
            value = commentHighlight(i18n("empty (not inside a method)"));
96
96
        }
97
97
    } else if ( m_constant == "__FUNCTION__" ) {
98
 
        SimpleCursor pos = m_position;
 
98
        CursorInRevision pos = m_position;
99
99
        if ( DUContext* ctx = findContext(m_topContext, pos, DUContext::Other) ) {
100
100
            if ( ctx->owner() && ctx->owner()->type<FunctionType>() ) {
101
101
                value = codeHighlight(Qt::escape(ctx->localScopeIdentifier().toString()));