[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevplatform/language/duchain
From:       David Nolden <david.nolden.kde () art-master ! de>
Date:       2008-07-01 0:37:04
Message-ID: 1214872624.341774.26240.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 826576 by zwabel:

Add IndexedTypeIdentifier



 M  +29 -0     identifier.cpp  
 M  +18 -0     identifier.h  


--- trunk/KDE/kdevplatform/language/duchain/identifier.cpp #826575:826576
@@ -1108,6 +1108,35 @@
   return QualifiedIdentifier(index);
 }
 
+IndexedTypeIdentifier::IndexedTypeIdentifier() : \
index(emptyConstantQualifiedIdentifierPrivateIndex) {  }
 
+bool IndexedTypeIdentifier::isValid() const {
+  return index != emptyConstantQualifiedIdentifierPrivateIndex;
+}
+
+IndexedTypeIdentifier::IndexedTypeIdentifier(const TypeIdentifier& id) : \
index(id.index()) { +}
+
+IndexedTypeIdentifier& IndexedTypeIdentifier::operator=(const TypeIdentifier& id) {
+  index = id.index();
+  return *this;
+}
+bool IndexedTypeIdentifier::operator==(const IndexedTypeIdentifier& rhs) const {
+  return index == rhs.index;
+}
+bool IndexedTypeIdentifier::operator==(const TypeIdentifier& id) const {
+  return index == id.index();
+}
+
+TypeIdentifier IndexedTypeIdentifier::identifier() const {
+  return TypeIdentifier(index);
+}
+
+IndexedTypeIdentifier::operator TypeIdentifier() const {
+  return TypeIdentifier(index);
+}
+
+}
+
 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; \
                auto-insert-doxygen on
--- trunk/KDE/kdevplatform/language/duchain/identifier.h #826575:826576
@@ -78,6 +78,24 @@
   uint index;
 };
 
+//A helper-class to store an identifier by index in a type-safe way. Will be \
extended to do reference-counting at some point. +//The difference to \
QualifiedIdentifier is that this class only stores the index of an identifier that is \
in the repository, without any dynamic +//abilities or access to the contained data.
+struct KDEVPLATFORMLANGUAGE_EXPORT IndexedTypeIdentifier {
+  IndexedTypeIdentifier();
+  IndexedTypeIdentifier(const TypeIdentifier& id);
+  IndexedTypeIdentifier& operator=(const TypeIdentifier& id);
+  bool operator==(const IndexedTypeIdentifier& rhs) const;
+  bool operator==(const TypeIdentifier& id) const;
+  
+  bool isValid() const;
+  
+  TypeIdentifier identifier() const;
+  operator TypeIdentifier() const;
+  
+  uint index;
+};
+
 /// Represents a single unqualified identifier
 class KDEVPLATFORMLANGUAGE_EXPORT Identifier
 {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic