mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
Code cleanup
This commit is contained in:
parent
6d4bb0f4fd
commit
aa65084ae1
2 changed files with 16 additions and 26 deletions
|
@ -12,12 +12,13 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "ArrayBufferPrototype.h"
|
||||
#include "DataViewClass.h"
|
||||
#include "ScriptEngine.h"
|
||||
#include "TypedArrays.h"
|
||||
|
||||
#include "ArrayBufferClass.h"
|
||||
|
||||
static const QString CLASS_NAME = "ArrayBuffer";
|
||||
static const QString BYTE_LENGTH_PROPERTY_NAME = "byteLength";
|
||||
|
||||
Q_DECLARE_METATYPE(QByteArray*)
|
||||
|
||||
|
@ -46,6 +47,18 @@ _scriptEngine(scriptEngine) {
|
|||
_ctor.setData(engine()->toScriptValue(this));
|
||||
|
||||
engine()->globalObject().setProperty(name(), _ctor);
|
||||
|
||||
// Registering other array types
|
||||
new DataViewClass(scriptEngine);
|
||||
new Int8ArrayClass(scriptEngine);
|
||||
new Uint8ArrayClass(scriptEngine);
|
||||
new Uint8ClampedArrayClass(scriptEngine);
|
||||
new Int16ArrayClass(scriptEngine);
|
||||
new Uint16ArrayClass(scriptEngine);
|
||||
new Int32ArrayClass(scriptEngine);
|
||||
new Uint32ArrayClass(scriptEngine);
|
||||
new Float32ArrayClass(scriptEngine);
|
||||
new Float64ArrayClass(scriptEngine);
|
||||
}
|
||||
|
||||
QScriptValue ArrayBufferClass::newInstance(qint32 size) {
|
||||
|
|
|
@ -94,19 +94,8 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam
|
|||
_vec3Library(),
|
||||
_uuidLibrary(),
|
||||
_animationCache(this),
|
||||
_arrayBufferClass(NULL)
|
||||
_arrayBufferClass(new ArrayBufferClass(this))
|
||||
{
|
||||
_arrayBufferClass = new ArrayBufferClass(this);
|
||||
new DataViewClass(this);
|
||||
new Int8ArrayClass(this);
|
||||
new Uint8ArrayClass(this);
|
||||
new Uint8ClampedArrayClass(this);
|
||||
new Int16ArrayClass(this);
|
||||
new Uint16ArrayClass(this);
|
||||
new Int32ArrayClass(this);
|
||||
new Uint32ArrayClass(this);
|
||||
new Float32ArrayClass(this);
|
||||
new Float64ArrayClass(this);
|
||||
}
|
||||
|
||||
ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
||||
|
@ -131,25 +120,13 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
|||
_vec3Library(),
|
||||
_uuidLibrary(),
|
||||
_animationCache(this),
|
||||
_arrayBufferClass(NULL)
|
||||
_arrayBufferClass(new ArrayBufferClass(this))
|
||||
{
|
||||
QString scriptURLString = scriptURL.toString();
|
||||
_fileNameString = scriptURLString;
|
||||
|
||||
QUrl url(scriptURL);
|
||||
|
||||
_arrayBufferClass = new ArrayBufferClass(this);
|
||||
new DataViewClass(this);
|
||||
new Int8ArrayClass(this);
|
||||
new Uint8ArrayClass(this);
|
||||
new Uint8ClampedArrayClass(this);
|
||||
new Int16ArrayClass(this);
|
||||
new Uint16ArrayClass(this);
|
||||
new Int32ArrayClass(this);
|
||||
new Uint32ArrayClass(this);
|
||||
new Float32ArrayClass(this);
|
||||
new Float64ArrayClass(this);
|
||||
|
||||
// if the scheme length is one or lower, maybe they typed in a file, let's try
|
||||
const int WINDOWS_DRIVE_LETTER_SIZE = 1;
|
||||
if (url.scheme().size() <= WINDOWS_DRIVE_LETTER_SIZE) {
|
||||
|
|
Loading…
Reference in a new issue