[prev in list] [next in list] [prev in thread] [next in thread]
List: kdevelop-devel
Subject: Re: kdevplatform krazy
From: Bernd Buschinski <b.buschinski () web ! de>
Date: 2007-07-17 12:25:29
Message-ID: 200707171425.29545.b.buschinski () web ! de
[Download RAW message or body]
another krazy try, without DUChainBasePrivate ( at least for now )
I am a bit worried about
IdentifiedFile* IdentifiedFile::operator=( const IdentifiedFile& rhs ) {
because I dont know if it should be
IdentifiedFile& IdentifiedFile::operator=( const IdentifiedFile& rhs ) {
we need the = operator for the foreach macro in duchain.cpp
in the function
QList<KUrl> DUChain::documents() const
beside I just noticed I was to slow, for util krazy fixes
["kdevplatform-9999-krazy2.diff" (text/x-diff)]
Index: language/duchain/topducontext.h
===================================================================
--- language/duchain/topducontext.h (revision 689004)
+++ language/duchain/topducontext.h (working copy)
@@ -42,7 +42,7 @@
class KDEVPLATFORMLANGUAGE_EXPORT TopDUContext : public DUContext
{
public:
- TopDUContext(KTextEditor::Range* range, ParsingEnvironmentFile* file = 0);
+ explicit TopDUContext(KTextEditor::Range* range, ParsingEnvironmentFile* file = \
0); virtual ~TopDUContext();
TopDUContext* topContext() const;
Index: language/duchain/duchain.cpp
===================================================================
--- language/duchain/duchain.cpp (revision 689004)
+++ language/duchain/duchain.cpp (working copy)
@@ -181,7 +181,7 @@
sdDUChainPrivate->m_chains.clear();
}
-const QList< DUChainObserver * > & DUChain::observers() const
+QList< DUChainObserver * > & DUChain::observers() const
{
ENSURE_CHAIN_READ_LOCKED
Index: language/duchain/duchainpointer.cpp
===================================================================
--- language/duchain/duchainpointer.cpp (revision 0)
+++ language/duchain/duchainpointer.cpp (revision 0)
@@ -0,0 +1,60 @@
+/*
+ This is part of KDevelop
+ Copyright (C) 2007 Bernd Buschinski <b.buschinski@web.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "duchainpointer.h"
+
+namespace KDevelop
+{
+
+class DUChainPointerDataPrivate
+{
+public:
+ DUChainBase* myDUChainBase;
+};
+
+
+
+DUChainBase* DUChainPointerData::base()
+{
+ return d->myDUChainBase;
+}
+
+DUChainBase* DUChainPointerData::base() const
+{
+ return d->myDUChainBase;
+}
+
+DUChainPointerData::DUChainPointerData()
+ : d(new DUChainPointerDataPrivate())
+{
+ d->myDUChainBase = 0;
+}
+
+DUChainPointerData::~DUChainPointerData()
+{
+ delete d;
+}
+
+DUChainPointerData::DUChainPointerData( DUChainBase* base )
+ : d(new DUChainPointerDataPrivate())
+{
+ d->myDUChainBase = base;
+}
+
+} //KDevelop
Index: language/duchain/parsingenvironment.h
===================================================================
--- language/duchain/parsingenvironment.h (revision 689004)
+++ language/duchain/parsingenvironment.h (working copy)
@@ -40,6 +40,8 @@
IdentifiedFile();
explicit IdentifiedFile( const KUrl& url , uint identity = 0 );
+
+ ~IdentifiedFile();
KUrl url() const;
@@ -47,6 +49,8 @@
bool operator<( const IdentifiedFile& rhs ) const;
+ IdentifiedFile* operator=( const IdentifiedFile& rhs );
+
bool isEmpty() const;
operator bool() const;
@@ -54,8 +58,7 @@
///Gives a short description(url identity)
QString toString() const;
private:
- KUrl m_url;
- uint m_identity;
+ class IdentifiedFilePrivate* const d;
};
///Access to all these classes must be serialized through du-chain locking
Index: language/duchain/duchain.h
===================================================================
--- language/duchain/duchain.h (revision 689004)
+++ language/duchain/duchain.h (working copy)
@@ -89,7 +89,7 @@
*/
static DUChainLock* lock();
- const QList<DUChainObserver*>& observers() const;
+ QList<DUChainObserver*>& observers() const;
void addObserver(DUChainObserver* observer);
void removeObserver(DUChainObserver* observer);
Index: language/duchain/duchainpointer.h
===================================================================
--- language/duchain/duchainpointer.h (revision 689004)
+++ language/duchain/duchainpointer.h (working copy)
@@ -45,33 +45,30 @@
*
* To make it even more convenient see
* */
+
class KDEVPLATFORMLANGUAGE_EXPORT DUChainPointerData : public KShared {
public:
/**
* Will return zero once the pointed-to object was deleted
* */
- DUChainBase* base() {
- return d;
- }
+ DUChainBase* base();
/**
* Will return zero once the pointed-to object was deleted
* */
- const DUChainBase* base() const {
- return d;
- }
+ DUChainBase* base() const;
///Default-initialization of an invalid reference
- DUChainPointerData() : d(0) {
- }
+ DUChainPointerData();
+
+ ~DUChainPointerData();
private:
///Should not be used from outside, but is needed sometimes to construct an \
invalid dummy-pointer
- DUChainPointerData( DUChainBase* base ) : d(base) {
- }
+ DUChainPointerData( DUChainBase* base );
friend class DUChainBase;
- DUChainBase* d;
+ class DUChainPointerDataPrivate * const d;
Q_DISABLE_COPY(DUChainPointerData)
};
Index: language/duchain/parsingenvironment.cpp
===================================================================
--- language/duchain/parsingenvironment.cpp (revision 689004)
+++ language/duchain/parsingenvironment.cpp (working copy)
@@ -19,16 +19,35 @@
#include "parsingenvironment.h"
-using namespace KDevelop;
+namespace KDevelop
+{
-IdentifiedFile::IdentifiedFile() : m_identity(0) {
+class IdentifiedFilePrivate
+{
+public:
+ KUrl m_url;
+ uint m_identity;
+};
+
+IdentifiedFile::IdentifiedFile()
+ : d(new IdentifiedFilePrivate)
+{
+ d->m_identity = 0;
}
-IdentifiedFile::IdentifiedFile( const KUrl& url , uint identity ) : m_url(url ), \
m_identity(identity) { +IdentifiedFile::IdentifiedFile( const KUrl& url , uint \
identity ) + : d(new IdentifiedFilePrivate)
+{
+ d->m_url = url;
+ d->m_identity = identity;
}
+IdentifiedFile::~IdentifiedFile() {
+ delete d;
+}
+
KUrl IdentifiedFile::url() const {
- return m_url;
+ return d->m_url;
}
QString IdentifiedFile::toString() const {
@@ -36,15 +55,21 @@
}
uint IdentifiedFile::identity() const {
- return m_identity;
+ return d->m_identity;
}
bool IdentifiedFile::operator<( const IdentifiedFile& rhs ) const {
- return m_url < rhs.m_url || (m_url == rhs.m_url && m_identity < rhs.m_identity );
+ return d->m_url < rhs.url() || (d->m_url == rhs.url() && d->m_identity < \
rhs.identity() ); }
+IdentifiedFile* IdentifiedFile::operator=( const IdentifiedFile& rhs ) {
+ d->m_url = rhs.url();
+ d->m_identity = rhs.identity();
+ return this;
+}
+
bool IdentifiedFile::isEmpty() const {
- return m_url.isEmpty();
+ return d->m_url.isEmpty();
}
IdentifiedFile::operator bool() const {
@@ -85,3 +110,5 @@
ParsingEnvironmentFile* ParsingEnvironmentManager::find( const KUrl& /*url*/, const \
ParsingEnvironment* /*environment*/ ) { return 0;
}
+
+} //KDevelop
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic