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
ed33f17f
Commit
ed33f17f
authored
Jun 26, 2019
by
Friedrich W. H. Kossebau
Browse files
kdevplatform/language/interfaces: use Q_DECLARE_PRIVATE/Q_D to forward constness to d
parent
95d32c7e
Changes
6
Hide whitespace changes
Inline
Side-by-side
kdevplatform/language/interfaces/codecontext.cpp
View file @
ed33f17f
...
...
@@ -52,7 +52,7 @@ public:
DUContextContext
::
DUContextContext
(
const
IndexedDUContext
&
item
)
:
Context
()
,
d
(
new
DUContextContextPrivate
(
item
))
,
d
_ptr
(
new
DUContextContextPrivate
(
item
))
{}
DUContextContext
::~
DUContextContext
()
=
default
;
...
...
@@ -64,6 +64,8 @@ int DUContextContext::type() const
QList
<
QUrl
>
DUContextContext
::
urls
()
const
{
Q_D
(
const
DUContextContext
);
DUChainReadLocker
lock
;
if
(
auto
context
=
d
->
m_item
.
context
())
{
return
{
...
...
@@ -75,10 +77,14 @@ QList<QUrl> DUContextContext::urls() const
IndexedDUContext
DUContextContext
::
context
()
const
{
Q_D
(
const
DUContextContext
);
return
d
->
m_item
;
}
void
DUContextContext
::
setContext
(
IndexedDUContext
context
)
{
Q_D
(
DUContextContext
);
d
->
m_item
=
context
;
}
...
...
@@ -97,7 +103,7 @@ public:
DeclarationContext
::
DeclarationContext
(
const
IndexedDeclaration
&
declaration
,
const
DocumentRange
&
use
,
const
IndexedDUContext
&
context
)
:
DUContextContext
(
context
)
,
d
(
new
DeclarationContextPrivate
(
declaration
,
use
))
,
d
_ptr
(
new
DeclarationContextPrivate
(
declaration
,
use
))
{}
DeclarationContext
::
DeclarationContext
(
KTextEditor
::
View
*
view
,
const
KTextEditor
::
Cursor
&
position
)
:
DUContextContext
(
...
...
@@ -112,7 +118,7 @@ DeclarationContext::DeclarationContext(KTextEditor::View* view, const KTextEdito
if
(
declaration
)
{
indexed
=
IndexedDeclaration
(
declaration
);
}
d
.
reset
(
new
DeclarationContextPrivate
(
declaration
,
useRange
));
d
_ptr
.
reset
(
new
DeclarationContextPrivate
(
declaration
,
useRange
));
setContext
(
IndexedDUContext
(
item
.
context
));
}
...
...
@@ -125,11 +131,15 @@ int DeclarationContext::type() const
IndexedDeclaration
DeclarationContext
::
declaration
()
const
{
Q_D
(
const
DeclarationContext
);
return
d
->
m_declaration
;
}
DocumentRange
DeclarationContext
::
use
()
const
{
Q_D
(
const
DeclarationContext
);
return
d
->
m_use
;
}
}
kdevplatform/language/interfaces/codecontext.h
View file @
ed33f17f
...
...
@@ -66,7 +66,8 @@ protected:
void
setContext
(
IndexedDUContext
context
);
private:
const
QScopedPointer
<
class
DUContextContextPrivate
>
d
;
const
QScopedPointer
<
class
DUContextContextPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
DUContextContext
)
Q_DISABLE_COPY
(
DUContextContext
)
};
...
...
@@ -105,7 +106,8 @@ public:
private:
// TODO: fix constructor and make const
QScopedPointer
<
class
DeclarationContextPrivate
>
d
;
QScopedPointer
<
class
DeclarationContextPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
DeclarationContext
)
Q_DISABLE_COPY
(
DeclarationContext
)
};
...
...
kdevplatform/language/interfaces/editorcontext.cpp
View file @
ed33f17f
...
...
@@ -53,7 +53,7 @@ public:
EditorContext
::
EditorContext
(
KTextEditor
::
View
*
view
,
const
KTextEditor
::
Cursor
&
position
)
:
DeclarationContext
(
view
,
position
)
,
d
(
new
EditorContextPrivate
(
view
,
position
))
,
d
_ptr
(
new
EditorContextPrivate
(
view
,
position
))
{}
EditorContext
::~
EditorContext
()
=
default
;
...
...
@@ -65,11 +65,15 @@ int EditorContext::type() const
QUrl
EditorContext
::
url
()
const
{
Q_D
(
const
EditorContext
);
return
d
->
m_url
;
}
QList
<
QUrl
>
EditorContext
::
urls
()
const
{
Q_D
(
const
EditorContext
);
return
{
d
->
m_url
};
...
...
@@ -77,21 +81,29 @@ QList<QUrl> EditorContext::urls() const
KTextEditor
::
Cursor
EditorContext
::
position
()
const
{
Q_D
(
const
EditorContext
);
return
d
->
m_position
;
}
QString
EditorContext
::
currentLine
()
const
{
Q_D
(
const
EditorContext
);
return
d
->
m_currentLine
;
}
QString
EditorContext
::
currentWord
()
const
{
Q_D
(
const
EditorContext
);
return
d
->
m_currentWord
;
}
KTextEditor
::
View
*
EditorContext
::
view
()
const
{
Q_D
(
const
EditorContext
);
return
d
->
m_view
;
}
}
kdevplatform/language/interfaces/editorcontext.h
View file @
ed33f17f
...
...
@@ -32,6 +32,8 @@ class Cursor;
class
QUrl
;
namespace
KDevelop
{
class
EditorContextPrivate
;
/**A context for the KTextEditor.*/
class
KDEVPLATFORMLANGUAGE_EXPORT
EditorContext
:
public
DeclarationContext
...
...
@@ -73,7 +75,8 @@ public:
KTextEditor
::
View
*
view
()
const
;
private:
const
QScopedPointer
<
class
EditorContextPrivate
>
d
;
const
QScopedPointer
<
class
EditorContextPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
EditorContext
)
};
}
...
...
kdevplatform/language/interfaces/ilanguagesupport.cpp
View file @
ed33f17f
...
...
@@ -31,7 +31,7 @@ public:
};
ILanguageSupport
::
ILanguageSupport
()
:
d
(
new
ILanguageSupportPrivate
)
:
d
_ptr
(
new
ILanguageSupportPrivate
)
{
}
...
...
@@ -97,6 +97,8 @@ QString ILanguageSupport::indentationSample() const
QReadWriteLock
*
ILanguageSupport
::
parseLock
()
const
{
Q_D
(
const
ILanguageSupport
);
return
&
d
->
lock
;
}
...
...
kdevplatform/language/interfaces/ilanguagesupport.h
View file @
ed33f17f
...
...
@@ -43,6 +43,7 @@ class ParseJob;
class
TopDUContext
;
class
ICodeHighlighting
;
class
ICreateClassHelper
;
class
ILanguageSupportPrivate
;
class
KDEVPLATFORMLANGUAGE_EXPORT
ILanguageSupport
{
...
...
@@ -163,7 +164,8 @@ public:
const
QString
&
changedText
,
bool
removal
)
const
;
private:
const
QScopedPointer
<
class
ILanguageSupportPrivate
>
d
;
const
QScopedPointer
<
class
ILanguageSupportPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
ILanguageSupport
)
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment