summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-05-14 14:05:27 (GMT)
committerRoberto Raggi <roberto.raggi@nokia.com>2009-05-14 14:05:27 (GMT)
commita896219edac2db3321e5c012bcdb830c698efc1e (patch)
tree31e8c7fd78b3270316b17491c669705628cbb2dd
parentce4e9004d23f4cb5bb03292436db81934c85921f (diff)
downloadQt-a896219edac2db3321e5c012bcdb830c698efc1e.zip
Qt-a896219edac2db3321e5c012bcdb830c698efc1e.tar.gz
Qt-a896219edac2db3321e5c012bcdb830c698efc1e.tar.bz2
Compile with gcc 4.2.
-rw-r--r--src/declarative/qml/parser/javascriptengine_p.cpp35
-rw-r--r--src/declarative/qml/parser/javascriptengine_p.h82
2 files changed, 71 insertions, 46 deletions
diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/javascriptengine_p.cpp
index 5debfd3..d893a90 100644
--- a/src/declarative/qml/parser/javascriptengine_p.cpp
+++ b/src/declarative/qml/parser/javascriptengine_p.cpp
@@ -34,11 +34,11 @@
QT_BEGIN_NAMESPACE
+namespace JavaScript {
+
uint qHash(const JavaScript::NameId &id)
{ return qHash(id.asString()); }
-namespace JavaScript {
-
QString numberToString(double value)
{ return QString::number(value); }
@@ -155,6 +155,37 @@ double integerFromString(const QString &str, int radix)
return integerFromString(ba.constData(), ba.size(), radix);
}
+
+Engine::Engine()
+ : _lexer(0), _nodePool(0)
+{ }
+
+Engine::~Engine()
+{ }
+
+QSet<NameId> Engine::literals() const
+{ return _literals; }
+
+NameId *Engine::intern(const QChar *u, int s)
+{ return const_cast<NameId *>(&*_literals.insert(NameId(u, s))); }
+
+QString Engine::toString(NameId *id)
+{ return id->asString(); }
+
+Lexer *Engine::lexer() const
+{ return _lexer; }
+
+void Engine::setLexer(Lexer *lexer)
+{ _lexer = lexer; }
+
+NodePool *Engine::nodePool() const
+{ return _nodePool; }
+
+void Engine::setNodePool(NodePool *nodePool)
+{ _nodePool = nodePool; }
+
+
+
} // end of namespace JavaScript
QT_END_NAMESPACE
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