Commit 99f23597 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Added license headers to javascriptengine_p.{cpp,h}

Reviewed-by: Roberto Raggi
parent 85325d50
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "javascriptengine_p.h"
#include "javascriptnodepool_p.h"
#include "javascriptvalue.h"
......@@ -10,17 +39,17 @@ namespace JavaScript {
int Ecma::RegExp::flagFromChar(const QChar &ch)
{
static QHash<QChar, int> flagsHash;
if (flagsHash.isEmpty()) {
flagsHash[QLatin1Char('g')] = Global;
flagsHash[QLatin1Char('i')] = IgnoreCase;
flagsHash[QLatin1Char('m')] = Multiline;
}
QHash<QChar, int>::const_iterator it;
it = flagsHash.constFind(ch);
if (it == flagsHash.constEnd())
return 0;
return it.value();
static QHash<QChar, int> flagsHash;
if (flagsHash.isEmpty()) {
flagsHash[QLatin1Char('g')] = Global;
flagsHash[QLatin1Char('i')] = IgnoreCase;
flagsHash[QLatin1Char('m')] = Multiline;
}
QHash<QChar, int>::const_iterator it;
it = flagsHash.constFind(ch);
if (it == flagsHash.constEnd())
return 0;
return it.value();
}
......@@ -35,8 +64,8 @@ NodePool::~NodePool()
Code *NodePool::createCompiledCode(AST::Node *, CompilationUnit &)
{
Q_ASSERT(0);
return 0;
Q_ASSERT(0);
return 0;
}
static int toDigit(char c)
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef JAVASCRIPTENGINE_P_H
#define JAVASCRIPTENGINE_P_H
......@@ -42,24 +71,24 @@ public:
class JavaScriptNameIdImpl
{
QString _text;
QString _text;
public:
JavaScriptNameIdImpl(const QChar *u, int s)
: _text(u, s)
{ }
JavaScriptNameIdImpl(const QChar *u, int s)
: _text(u, s)
{ }
const QString asString() const
{ return _text; }
const QString asString() const
{ return _text; }
bool operator == (const JavaScriptNameIdImpl &other) const
{ return _text == other._text; }
bool operator == (const JavaScriptNameIdImpl &other) const
{ return _text == other._text; }
bool operator != (const JavaScriptNameIdImpl &other) const
{ return _text != other._text; }
bool operator != (const JavaScriptNameIdImpl &other) const
{ return _text != other._text; }
bool operator < (const JavaScriptNameIdImpl &other) const
{ return _text < other._text; }
bool operator < (const JavaScriptNameIdImpl &other) const
{ return _text < other._text; }
};
inline uint qHash(const JavaScriptNameIdImpl &id)
......@@ -67,43 +96,43 @@ inline uint qHash(const JavaScriptNameIdImpl &id)
class JavaScriptEnginePrivate
{
JavaScript::Lexer *_lexer;
JavaScript::NodePool *_nodePool;
JavaScript::AST::Node *_ast;
QSet<JavaScriptNameIdImpl> _literals;
JavaScript::Lexer *_lexer;
JavaScript::NodePool *_nodePool;
JavaScript::AST::Node *_ast;
QSet<JavaScriptNameIdImpl> _literals;
public:
JavaScriptEnginePrivate()
: _lexer(0), _nodePool(0), _ast(0)
{ }
JavaScriptEnginePrivate()
: _lexer(0), _nodePool(0), _ast(0)
{ }
QSet<JavaScriptNameIdImpl> literals() const
{ return _literals; }
QSet<JavaScriptNameIdImpl> literals() const
{ return _literals; }
JavaScriptNameIdImpl *intern(const QChar *u, int s)
{ return const_cast<JavaScriptNameIdImpl *>(&*_literals.insert(JavaScriptNameIdImpl(u, s))); }
JavaScriptNameIdImpl *intern(const QChar *u, int s)
{ return const_cast<JavaScriptNameIdImpl *>(&*_literals.insert(JavaScriptNameIdImpl(u, s))); }
JavaScript::Lexer *lexer() const
{ return _lexer; }
JavaScript::Lexer *lexer() const
{ return _lexer; }
void setLexer(JavaScript::Lexer *lexer)
{ _lexer = lexer; }
void setLexer(JavaScript::Lexer *lexer)
{ _lexer = lexer; }
JavaScript::NodePool *nodePool() const
{ return _nodePool; }
JavaScript::NodePool *nodePool() const
{ return _nodePool; }
void setNodePool(JavaScript::NodePool *nodePool)
{ _nodePool = nodePool; }
void setNodePool(JavaScript::NodePool *nodePool)
{ _nodePool = nodePool; }
JavaScript::AST::Node *ast() const
{ return _ast; }
JavaScript::AST::Node *ast() const
{ return _ast; }
JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node)
{
JavaScript::AST::Node *previousAST = _ast;
_ast = node;
return previousAST;
}
JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node)
{
JavaScript::AST::Node *previousAST = _ast;
_ast = node;
return previousAST;
}
};
QT_END_NAMESPACE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment