From 1d064d709ba6169a98450623be9d92d13e156b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Blanchon?= Date: Fri, 27 Jun 2014 13:45:50 +0200 Subject: [PATCH] Removed the overloads of add() by using a templated type --- JsonGeneratorTests/JsonArray.h | 18 ++---------------- JsonGeneratorTests/JsonHashTable.h | 3 ++- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/JsonGeneratorTests/JsonArray.h b/JsonGeneratorTests/JsonArray.h index 600003dd..96d7aaa6 100644 --- a/JsonGeneratorTests/JsonArray.h +++ b/JsonGeneratorTests/JsonArray.h @@ -16,23 +16,9 @@ public: { itemCount = 0; } - - void add(const char* value) - { - add(JsonValue(value)); - } - void add(double value) - { - add(JsonValue(value)); - } - - void add(bool value) - { - add(JsonValue(value)); - } - - void add(JsonObjectBase& value) + template + void add(T value) { add(JsonValue(value)); } diff --git a/JsonGeneratorTests/JsonHashTable.h b/JsonGeneratorTests/JsonHashTable.h index eb655b82..878915ed 100644 --- a/JsonGeneratorTests/JsonHashTable.h +++ b/JsonGeneratorTests/JsonHashTable.h @@ -17,7 +17,8 @@ public: itemCount = 0; } - void add(const char* key, const char* value) + template + void add(const char* key, T value) { add(key, JsonValue(value)); }