Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Schöps
kdevelop
Commits
95d32c7e
Commit
95d32c7e
authored
Jun 26, 2019
by
Friedrich W. H. Kossebau
Browse files
kdevplatform/language/duchain: use Q_DECLARE_PRIVATE/Q_D to forward constness to d
parent
bd27f864
Changes
26
Hide whitespace changes
Inline
Side-by-side
kdevplatform/language/duchain/codemodel.cpp
View file @
95d32c7e
...
...
@@ -180,10 +180,12 @@ public:
{
}
//Maps declaration-ids to items
ItemRepository
<
CodeModelRepositoryItem
,
CodeModelRequestItem
>
m_repository
;
// mutable as things like findIndex are not const
mutable
ItemRepository
<
CodeModelRepositoryItem
,
CodeModelRequestItem
>
m_repository
;
};
CodeModel
::
CodeModel
()
:
d
(
new
CodeModelPrivate
())
CodeModel
::
CodeModel
()
:
d_ptr
(
new
CodeModelPrivate
())
{
}
...
...
@@ -191,6 +193,8 @@ CodeModel::~CodeModel() = default;
void
CodeModel
::
addItem
(
const
IndexedString
&
file
,
const
IndexedQualifiedIdentifier
&
id
,
CodeModelItem
::
Kind
kind
)
{
Q_D
(
CodeModel
);
ifDebug
(
qCDebug
(
LANGUAGE
)
<<
"addItem"
<<
file
.
str
()
<<
id
.
identifier
().
toString
()
<<
id
.
index
;
)
if
(
!
id
.
isValid
())
...
...
@@ -257,6 +261,8 @@ void CodeModel::addItem(const IndexedString& file, const IndexedQualifiedIdentif
void
CodeModel
::
updateItem
(
const
IndexedString
&
file
,
const
IndexedQualifiedIdentifier
&
id
,
CodeModelItem
::
Kind
kind
)
{
Q_D
(
CodeModel
);
ifDebug
(
qCDebug
(
LANGUAGE
)
<<
file
.
str
()
<<
id
.
identifier
().
toString
()
<<
kind
;
)
if
(
!
id
.
isValid
())
...
...
@@ -297,6 +303,8 @@ void CodeModel::updateItem(const IndexedString& file, const IndexedQualifiedIden
void
CodeModel
::
removeItem
(
const
IndexedString
&
file
,
const
IndexedQualifiedIdentifier
&
id
)
//void CodeModel::removeDeclaration(const QualifiedIdentifier& id, const IndexedDeclaration& declaration)
{
Q_D
(
CodeModel
);
if
(
!
id
.
isValid
())
return
;
...
...
@@ -357,6 +365,8 @@ void CodeModel::removeItem(const IndexedString& file, const IndexedQualifiedIden
void
CodeModel
::
items
(
const
IndexedString
&
file
,
uint
&
count
,
const
CodeModelItem
*&
items
)
const
{
Q_D
(
const
CodeModel
);
ifDebug
(
qCDebug
(
LANGUAGE
)
<<
"items"
<<
file
.
str
();
)
CodeModelRepositoryItem
item
;
...
...
kdevplatform/language/duchain/codemodel.h
View file @
95d32c7e
...
...
@@ -30,6 +30,7 @@ class DeclarationId;
class
TopDUContext
;
class
QualifiedIdentifier
;
class
IndexedString
;
class
CodeModelPrivate
;
struct
CodeModelItem
{
...
...
@@ -94,7 +95,8 @@ public:
static
CodeModel
&
self
();
private:
const
QScopedPointer
<
class
CodeModelPrivate
>
d
;
const
QScopedPointer
<
class
CodeModelPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
CodeModel
)
};
}
...
...
kdevplatform/language/duchain/definitions.cpp
View file @
95d32c7e
...
...
@@ -154,10 +154,12 @@ public:
{
}
//Maps declaration-ids to definitions
ItemRepository
<
DefinitionsItem
,
DefinitionsRequestItem
>
m_definitions
;
// mutable as things like findIndex are not const
mutable
ItemRepository
<
DefinitionsItem
,
DefinitionsRequestItem
>
m_definitions
;
};
Definitions
::
Definitions
()
:
d
(
new
DefinitionsPrivate
())
Definitions
::
Definitions
()
:
d_ptr
(
new
DefinitionsPrivate
())
{
}
...
...
@@ -165,6 +167,8 @@ Definitions::~Definitions() = default;
void
Definitions
::
addDefinition
(
const
DeclarationId
&
id
,
const
IndexedDeclaration
&
definition
)
{
Q_D
(
Definitions
);
DefinitionsItem
item
;
item
.
declaration
=
id
;
item
.
definitionsList
().
append
(
definition
);
...
...
@@ -190,6 +194,8 @@ void Definitions::addDefinition(const DeclarationId& id, const IndexedDeclaratio
void
Definitions
::
removeDefinition
(
const
DeclarationId
&
id
,
const
IndexedDeclaration
&
definition
)
{
Q_D
(
Definitions
);
DefinitionsItem
item
;
item
.
declaration
=
id
;
DefinitionsRequestItem
request
(
item
);
...
...
@@ -214,6 +220,8 @@ void Definitions::removeDefinition(const DeclarationId& id, const IndexedDeclara
KDevVarLengthArray
<
IndexedDeclaration
>
Definitions
::
definitions
(
const
DeclarationId
&
id
)
const
{
Q_D
(
const
Definitions
);
KDevVarLengthArray
<
IndexedDeclaration
>
ret
;
DefinitionsItem
item
;
...
...
@@ -233,6 +241,8 @@ KDevVarLengthArray<IndexedDeclaration> Definitions::definitions(const Declaratio
void
Definitions
::
dump
(
const
QTextStream
&
out
)
{
Q_D
(
Definitions
);
QMutexLocker
lock
(
d
->
m_definitions
.
mutex
());
DefinitionsVisitor
v
(
this
,
out
);
d
->
m_definitions
.
visitAllItems
(
v
);
...
...
kdevplatform/language/duchain/definitions.h
View file @
95d32c7e
...
...
@@ -32,6 +32,7 @@ class Declaration;
class
IndexedDeclaration
;
class
DeclarationId
;
class
TopDUContext
;
class
DefinitionsPrivate
;
/**
* Global mapping of one Declaration-Ids to multiple Definitions, protected through DUChainLock.
...
...
@@ -57,7 +58,8 @@ public:
void
dump
(
const
QTextStream
&
out
);
private:
const
QScopedPointer
<
class
DefinitionsPrivate
>
d
;
const
QScopedPointer
<
class
DefinitionsPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
Definitions
)
};
}
...
...
kdevplatform/language/duchain/duchaindumper.cpp
View file @
95d32c7e
...
...
@@ -84,8 +84,10 @@ public:
};
DUChainDumper
::
DUChainDumper
(
Features
features
)
:
d
(
new
DUChainDumperPrivate
)
:
d
_ptr
(
new
DUChainDumperPrivate
)
{
Q_D
(
DUChainDumper
);
d
->
m_features
=
features
;
}
...
...
@@ -199,6 +201,8 @@ void DUChainDumperPrivate::dump(DUContext* context, int allowedDepth, bool isFro
void
DUChainDumper
::
dump
(
DUContext
*
context
,
int
allowedDepth
,
QTextStream
&
out
)
{
Q_D
(
DUChainDumper
);
d
->
m_visitedContexts
.
clear
();
if
(
!
context
)
{
...
...
kdevplatform/language/duchain/duchaindumper.h
View file @
95d32c7e
...
...
@@ -32,6 +32,7 @@ class QTextStream;
namespace
KDevelop
{
class
DUContext
;
class
DUChainDumperPrivate
;
/**
* @brief Debugging utility function to dump a DUContext including contained declarations.
...
...
@@ -62,7 +63,8 @@ public:
void
dump
(
DUContext
*
context
,
int
allowedDepth
,
QTextStream
&
out
);
private:
const
QScopedPointer
<
class
DUChainDumperPrivate
>
d
;
const
QScopedPointer
<
class
DUChainDumperPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
DUChainDumper
)
};
}
#endif // KDEVPLATFORM_DUCHAINDUMPER_H
kdevplatform/language/duchain/duchainlock.cpp
View file @
95d32c7e
...
...
@@ -67,7 +67,7 @@ public:
};
DUChainLock
::
DUChainLock
()
:
d
(
new
DUChainLockPrivate
)
:
d
_ptr
(
new
DUChainLockPrivate
)
{
}
...
...
@@ -75,6 +75,8 @@ DUChainLock::~DUChainLock() = default;
bool
DUChainLock
::
lockForRead
(
unsigned
int
timeout
)
{
Q_D
(
DUChainLock
);
///Step 1: Increase the own reader-recursion. This will make sure no further write-locks will succeed
d
->
changeOwnReaderRecursion
(
1
);
...
...
@@ -105,16 +107,22 @@ bool DUChainLock::lockForRead(unsigned int timeout)
void
DUChainLock
::
releaseReadLock
()
{
Q_D
(
DUChainLock
);
d
->
changeOwnReaderRecursion
(
-
1
);
}
bool
DUChainLock
::
currentThreadHasReadLock
()
{
Q_D
(
DUChainLock
);
return
(
bool
)
d
->
ownReaderRecursion
();
}
bool
DUChainLock
::
lockForWrite
(
uint
timeout
)
{
Q_D
(
DUChainLock
);
//It is not allowed to acquire a write-lock while holding read-lock
Q_ASSERT
(
d
->
ownReaderRecursion
()
==
0
);
...
...
@@ -158,6 +166,8 @@ bool DUChainLock::lockForWrite(uint timeout)
void
DUChainLock
::
releaseWriteLock
()
{
Q_D
(
DUChainLock
);
Q_ASSERT
(
currentThreadHasWriteLock
());
//The order is important here, m_writerRecursion protects m_writer
...
...
@@ -171,8 +181,10 @@ void DUChainLock::releaseWriteLock()
}
}
bool
DUChainLock
::
currentThreadHasWriteLock
()
bool
DUChainLock
::
currentThreadHasWriteLock
()
const
{
Q_D
(
const
DUChainLock
);
return
d
->
m_writer
.
load
()
==
QThread
::
currentThread
();
}
...
...
kdevplatform/language/duchain/duchainlock.h
View file @
95d32c7e
...
...
@@ -24,6 +24,7 @@
namespace
KDevelop
{
// #define NO_DUCHAIN_LOCK_TESTING
class
DUChainLockPrivate
;
/**
* Macros for ensuring the DUChain is locked properly.
...
...
@@ -100,10 +101,11 @@ public:
/**
* Determines if the current thread has a write lock.
*/
bool
currentThreadHasWriteLock
();
bool
currentThreadHasWriteLock
()
const
;
private:
const
QScopedPointer
<
class
DUChainLockPrivate
>
d
;
const
QScopedPointer
<
class
DUChainLockPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
DUChainLock
)
};
/**
...
...
kdevplatform/language/duchain/dumpdotgraph.cpp
View file @
95d32c7e
...
...
@@ -53,13 +53,16 @@ public:
QString
DumpDotGraph
::
dotGraph
(
KDevelop
::
DUContext
*
context
,
bool
shortened
)
{
Q_D
(
DumpDotGraph
);
d
->
m_hadObjects
.
clear
();
d
->
m_hadVersions
.
clear
();
d
->
m_topContext
=
context
->
topContext
();
///@todo maybe get this as a parameter
return
d
->
dotGraphInternal
(
context
,
true
,
shortened
);
}
DumpDotGraph
::
DumpDotGraph
()
:
d
(
new
DumpDotGraphPrivate
())
DumpDotGraph
::
DumpDotGraph
()
:
d_ptr
(
new
DumpDotGraphPrivate
())
{
}
...
...
kdevplatform/language/duchain/dumpdotgraph.h
View file @
95d32c7e
...
...
@@ -23,6 +23,9 @@ class QString;
namespace
KDevelop
{
class
TopDUContext
;
class
DUContext
;
class
DumpDotGraphPrivate
;
/**
* A helper-class for debugging, that nicely visualizes the whole structure of a du-context.
* */
...
...
@@ -41,7 +44,8 @@ public:
QString
dotGraph
(
KDevelop
::
DUContext
*
context
,
bool
shortened
=
false
);
private:
const
QScopedPointer
<
class
DumpDotGraphPrivate
>
d
;
const
QScopedPointer
<
class
DumpDotGraphPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
DumpDotGraph
)
};
}
...
...
kdevplatform/language/duchain/importers.cpp
View file @
95d32c7e
...
...
@@ -120,10 +120,12 @@ public:
{
}
//Maps declaration-ids to Importers
ItemRepository
<
ImportersItem
,
ImportersRequestItem
>
m_importers
;
// mutable as things like findIndex are not const
mutable
ItemRepository
<
ImportersItem
,
ImportersRequestItem
>
m_importers
;
};
Importers
::
Importers
()
:
d
(
new
ImportersPrivate
())
Importers
::
Importers
()
:
d_ptr
(
new
ImportersPrivate
())
{
}
...
...
@@ -131,6 +133,8 @@ Importers::~Importers() = default;
void
Importers
::
addImporter
(
const
DeclarationId
&
id
,
const
IndexedDUContext
&
use
)
{
Q_D
(
Importers
);
ImportersItem
item
;
item
.
declaration
=
id
;
item
.
importersList
().
append
(
use
);
...
...
@@ -156,6 +160,8 @@ void Importers::addImporter(const DeclarationId& id, const IndexedDUContext& use
void
Importers
::
removeImporter
(
const
DeclarationId
&
id
,
const
IndexedDUContext
&
use
)
{
Q_D
(
Importers
);
ImportersItem
item
;
item
.
declaration
=
id
;
ImportersRequestItem
request
(
item
);
...
...
@@ -180,6 +186,8 @@ void Importers::removeImporter(const DeclarationId& id, const IndexedDUContext&
KDevVarLengthArray
<
IndexedDUContext
>
Importers
::
importers
(
const
DeclarationId
&
id
)
const
{
Q_D
(
const
Importers
);
KDevVarLengthArray
<
IndexedDUContext
>
ret
;
ImportersItem
item
;
...
...
kdevplatform/language/duchain/importers.h
View file @
95d32c7e
...
...
@@ -27,6 +27,7 @@
namespace
KDevelop
{
class
DeclarationId
;
class
IndexedDUContext
;
class
ImportersPrivate
;
/**
* Global mapping of Declaration-Ids to contexts that import the associated context, protected through DUChainLock.
...
...
@@ -59,7 +60,8 @@ public:
static
Importers
&
self
();
private:
const
QScopedPointer
<
class
ImportersPrivate
>
d
;
const
QScopedPointer
<
class
ImportersPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
Importers
)
};
}
...
...
kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp
View file @
95d32c7e
...
...
@@ -56,8 +56,10 @@ AbstractDeclarationNavigationContext::AbstractDeclarationNavigationContext(const
AbstractNavigationContext
*
previousContext
)
:
AbstractNavigationContext
((
topContext
?
topContext
:
TopDUContextPointer
(
decl
?
decl
->
topContext
()
:
nullptr
)),
previousContext
)
,
d
(
new
AbstractDeclarationNavigationContextPrivate
)
,
d
_ptr
(
new
AbstractDeclarationNavigationContextPrivate
)
{
Q_D
(
AbstractDeclarationNavigationContext
);
d
->
m_declaration
=
decl
;
//Jump from definition to declaration if possible
...
...
@@ -72,6 +74,8 @@ AbstractDeclarationNavigationContext::~AbstractDeclarationNavigationContext()
QString
AbstractDeclarationNavigationContext
::
name
()
const
{
Q_D
(
const
AbstractDeclarationNavigationContext
);
if
(
d
->
m_declaration
.
data
())
return
prettyQualifiedIdentifier
(
d
->
m_declaration
).
toString
();
else
...
...
@@ -80,6 +84,8 @@ QString AbstractDeclarationNavigationContext::name() const
QString
AbstractDeclarationNavigationContext
::
html
(
bool
shorten
)
{
Q_D
(
AbstractDeclarationNavigationContext
);
DUChainReadLocker
lock
(
DUChain
::
lock
(),
300
);
if
(
!
lock
.
locked
())
{
return
{};
...
...
@@ -374,6 +380,8 @@ AbstractType::Ptr AbstractDeclarationNavigationContext::typeToShow(AbstractType:
void
AbstractDeclarationNavigationContext
::
htmlFunction
()
{
Q_D
(
AbstractDeclarationNavigationContext
);
const
auto
*
function
=
dynamic_cast
<
const
AbstractFunctionDeclaration
*>
(
d
->
m_declaration
.
data
());
Q_ASSERT
(
function
);
...
...
@@ -468,6 +476,8 @@ QString AbstractDeclarationNavigationContext::prettyQualifiedName(const Declarat
void
AbstractDeclarationNavigationContext
::
htmlAdditionalNavigation
()
{
Q_D
(
AbstractDeclarationNavigationContext
);
///Check if the function overrides or hides another one
const
auto
*
classFunDecl
=
dynamic_cast
<
const
ClassFunctionDeclaration
*>
(
d
->
m_declaration
.
data
());
...
...
@@ -582,6 +592,8 @@ void AbstractDeclarationNavigationContext::createFullBackwardSearchLink(const QS
NavigationContextPointer
AbstractDeclarationNavigationContext
::
executeKeyAction
(
const
QString
&
key
)
{
Q_D
(
AbstractDeclarationNavigationContext
);
if
(
key
==
QLatin1String
(
"m_fullBackwardSearch=true"
))
{
d
->
m_fullBackwardSearch
=
true
;
clear
();
...
...
@@ -591,6 +603,8 @@ NavigationContextPointer AbstractDeclarationNavigationContext::executeKeyAction(
void
AbstractDeclarationNavigationContext
::
htmlClass
()
{
Q_D
(
AbstractDeclarationNavigationContext
);
StructureType
::
Ptr
klass
=
d
->
m_declaration
->
abstractType
().
cast
<
StructureType
>
();
Q_ASSERT
(
klass
);
...
...
@@ -719,6 +733,8 @@ void AbstractDeclarationNavigationContext::eventuallyMakeTypeLinks(AbstractType:
DeclarationPointer
AbstractDeclarationNavigationContext
::
declaration
()
const
{
Q_D
(
const
AbstractDeclarationNavigationContext
);
return
d
->
m_declaration
;
}
...
...
kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.h
View file @
95d32c7e
...
...
@@ -28,6 +28,7 @@ namespace KDevelop {
class
IdentifiedType
;
class
Identifier
;
class
QualifiedIdentifier
;
class
AbstractDeclarationNavigationContextPrivate
;
class
KDEVPLATFORMLANGUAGE_EXPORT
AbstractDeclarationNavigationContext
:
public
AbstractNavigationContext
...
...
@@ -90,7 +91,8 @@ protected:
void
createFullBackwardSearchLink
(
const
QString
&
string
);
private:
const
QScopedPointer
<
class
AbstractDeclarationNavigationContextPrivate
>
d
;
const
QScopedPointer
<
class
AbstractDeclarationNavigationContextPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
AbstractDeclarationNavigationContext
)
};
}
...
...
kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp
View file @
95d32c7e
...
...
@@ -63,18 +63,24 @@ public:
void
AbstractNavigationContext
::
setTopContext
(
const
TopDUContextPointer
&
context
)
{
Q_D
(
AbstractNavigationContext
);
d
->
m_topContext
=
context
;
}
TopDUContextPointer
AbstractNavigationContext
::
topContext
()
const
{
Q_D
(
const
AbstractNavigationContext
);
return
d
->
m_topContext
;
}
AbstractNavigationContext
::
AbstractNavigationContext
(
const
TopDUContextPointer
&
topContext
,
AbstractNavigationContext
*
previousContext
)
:
d
(
new
AbstractNavigationContextPrivate
)
:
d
_ptr
(
new
AbstractNavigationContextPrivate
)
{
Q_D
(
AbstractNavigationContext
);
d
->
m_previousContext
=
previousContext
;
d
->
m_topContext
=
topContext
;
...
...
@@ -95,6 +101,8 @@ void AbstractNavigationContext::makeLink(const QString& name, const DeclarationP
QString
AbstractNavigationContext
::
createLink
(
const
QString
&
name
,
const
QString
&
,
const
NavigationAction
&
action
)
{
Q_D
(
AbstractNavigationContext
);
if
(
d
->
m_shorten
)
{
//Do not create links in shortened mode, it's only for viewing
return
typeHighlight
(
name
.
toHtmlEscaped
());
...
...
@@ -139,6 +147,8 @@ void AbstractNavigationContext::makeLink(const QString& name, const QString& tar
void
AbstractNavigationContext
::
clear
()
{
Q_D
(
AbstractNavigationContext
);
d
->
m_linkCount
=
0
;
d
->
m_currentLine
=
0
;
d
->
m_currentText
.
clear
();
...
...
@@ -149,6 +159,8 @@ void AbstractNavigationContext::clear()
void
AbstractNavigationContext
::
executeLink
(
const
QString
&
link
)
{
Q_D
(
AbstractNavigationContext
);
const
auto
actionIt
=
d
->
m_links
.
constFind
(
link
);
if
(
actionIt
==
d
->
m_links
.
constEnd
())
return
;
...
...
@@ -164,6 +176,8 @@ NavigationContextPointer AbstractNavigationContext::executeKeyAction(const QStri
NavigationContextPointer
AbstractNavigationContext
::
execute
(
const
NavigationAction
&
action
)
{
Q_D
(
AbstractNavigationContext
);
if
(
action
.
targetContext
)
return
NavigationContextPointer
(
action
.
targetContext
);
...
...
@@ -240,22 +254,30 @@ NavigationContextPointer AbstractNavigationContext::execute(const NavigationActi
AbstractNavigationContext
*
AbstractNavigationContext
::
previousContext
()
const
{
Q_D
(
const
AbstractNavigationContext
);
return
d
->
m_previousContext
;
}
void
AbstractNavigationContext
::
setPreviousContext
(
AbstractNavigationContext
*
previous
)
{
Q_D
(
AbstractNavigationContext
);
d
->
m_previousContext
=
previous
;
}
NavigationContextPointer
AbstractNavigationContext
::
registerChild
(
AbstractNavigationContext
*
context
)
{
Q_D
(
AbstractNavigationContext
);
d
->
m_children
<<
NavigationContextPointer
(
context
);
return
d
->
m_children
.
last
();
}
NavigationContextPointer
AbstractNavigationContext
::
registerChild
(
const
DeclarationPointer
&
declaration
)
{
Q_D
(
AbstractNavigationContext
);
//We create a navigation-widget here, and steal its context.. evil ;)
QScopedPointer
<
AbstractNavigationWidget
>
navigationWidget
(
declaration
->
context
()
->
createNavigationWidget
(
declaration
.
data
()));
...
...
@@ -273,6 +295,8 @@ const int lineJump = 3;
bool
AbstractNavigationContext
::
down
()
{
Q_D
(
AbstractNavigationContext
);
//Make sure link-count is valid
if
(
d
->
m_linkCount
==
-
1
)
{
DUChainReadLocker
lock
;
...
...
@@ -319,6 +343,8 @@ bool AbstractNavigationContext::down()
bool
AbstractNavigationContext
::
up
()
{
Q_D
(
AbstractNavigationContext
);
//Make sure link-count is valid
if
(
d
->
m_linkCount
==
-
1
)
{
DUChainReadLocker
lock
;
...
...
@@ -359,6 +385,8 @@ bool AbstractNavigationContext::up()
bool
AbstractNavigationContext
::
nextLink
()
{
Q_D
(
AbstractNavigationContext
);
//Make sure link-count is valid
if
(
d
->
m_linkCount
==
-
1
)
{
DUChainReadLocker
lock
;
...
...
@@ -380,6 +408,8 @@ bool AbstractNavigationContext::nextLink()
bool
AbstractNavigationContext
::
previousLink
()
{
Q_D
(
AbstractNavigationContext
);
//Make sure link-count is valid
if
(
d
->
m_linkCount
==
-
1
)
{
DUChainReadLocker
lock
;
...
...
@@ -401,11 +431,15 @@ bool AbstractNavigationContext::previousLink()
int
AbstractNavigationContext
::
linkCount
()
const
{
Q_D
(
const
AbstractNavigationContext
);
return
d
->
m_linkCount
;
}
void
AbstractNavigationContext
::
resetNavigation
()
{
Q_D
(
AbstractNavigationContext
);
d
->
m_currentPositionLine
=
-
1
;
d
->
m_selectedLink
=
-
1
;
d
->
m_selectedLinkAction
=
{};
...
...
@@ -413,6 +447,8 @@ void AbstractNavigationContext::resetNavigation()
NavigationContextPointer
AbstractNavigationContext
::
back
()
{
Q_D
(
AbstractNavigationContext
);
if
(
d
->
m_previousContext
)
return
NavigationContextPointer
(
d
->
m_previousContext
);
else
...
...
@@ -421,6 +457,8 @@ NavigationContextPointer AbstractNavigationContext::back()
NavigationContextPointer
AbstractNavigationContext
::
accept
()
{
Q_D
(
AbstractNavigationContext
);
if
(
d
->
m_selectedLink
>=
0
&&
d
->
m_selectedLink
<
d
->
m_linkCount
)
{
NavigationAction
action
=
d
->
m_intLinks
[
d
->
m_selectedLink
];
return
execute
(
action
);
...
...
@@ -430,6 +468,8 @@ NavigationContextPointer AbstractNavigationContext::accept()
NavigationContextPointer
AbstractNavigationContext
::
accept
(
IndexedDeclaration
decl
)
{
Q_D
(
AbstractNavigationContext
);
if
(
decl
.
data
())
{