diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-05-14 14:05:27 (GMT) |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-05-14 14:05:27 (GMT) |
commit | a896219edac2db3321e5c012bcdb830c698efc1e (patch) | |
tree | 31e8c7fd78b3270316b17491c669705628cbb2dd /src/declarative/qml/parser/javascriptengine_p.h | |
parent | ce4e9004d23f4cb5bb03292436db81934c85921f (diff) | |
download | Qt-a896219edac2db3321e5c012bcdb830c698efc1e.zip Qt-a896219edac2db3321e5c012bcdb830c698efc1e.tar.gz Qt-a896219edac2db3321e5c012bcdb830c698efc1e.tar.bz2 |
Compile with gcc 4.2.
Diffstat (limited to 'src/declarative/qml/parser/javascriptengine_p.h')
-rw-r--r-- | src/declarative/qml/parser/javascriptengine_p.h | 82 |
1 files changed, 38 insertions, 44 deletions
diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h index 933487f..3bd924a 100644 --- a/src/declarative/qml/parser/javascriptengine_p.h +++ b/src/declarative/qml/parser/javascriptengine_p.h @@ -38,11 +38,38 @@ QT_BEGIN_NAMESPACE namespace JavaScript { -class NameId; -} +class NameId +{ + QString _text; + +public: + NameId(const QChar *u, int s) + : _text(u, s) + { } + + const QString asString() const + { return _text; } + + bool operator == (const NameId &other) const + { return _text == other._text; } + + bool operator != (const NameId &other) const + { return _text != other._text; } + + bool operator < (const NameId &other) const + { return _text < other._text; } +}; uint qHash(const JavaScript::NameId &id); +} // end of namespace JavaScript + +#if defined(Q_CC_MSVC) && _MSC_VER <= 1300 +//this ensures that code outside JavaScript can use the hash function +//it also a workaround for some compilers +inline uint qHash(const JavaScript::NameId &nameId) { return JavaScript::qHash(nameId); } +#endif + namespace JavaScript { class Lexer; @@ -66,29 +93,6 @@ public: } // end of namespace Ecma - -class NameId -{ - QString _text; - -public: - NameId(const QChar *u, int s) - : _text(u, s) - { } - - const QString asString() const - { return _text; } - - bool operator == (const NameId &other) const - { return _text == other._text; } - - bool operator != (const NameId &other) const - { return _text != other._text; } - - bool operator < (const NameId &other) const - { return _text < other._text; } -}; - class DiagnosticMessage { public: @@ -118,30 +122,20 @@ class Engine QSet<NameId> _literals; public: - Engine() - : _lexer(0), _nodePool(0) - { } - - QSet<NameId> literals() const - { return _literals; } - - NameId *intern(const QChar *u, int s) - { return const_cast<NameId *>(&*_literals.insert(NameId(u, s))); } + Engine(); + ~Engine(); - static QString toString(NameId *id) - { return id->asString(); } + QSet<NameId> literals() const; - Lexer *lexer() const - { return _lexer; } + NameId *intern(const QChar *u, int s); - void setLexer(Lexer *lexer) - { _lexer = lexer; } + static QString toString(NameId *id); - NodePool *nodePool() const - { return _nodePool; } + Lexer *lexer() const; + void setLexer(Lexer *lexer); - void setNodePool(NodePool *nodePool) - { _nodePool = nodePool; } + NodePool *nodePool() const; + void setNodePool(NodePool *nodePool); }; } // end of namespace JavaScript |