[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [vidalia/alpha] Move macros to external file
commit fe83b46396a9f069710f64a5e0cfd2b13406a92b
Author: Feroze Naina <ferozenaina@xxxxxxxxx>
Date: Tue May 29 23:41:05 2012 +0530
Move macros to external file
---
changes/external-prototype-macros | 3 +
.../plugin/prototypes/TorControlPrototype.cpp | 51 +-------------------
src/vidalia/plugin/prototypes/prototypemacros.h | 49 +++++++++++++++++++
3 files changed, 53 insertions(+), 50 deletions(-)
diff --git a/changes/external-prototype-macros b/changes/external-prototype-macros
new file mode 100644
index 0000000..6ae144b
--- /dev/null
+++ b/changes/external-prototype-macros
@@ -0,0 +1,3 @@
+ Internal cleanups and improvements:
+ o Created prototypemacros.h to store the preprocessor macros
+ used by TorControlPrototype
diff --git a/src/vidalia/plugin/prototypes/TorControlPrototype.cpp b/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
index c963645..ec7799e 100644
--- a/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
+++ b/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
@@ -14,56 +14,7 @@
*/
#include "TorControlPrototype.h"
-
-#define GET_AND_CALL(type, func, res) \
- type obj = qscriptvalue_cast<type>(thisObject()); \
- if(obj) \
- res = obj->func;
-
-#define MERGE2(result, errmsg) \
- QVariant(QList<QVariant>() << result << errmsg);
-
-#define DEF_TYPE0(type, retType, func, call) \
-retType \
-type##Prototype::func \
-{ \
- type *obj = qscriptvalue_cast<type *>(thisObject()); \
- if(obj) \
- return obj->call; \
-}
-
-#define DEF_TYPE1(type, resType, func, call) \
-QVariant \
-type##Prototype::func \
-{ \
- resType res; \
- QString errmsg; \
-\
- type *obj = qscriptvalue_cast<type *>(thisObject()); \
- if(obj) \
- res = obj->call; \
- QList<QVariant> vals; \
- vals << res << QVariant(errmsg); \
-\
- return vals; \
-}
-
-#define DEF_TYPE2(type, resType, ansType, func, call) \
-QVariant \
-type##Prototype::func \
-{ \
- resType res; \
- ansType ans; \
- QString errmsg; \
-\
- type *obj = qscriptvalue_cast<type *>(thisObject()); \
- if(obj) \
- res = obj->call; \
- QList<QVariant> vals; \
- vals << QVariant(ans) << res << QVariant(errmsg); \
-\
- return vals; \
-}
+#include "prototypemacros.h"
TorControlPrototype::TorControlPrototype()
: QObject(), QScriptable() {}
diff --git a/src/vidalia/plugin/prototypes/prototypemacros.h b/src/vidalia/plugin/prototypes/prototypemacros.h
new file mode 100644
index 0000000..907ea60
--- /dev/null
+++ b/src/vidalia/plugin/prototypes/prototypemacros.h
@@ -0,0 +1,49 @@
+#define GET_AND_CALL(type, func, res) \
+ type obj = qscriptvalue_cast<type>(thisObject()); \
+ if(obj) \
+ res = obj->func;
+
+#define MERGE2(result, errmsg) \
+ QVariant(QList<QVariant>() << result << errmsg);
+
+#define DEF_TYPE0(type, retType, func, call) \
+retType \
+type##Prototype::func \
+{ \
+ type *obj = qscriptvalue_cast<type *>(thisObject()); \
+ if(obj) \
+ return obj->call; \
+}
+
+#define DEF_TYPE1(type, resType, func, call) \
+QVariant \
+type##Prototype::func \
+{ \
+ resType res; \
+ QString errmsg; \
+\
+ type *obj = qscriptvalue_cast<type *>(thisObject()); \
+ if(obj) \
+ res = obj->call; \
+ QList<QVariant> vals; \
+ vals << res << QVariant(errmsg); \
+\
+ return vals; \
+}
+
+#define DEF_TYPE2(type, resType, ansType, func, call) \
+QVariant \
+type##Prototype::func \
+{ \
+ resType res; \
+ ansType ans; \
+ QString errmsg; \
+\
+ type *obj = qscriptvalue_cast<type *>(thisObject()); \
+ if(obj) \
+ res = obj->call; \
+ QList<QVariant> vals; \
+ vals << QVariant(ans) << res << QVariant(errmsg); \
+\
+ return vals; \
+}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits