diff --git a/doric/context.h b/doric/context.h index 59cbf45e..941d10de 100644 --- a/doric/context.h +++ b/doric/context.h @@ -14,19 +14,19 @@ class Context private: int contextId; - QString* source; + QString *source; public: - Driver* driver = NativeDriver::getInstance(); + Driver *driver = NativeDriver::getInstance(); - Context(int contextId, QString* source) { + Context(int contextId, QString *source) { this->contextId = contextId; this->source = source; } void show() { - QString* method = new QString(Constant::DORIC_ENTITY_SHOW); - QVector* arguments = new QVector(); + QString *method = new QString(Constant::DORIC_ENTITY_SHOW); + QVector *arguments = new QVector(); driver->invokeContextEntityMethod(contextId, method, nullptr); @@ -35,12 +35,12 @@ public: } void init(double width, double height) { - QJsonObject* jsonObject = new QJsonObject(); + QJsonObject *jsonObject = new QJsonObject(); jsonObject->insert("width", width); jsonObject->insert("height", height); - QString* method = new QString(Constant::DORIC_ENTITY_INIT); - QVariant* variant = new QVariant(); + QString *method = new QString(Constant::DORIC_ENTITY_INIT); + QVariant *variant = new QVariant(); variant->setValue(*jsonObject); driver->invokeContextEntityMethod(contextId, method, variant, nullptr); diff --git a/doric/driver/native_driver.cpp b/doric/driver/native_driver.cpp index 5603e2ed..6216f24a 100644 --- a/doric/driver/native_driver.cpp +++ b/doric/driver/native_driver.cpp @@ -15,8 +15,8 @@ void NativeDriver::destroyContext(int contextId) { jsEngine->destroyContext(contextId); } -void NativeDriver::invokeContextEntityMethod(int contextId, QString* method, ...) { - QJSValueList* arguments = new QJSValueList(); +void NativeDriver::invokeContextEntityMethod(int contextId, QString *method, ...) { + QJSValueList *arguments = new QJSValueList(); arguments->append(QJSValue(QString::number(contextId))); arguments->append(QJSValue(*method)); @@ -25,8 +25,8 @@ void NativeDriver::invokeContextEntityMethod(int contextId, QString* method, ... auto argument = va_arg(vaList, QVariant*); while (argument != nullptr) { if (QString(typeid(QJsonObject).name()).contains(QString(argument->typeName()))) { - QJsonObject* jsonObject = static_cast(argument->data()); - QJsonValue* jsonValue = new QJsonValue(*jsonObject); + QJsonObject *jsonObject = static_cast(argument->data()); + QJsonValue *jsonValue = new QJsonValue(*jsonObject); QJSValue jsValue = Utility::convert(jsEngine->engine, *jsonValue); delete jsonValue; arguments->append(jsValue); diff --git a/doric/engine/js_engine.h b/doric/engine/js_engine.h index 4e352382..5a011b88 100644 --- a/doric/engine/js_engine.h +++ b/doric/engine/js_engine.h @@ -44,10 +44,10 @@ public: } private: - NativeLog* nativeLog = new NativeLog(); - NativeTimer* nativeTimer = new NativeTimer(engine); - NativeEmpty* nativeEmpty = new NativeEmpty(); - NativeBridge* nativeBridge = new NativeBridge(); + NativeLog *nativeLog = new NativeLog(); + NativeTimer *nativeTimer = new NativeTimer(engine); + NativeEmpty *nativeEmpty = new NativeEmpty(); + NativeBridge *nativeBridge = new NativeBridge(); void initJSEngine() { engine->installExtensions(QJSEngine::AllExtensions); diff --git a/doric/main.cpp b/doric/main.cpp index 72dfca14..377c3e08 100644 --- a/doric/main.cpp +++ b/doric/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) file->close(); delete file; - QString* source = new QString("Snake.js"); + QString *source = new QString("Snake.js"); Context *context = ContextManager::getInstance()->createContext(&script, source); context->show(); context->init(180, 320); diff --git a/doric/native/native_bridge.cpp b/doric/native/native_bridge.cpp index beba2dad..5e5c2d45 100644 --- a/doric/native/native_bridge.cpp +++ b/doric/native/native_bridge.cpp @@ -7,5 +7,5 @@ Q_INVOKABLE void NativeBridge::function(int contextId, QString module, QString m "methodName: " + methodName + ", " + "callbackId: " + callbackId + ", " + "arguments: " + jsValue.toString(); - Context* context = ContextManager::getInstance()->getContext(contextId); + Context *context = ContextManager::getInstance()->getContext(contextId); } diff --git a/doric/native/native_timer.h b/doric/native/native_timer.h index b85ba9e7..89575af5 100644 --- a/doric/native/native_timer.h +++ b/doric/native/native_timer.h @@ -13,15 +13,15 @@ class NativeTimer : public QObject { private: QSet *deletedTimerIds = new QSet(); - QJSEngine* engine; + QJSEngine *engine; public: - NativeTimer(QJSEngine* engine, QObject *parent = nullptr) : QObject(parent) { + NativeTimer(QJSEngine *engine, QObject *parent = nullptr) : QObject(parent) { this->engine = engine; } Q_INVOKABLE void setTimer(long timerId, int time, bool repeat) { - QTimer* timer = new QTimer(this); + QTimer *timer = new QTimer(this); timer->setSingleShot(!repeat); connect(timer, &QTimer::timeout, this, [=] () { if (deletedTimerIds->contains(timerId)) { diff --git a/doric/plugin/shader_plugin.h b/doric/plugin/shader_plugin.h index da70df05..dff442d0 100644 --- a/doric/plugin/shader_plugin.h +++ b/doric/plugin/shader_plugin.h @@ -6,7 +6,7 @@ class ShaderPlugin : public ContextHolder { public: - ShaderPlugin(Context* context) : ContextHolder(context) {} + ShaderPlugin(Context *context) : ContextHolder(context) {} }; #endif // SHADER_PLUGIN_H diff --git a/doric/utility/utility.h b/doric/utility/utility.h index 74cdb12f..b5d051c8 100644 --- a/doric/utility/utility.h +++ b/doric/utility/utility.h @@ -9,7 +9,7 @@ class Utility { public: - static QJSValue convert(QJSEngine* jsEngine, QJsonValue jsonValue) { + static QJSValue convert(QJSEngine *jsEngine, QJsonValue jsonValue) { if (jsonValue.isBool()) { return QJSValue(jsonValue.toBool()); } else if (jsonValue.isString()) {