Changeset View
Changeset View
Standalone View
Standalone View
language/duchain/identifier.cpp
Show First 20 Lines • Show All 582 Lines • ▼ Show 20 Line(s) | |||||
583 | void Identifier::setTemplateIdentifiers(const QList<IndexedTypeIdentifier>& templateIdentifiers) | 583 | void Identifier::setTemplateIdentifiers(const QList<IndexedTypeIdentifier>& templateIdentifiers) | ||
584 | { | 584 | { | ||
585 | prepareWrite(); | 585 | prepareWrite(); | ||
586 | dd->templateIdentifiersList.clear(); | 586 | dd->templateIdentifiersList.clear(); | ||
587 | foreach(const IndexedTypeIdentifier& id, templateIdentifiers) | 587 | foreach(const IndexedTypeIdentifier& id, templateIdentifiers) | ||
588 | dd->templateIdentifiersList.append(id); | 588 | dd->templateIdentifiersList.append(id); | ||
589 | } | 589 | } | ||
590 | 590 | | |||
591 | QString Identifier::toString() const | 591 | QString Identifier::toString(IdentifierStringFormattingOptions options) const | ||
592 | { | 592 | { | ||
593 | QString ret = identifier().str(); | 593 | QString ret = identifier().str(); | ||
594 | 594 | | |||
595 | if (templateIdentifiersCount()) { | 595 | if (!options.testFlag(RemoveTemplateInformation) && templateIdentifiersCount()) { | ||
596 | ret.append("< "); | 596 | ret.append("< "); | ||
597 | for (uint i = 0; i < templateIdentifiersCount(); ++i) { | 597 | for (uint i = 0; i < templateIdentifiersCount(); ++i) { | ||
598 | ret.append(templateIdentifier(i).toString()); | 598 | ret.append(templateIdentifier(i).toString(options)); | ||
599 | if (i != templateIdentifiersCount() - 1) | 599 | if (i != templateIdentifiersCount() - 1) | ||
600 | ret.append(", "); | 600 | ret.append(", "); | ||
601 | } | 601 | } | ||
602 | ret.append(" >"); | 602 | ret.append(" >"); | ||
603 | } | 603 | } | ||
604 | 604 | | |||
605 | return ret; | 605 | return ret; | ||
606 | } | 606 | } | ||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | |||||
767 | } | 767 | } | ||
768 | 768 | | |||
769 | QualifiedIdentifier::~QualifiedIdentifier() | 769 | QualifiedIdentifier::~QualifiedIdentifier() | ||
770 | { | 770 | { | ||
771 | if(!m_index) | 771 | if(!m_index) | ||
772 | delete dd; | 772 | delete dd; | ||
773 | } | 773 | } | ||
774 | 774 | | |||
775 | QStringList QualifiedIdentifier::toStringList() const | 775 | QStringList QualifiedIdentifier::toStringList(IdentifierStringFormattingOptions options) const | ||
776 | { | 776 | { | ||
777 | QStringList ret; | 777 | QStringList ret; | ||
778 | ret.reserve(explicitlyGlobal() + count()); | 778 | ret.reserve(explicitlyGlobal() + count()); | ||
779 | if (explicitlyGlobal()) | 779 | if (explicitlyGlobal()) | ||
780 | ret.append(QString()); | 780 | ret.append(QString()); | ||
781 | 781 | | |||
782 | if(m_index) { | 782 | if(m_index) { | ||
783 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, cd->identifiers) | 783 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, cd->identifiers) | ||
784 | ret << index.identifier().toString(); | 784 | ret << index.identifier().toString(options); | ||
785 | }else{ | 785 | }else{ | ||
786 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, dd->identifiers) | 786 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, dd->identifiers) | ||
787 | ret << index.identifier().toString(); | 787 | ret << index.identifier().toString(options); | ||
788 | } | 788 | } | ||
789 | 789 | | |||
790 | return ret; | 790 | return ret; | ||
791 | } | 791 | } | ||
792 | 792 | | |||
793 | QString QualifiedIdentifier::toString(bool ignoreExplicitlyGlobal) const | 793 | QString QualifiedIdentifier::toString(IdentifierStringFormattingOptions options) const | ||
794 | { | 794 | { | ||
795 | const QString doubleColon = QStringLiteral("::"); | 795 | const QString doubleColon = QStringLiteral("::"); | ||
796 | 796 | | |||
797 | QString ret; | 797 | QString ret; | ||
798 | if( !ignoreExplicitlyGlobal && explicitlyGlobal() ) | 798 | if( !options.testFlag(RemoveExplicitlyGlobalPrefix) && explicitlyGlobal() ) | ||
799 | ret = doubleColon; | 799 | ret = doubleColon; | ||
800 | 800 | | |||
801 | bool first = true; | 801 | bool first = true; | ||
802 | if(m_index) { | 802 | if(m_index) { | ||
803 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, cd->identifiers) | 803 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, cd->identifiers) | ||
804 | { | 804 | { | ||
805 | if( !first ) | 805 | if( !first ) | ||
806 | ret += doubleColon; | 806 | ret += doubleColon; | ||
807 | else | 807 | else | ||
808 | first = false; | 808 | first = false; | ||
809 | 809 | | |||
810 | ret += index.identifier().toString(); | 810 | ret += index.identifier().toString(options); | ||
811 | } | 811 | } | ||
812 | }else{ | 812 | }else{ | ||
813 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, dd->identifiers) | 813 | FOREACH_FUNCTION_STATIC(const IndexedIdentifier& index, dd->identifiers) | ||
814 | { | 814 | { | ||
815 | if( !first ) | 815 | if( !first ) | ||
816 | ret += doubleColon; | 816 | ret += doubleColon; | ||
817 | else | 817 | else | ||
818 | first = false; | 818 | first = false; | ||
819 | 819 | | |||
820 | ret += index.identifier().toString(); | 820 | ret += index.identifier().toString(options); | ||
821 | } | 821 | } | ||
822 | } | 822 | } | ||
823 | 823 | | |||
824 | return ret; | 824 | return ret; | ||
825 | } | 825 | } | ||
826 | 826 | | |||
827 | QualifiedIdentifier QualifiedIdentifier::merge(const QualifiedIdentifier& base) const | 827 | QualifiedIdentifier QualifiedIdentifier::merge(const QualifiedIdentifier& base) const | ||
828 | { | 828 | { | ||
▲ Show 20 Lines • Show All 413 Lines • ▼ Show 20 Line(s) | |||||
1242 | void IndexedTypeIdentifier::setIsConstPointer(int depthNumber, bool constant) | 1242 | void IndexedTypeIdentifier::setIsConstPointer(int depthNumber, bool constant) | ||
1243 | { | 1243 | { | ||
1244 | if(constant) | 1244 | if(constant) | ||
1245 | m_pointerConstMask |= (1 << depthNumber); | 1245 | m_pointerConstMask |= (1 << depthNumber); | ||
1246 | else | 1246 | else | ||
1247 | m_pointerConstMask &= (~(1 << depthNumber)); | 1247 | m_pointerConstMask &= (~(1 << depthNumber)); | ||
1248 | } | 1248 | } | ||
1249 | 1249 | | |||
1250 | QString IndexedTypeIdentifier::toString(bool ignoreExplicitlyGlobal) const | 1250 | QString IndexedTypeIdentifier::toString(IdentifierStringFormattingOptions options) const | ||
1251 | { | 1251 | { | ||
1252 | QString ret; | 1252 | QString ret; | ||
1253 | if(isConstant()) | 1253 | if(isConstant()) | ||
1254 | ret += QLatin1String("const "); | 1254 | ret += QLatin1String("const "); | ||
1255 | if(isVolatile()) | 1255 | if(isVolatile()) | ||
1256 | ret += QLatin1String("volatile "); | 1256 | ret += QLatin1String("volatile "); | ||
1257 | 1257 | | |||
1258 | ret += m_identifier.identifier().toString(ignoreExplicitlyGlobal); | 1258 | ret += m_identifier.identifier().toString(options); | ||
1259 | for(int a = 0; a < pointerDepth(); ++a) { | 1259 | for(int a = 0; a < pointerDepth(); ++a) { | ||
1260 | ret += '*'; | 1260 | ret += '*'; | ||
1261 | if( isConstPointer(a) ) | 1261 | if( isConstPointer(a) ) | ||
1262 | ret += QLatin1String("const"); | 1262 | ret += QLatin1String("const"); | ||
1263 | } | 1263 | } | ||
1264 | 1264 | | |||
1265 | if(isRValue()) | 1265 | if(isRValue()) | ||
1266 | ret += QLatin1String("&&"); | 1266 | ret += QLatin1String("&&"); | ||
▲ Show 20 Lines • Show All 338 Lines • Show Last 20 Lines |