diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-09-22 18:26:24 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-09-23 13:45:03 (GMT) |
commit | 158a48e06134845a72dcab14452390641747d211 (patch) | |
tree | e931668ca75aa4fba6da49b4f8979fdeadd62031 /tools/linguist/lupdate/cpp.cpp | |
parent | 1c4dc6be0c5b6a730e5ae910afa8c4da986e37ee (diff) | |
download | Qt-158a48e06134845a72dcab14452390641747d211.zip Qt-158a48e06134845a72dcab14452390641747d211.tar.gz Qt-158a48e06134845a72dcab14452390641747d211.tar.bz2 |
namespaces *can* have tr() functions, after all
... by virtue of the Q_DECLARE_TR_FUNCTIONS macro.
so remove the artificial limitation to classes (which was mostly an
optimization anyway).
Diffstat (limited to 'tools/linguist/lupdate/cpp.cpp')
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index c9b25f3..81623ab 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -117,7 +117,7 @@ typedef QList<HashString> NamespaceList; struct Namespace { Namespace() : - classDef(0), + classDef(this), hasTrFunctions(false), complained(false) {} @@ -260,7 +260,7 @@ private: NamespaceList *resolved, QStringList *unresolved) const; bool findNamespaceCallback(const Namespace *ns, void *context) const; const Namespace *findNamespace(const NamespaceList &namespaces, int nsCount = -1) const; - void enterNamespace(NamespaceList *namespaces, const HashString &name, bool isClass); + void enterNamespace(NamespaceList *namespaces, const HashString &name); void truncateNamespaces(NamespaceList *namespaces, int lenght); Namespace *modifyNamespace(NamespaceList *namespaces, bool tryOrigin = true); @@ -1111,14 +1111,11 @@ const Namespace *CppParser::findNamespace(const NamespaceList &namespaces, int n return ns; } -void CppParser::enterNamespace(NamespaceList *namespaces, const HashString &name, bool isClass) +void CppParser::enterNamespace(NamespaceList *namespaces, const HashString &name) { *namespaces << name; - if (!findNamespace(*namespaces)) { - Namespace *ns = modifyNamespace(namespaces, false); - if (isClass) - ns->classDef = ns; - } + if (!findNamespace(*namespaces)) + modifyNamespace(namespaces, false); } void CppParser::truncateNamespaces(NamespaceList *namespaces, int length) @@ -1543,7 +1540,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) } else { namespaceDepths.push(namespaces.count()); } - enterNamespace(&namespaces, fct, true); + enterNamespace(&namespaces, fct); functionContext = namespaces; functionContextUnresolved.clear(); // Pointless @@ -1561,7 +1558,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) yyTok = getToken(); if (yyTok == Tok_LeftBrace) { namespaceDepths.push(namespaces.count()); - enterNamespace(&namespaces, ns, false); + enterNamespace(&namespaces, ns); yyTok = getToken(); } else if (yyTok == Tok_Equals) { // e.g. namespace Is = OuterSpace::InnerSpace; @@ -1670,7 +1667,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) break; } while (!findNamespace(functionContext, idx)->classDef->hasTrFunctions) { - if (idx == 1 || !findNamespace(functionContext, idx - 1)->classDef) { + if (idx == 1) { context = stringifyNamespace(functionContext); Namespace *fctx = findNamespace(functionContext)->classDef; if (!fctx->complained) { |