summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/parser/javascriptengine_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/parser/javascriptengine_p.h')
-rw-r--r--src/declarative/qml/parser/javascriptengine_p.h82
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