language/duchain
indexedtype.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "indexedtype.h"
00020
00021 #include "../repositories/typerepository.h"
00022 #include "../referencecounting.h"
00023
00024 namespace KDevelop
00025 {
00026
00027 IndexedType::IndexedType(uint index) : m_index(index) {
00028 if(m_index && shouldDoDUChainReferenceCounting(this))
00029 TypeRepository::increaseReferenceCount(m_index, this);
00030 }
00031
00032 IndexedType::IndexedType(const IndexedType& rhs) : m_index(rhs.m_index) {
00033 if(m_index && shouldDoDUChainReferenceCounting(this))
00034 TypeRepository::increaseReferenceCount(m_index, this);
00035 }
00036
00037 IndexedType::~IndexedType() {
00038 if(m_index && shouldDoDUChainReferenceCounting(this))
00039 TypeRepository::decreaseReferenceCount(m_index, this);
00040 }
00041
00042 IndexedType& IndexedType::operator=(const IndexedType& rhs) {
00043
00044 if(m_index && shouldDoDUChainReferenceCounting(this))
00045 TypeRepository::decreaseReferenceCount(m_index, this);
00046
00047 m_index = rhs.m_index;
00048
00049 if(m_index && shouldDoDUChainReferenceCounting(this))
00050 TypeRepository::increaseReferenceCount(m_index, this);
00051
00052 return *this;
00053 }
00054
00055 AbstractType::Ptr IndexedType::abstractType() const {
00056 if(!m_index)
00057 return AbstractType::Ptr();
00058 return TypeRepository::typeForIndex(m_index);
00059 }
00060 }
00061
00062