[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [smokegen/smokev4] /: put everything into a proper namespace, inline copyStackItem()
From:       Arno Rehn <arno () arnorehn ! de>
Date:       2012-10-12 14:30:22
Message-ID: 20121012143022.D3B32A6075 () git ! kde ! org
[Download RAW message or body]

Git commit 4429f38a9a7a43ef4b3a96fdf7e0eebfa1750907 by Arno Rehn.
Committed on 12/10/2012 at 16:12.
Pushed by arnorehn into branch 'smokev4'.

put everything into a proper namespace, inline copyStackItem()

M  +4    -0    smoke/marshall.h
M  +4    -0    smoke/pointermap.h
M  +4    -0    smoke/quickmarshall.h
M  +3    -0    smoke/smokemanager.cpp
M  +4    -0    smoke/smokemanager.h
M  +3    -26   smoke/smokeutils.cpp
M  +24   -4    smoke/smokeutils.h
M  +2    -0    smokeapi/main.cpp

http://commits.kde.org/smokegen/4429f38a9a7a43ef4b3a96fdf7e0eebfa1750907

diff --git a/smoke/marshall.h b/smoke/marshall.h
index d2054b2..b066df5 100644
--- a/smoke/marshall.h
+++ b/smoke/marshall.h
@@ -24,6 +24,8 @@
 
 #include "smoke.h"
 
+namespace SmokeUtils {
+
 class SmokeType;
 
 class BASE_SMOKE_EXPORT Marshall {
@@ -76,4 +78,6 @@ public:
     virtual ~Marshall() {}
 };
 
+} // namespace SmokeUtils
+
 #endif
diff --git a/smoke/pointermap.h b/smoke/pointermap.h
index 004ba43..60e8d45 100644
--- a/smoke/pointermap.h
+++ b/smoke/pointermap.h
@@ -25,6 +25,8 @@
 
 #include "smokemanager.h"
 
+namespace SmokeUtils {
+
 // TODO: see if we can somehow improve/move these helpers without
 //       resorting to subclassing and virtual methods
 template <class X>
@@ -132,4 +134,6 @@ void PointerMap<MappedType>::unmapPointer(MappedType * instance, Smoke::ModuleIn
     }
 }
 
+} // namespace SmokeUtils
+
 #endif // POINTERMAP_H
diff --git a/smoke/quickmarshall.h b/smoke/quickmarshall.h
index 8022d6d..8360c36 100644
--- a/smoke/quickmarshall.h
+++ b/smoke/quickmarshall.h
@@ -26,6 +26,8 @@
 #include "marshall.h"
 #include "smokeutils.h"
 
+namespace SmokeUtils {
+
 class BASE_SMOKE_EXPORT QuickMarshall : public Marshall {
 private:
     SmokeType _type;
@@ -63,4 +65,6 @@ public:
     inline void next() {}
 };
 
+} // namespace SmokeUtils
+
 #endif // QUICKMARSHALL_H
diff --git a/smoke/smokemanager.cpp b/smoke/smokemanager.cpp
index 4e2f07b..0092da9 100644
--- a/smoke/smokemanager.cpp
+++ b/smoke/smokemanager.cpp
@@ -33,6 +33,8 @@
 
 static const int SMOKE_VERSION = 3;
 
+namespace SmokeUtils {
+
 #ifndef _WIN32
 typedef std::vector<void*> HandleList;
 #else
@@ -360,3 +362,4 @@ bool SmokeManager::isDerivedFrom(const Smoke::ModuleIndex& classId, const Smoke:
     return false;
 }
 
+} // namespace SmokeUtils
diff --git a/smoke/smokemanager.h b/smoke/smokemanager.h
index 1711573..47ec94a 100644
--- a/smoke/smokemanager.h
+++ b/smoke/smokemanager.h
@@ -27,6 +27,8 @@
 
 class Smoke;
 
+namespace SmokeUtils {
+
 class BASE_SMOKE_EXPORT SmokeManager
 {
 public:
@@ -105,4 +107,6 @@ protected:
     Data *d;
 };
 
+} // namespace SmokeUtils
+
 #endif // SMOKEMANAGER_H
diff --git a/smoke/smokeutils.cpp b/smoke/smokeutils.cpp
index 22b3371..40198c8 100644
--- a/smoke/smokeutils.cpp
+++ b/smoke/smokeutils.cpp
@@ -22,32 +22,7 @@
 #include "smokeutils.h"
 #include "smokemanager.h"
 
-void copyStackItem(Smoke::StackItem& dest, const Smoke::StackItem& src, short unsigned int typeId)
-{
-#define CASE(type) case Smoke::t_##type: dest.s_##type = src.s_##type; break;
-
-    switch (typeId) {
-        CASE(bool);
-        CASE(char);
-        CASE(uchar);
-        CASE(short);
-        CASE(ushort);
-        CASE(int);
-        CASE(uint);
-        CASE(long);
-        CASE(ulong);
-        CASE(longlong);
-        CASE(ulonglong);
-        CASE(float);
-        CASE(double);
-        CASE(longdouble);
-        CASE(enum);
-
-        default: dest.s_voidp = src.s_voidp;
-    }
-
-#undef CASE
-}
+namespace SmokeUtils {
 
 bool SmokeType::isUnsigned() const {
     if (!typeId()) return false;
@@ -205,3 +180,5 @@ std::string SmokeClass::unqualifiedName() const
 
     return name;
 }
+
+} // namespace SmokeUtils
diff --git a/smoke/smokeutils.h b/smoke/smokeutils.h
index b510ed7..708e255 100644
--- a/smoke/smokeutils.h
+++ b/smoke/smokeutils.h
@@ -42,6 +42,8 @@
 
 #include "smokemanager.h"
 
+namespace SmokeUtils {
+
 template <typename CharType, std::size_t N>
 #if __cplusplus >= 201103L
 constexpr
@@ -53,8 +55,24 @@ std::size_t static_strlen(const CharType (&) [N]) {
     return N - 1;
 }
 
-BASE_SMOKE_EXPORT
-void copyStackItem(Smoke::StackItem &dest, const Smoke::StackItem& src, unsigned short typeId);
+inline
+void copyStackItem(Smoke::StackItem &dest, const Smoke::StackItem& src, unsigned short typeId) {
+#define SMOKE_TYPEID_CASE(type) case Smoke::t_##type: dest.s_##type = src.s_##type; break;
+    switch (typeId) {
+        SMOKE_TYPEID_CASE(bool);
+        SMOKE_TYPEID_CASE(char); SMOKE_TYPEID_CASE(uchar);
+        SMOKE_TYPEID_CASE(short); SMOKE_TYPEID_CASE(ushort);
+        SMOKE_TYPEID_CASE(int); SMOKE_TYPEID_CASE(uint);
+        SMOKE_TYPEID_CASE(long); SMOKE_TYPEID_CASE(ulong);
+        SMOKE_TYPEID_CASE(longlong); SMOKE_TYPEID_CASE(ulonglong);
+        SMOKE_TYPEID_CASE(float); SMOKE_TYPEID_CASE(double);
+        SMOKE_TYPEID_CASE(longdouble);
+        SMOKE_TYPEID_CASE(enum);
+
+        default: dest.s_voidp = src.s_voidp;
+    }
+#undef SMOKE_TYPEID_CASE
+}
 
 class BASE_SMOKE_EXPORT SmokeType {
 protected:
@@ -343,7 +361,9 @@ public:
     }
 };
 
-inline std::ostream& operator<<(std::ostream& stream, const SmokeMethod& method) {
+} // namespace SmokeUtils
+
+inline std::ostream& operator<<(std::ostream& stream, const SmokeUtils::SmokeMethod& method) {
     method.prettyPrint(stream);
     return stream;
 }
@@ -382,7 +402,7 @@ enum MocArgumentType {
 
 struct MocArgument {
     // smoke object and associated typeid
-    SmokeType st;
+    SmokeUtils::SmokeType st;
     MocArgumentType argType;
 };
 
diff --git a/smokeapi/main.cpp b/smokeapi/main.cpp
index 1ed8e4c..7863f98 100644
--- a/smokeapi/main.cpp
+++ b/smokeapi/main.cpp
@@ -24,6 +24,8 @@
 #include <smoke/smoke.h>
 #include <smoke/smokemanager.h>
 
+using namespace ::SmokeUtils;
+
 static QTextStream qOut(stdout);
 
 typedef QPair<Smoke::ModuleIndex,int> ClassEntry;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic