Skip to content

Commit dc42208

Browse files
author
Marian Krivos
committed
porting JSON to the Dynamic::Var
added to JSON to gmake build
1 parent 95c62c0 commit dc42208

4 files changed

Lines changed: 37 additions & 17 deletions

File tree

JSON/include/Poco/JSON/Array.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
#include "Poco/JSON/JSON.h"
4646
#include "Poco/SharedPtr.h"
47-
#include "Poco/DynamicAny.h"
47+
#include "Poco/Dynamic/Var.h"
4848

4949
namespace Poco
5050
{
@@ -214,15 +214,18 @@ inline void Array::remove(unsigned int index)
214214
namespace Poco
215215
{
216216

217+
namespace Dynamic
218+
{
219+
217220
template <>
218-
class DynamicAnyHolderImpl<JSON::Array::Ptr>: public DynamicAnyHolder
221+
class VarHolderImpl<JSON::Array::Ptr>: public VarHolder
219222
{
220223
public:
221-
DynamicAnyHolderImpl(const JSON::Array::Ptr& val): _val(val)
224+
VarHolderImpl(const JSON::Array::Ptr& val): _val(val)
222225
{
223226
}
224227

225-
~DynamicAnyHolderImpl()
228+
~VarHolderImpl()
226229
{
227230
}
228231

@@ -313,9 +316,9 @@ class DynamicAnyHolderImpl<JSON::Array::Ptr>: public DynamicAnyHolder
313316
throw BadCastException();
314317
}
315318

316-
DynamicAnyHolder* clone() const
319+
VarHolder* clone() const
317320
{
318-
return new DynamicAnyHolderImpl(_val);
321+
return new VarHolderImpl(_val);
319322
}
320323

321324
const JSON::Array::Ptr& value() const
@@ -352,6 +355,7 @@ class DynamicAnyHolderImpl<JSON::Array::Ptr>: public DynamicAnyHolder
352355
JSON::Array::Ptr _val;
353356
};
354357

358+
} // Namespace Dynamic
355359
} // Namespace Poco
356360

357361

JSON/include/Poco/JSON/Object.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include <sstream>
4646

4747
#include "Poco/SharedPtr.h"
48-
#include "Poco/DynamicAny.h"
48+
#include "Poco/Dynamic/Var.h"
4949

5050
#include "Poco/JSON/JSON.h"
5151
#include "Poco/JSON/Array.h"
@@ -216,15 +216,18 @@ inline void Object::remove(const std::string& key)
216216
namespace Poco
217217
{
218218

219+
namespace Dynamic
220+
{
221+
219222
template <>
220-
class DynamicAnyHolderImpl<JSON::Object::Ptr>: public DynamicAnyHolder
223+
class VarHolderImpl<JSON::Object::Ptr>: public VarHolder
221224
{
222225
public:
223-
DynamicAnyHolderImpl(const JSON::Object::Ptr& val): _val(val)
226+
VarHolderImpl(const JSON::Object::Ptr& val): _val(val)
224227
{
225228
}
226229

227-
~DynamicAnyHolderImpl()
230+
~VarHolderImpl()
228231
{
229232
}
230233

@@ -315,9 +318,9 @@ class DynamicAnyHolderImpl<JSON::Object::Ptr>: public DynamicAnyHolder
315318
//TODO: ts = _val.timestamp();
316319
}
317320

318-
DynamicAnyHolder* clone() const
321+
VarHolderImpl* clone() const
319322
{
320-
return new DynamicAnyHolderImpl(_val);
323+
return new VarHolderImpl(_val);
321324
}
322325

323326
const JSON::Object::Ptr& value() const
@@ -354,6 +357,7 @@ class DynamicAnyHolderImpl<JSON::Object::Ptr>: public DynamicAnyHolder
354357
JSON::Object::Ptr _val;
355358
};
356359

360+
}
357361
}
358362

359363
#endif // JSON_Object_INCLUDED

Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif
2424
all: libexecs tests samples
2525

2626
INSTALLDIR = $(DESTDIR)$(POCO_PREFIX)
27-
COMPONENTS = Foundation XML Util Net Crypto NetSSL_OpenSSL Data Data/SQLite Data/ODBC Data/MySQL Zip PageCompiler PageCompiler/File2Page PDF CppParser
27+
COMPONENTS = Foundation XML Util Net Crypto NetSSL_OpenSSL Data Data/SQLite Data/ODBC Data/MySQL Zip PageCompiler PageCompiler/File2Page PDF CppParser JSON
2828

2929
cppunit:
3030
$(MAKE) -C $(POCO_BASE)/CppUnit
@@ -44,9 +44,9 @@ install: libexecs
4444
find $(POCO_BUILD)/lib -name "libPoco*" -type f -exec cp -f {} $(INSTALLDIR)/lib \;
4545
find $(POCO_BUILD)/lib -name "libPoco*" -type l -exec cp -Rf {} $(INSTALLDIR)/lib \;
4646

47-
libexecs = Foundation-libexec XML-libexec Util-libexec Net-libexec Crypto-libexec NetSSL_OpenSSL-libexec Data-libexec Data/SQLite-libexec Data/ODBC-libexec Data/MySQL-libexec Zip-libexec PageCompiler-libexec PageCompiler/File2Page-libexec PDF-libexec CppParser-libexec
48-
tests = Foundation-tests XML-tests Util-tests Net-tests Crypto-tests NetSSL_OpenSSL-tests Data-tests Data/SQLite-tests Data/ODBC-tests Data/MySQL-tests Zip-tests PDF-tests CppParser-tests
49-
samples = Foundation-samples XML-samples Util-samples Net-samples Crypto-samples NetSSL_OpenSSL-samples Data-samples Zip-samples PageCompiler-samples PDF-samples
47+
libexecs = Foundation-libexec XML-libexec Util-libexec Net-libexec Crypto-libexec NetSSL_OpenSSL-libexec Data-libexec Data/SQLite-libexec Data/ODBC-libexec Data/MySQL-libexec Zip-libexec PageCompiler-libexec PageCompiler/File2Page-libexec PDF-libexec CppParser-libexec JSON-libexec
48+
tests = Foundation-tests XML-tests Util-tests Net-tests Crypto-tests NetSSL_OpenSSL-tests Data-tests Data/SQLite-tests Data/ODBC-tests Data/MySQL-tests Zip-tests PDF-tests CppParser-tests JSON-tests
49+
samples = Foundation-samples XML-samples Util-samples Net-samples Crypto-samples NetSSL_OpenSSL-samples Data-samples Zip-samples PageCompiler-samples PDF-samples JSON-samples
5050

5151
.PHONY: $(libexecs)
5252
.PHONY: $(tests)
@@ -170,6 +170,15 @@ CppParser-libexec: Foundation-libexec
170170
CppParser-tests: CppParser-libexec
171171
$(MAKE) -C $(POCO_BASE)/CppParser/testsuite
172172

173+
JSON-libexec: Foundation-libexec
174+
$(MAKE) -C $(POCO_BASE)/JSON
175+
176+
#JSON-tests: JSON-libexec cppunit
177+
# $(MAKE) -C $(POCO_BASE)/JSON/testsuite
178+
179+
#JSON-samples: JSON-libexec
180+
# $(MAKE) -C $(POCO_BASE)/JSON/samples
181+
173182

174183
clean:
175184
$(MAKE) -C $(POCO_BASE)/Foundation clean
@@ -211,6 +220,9 @@ clean:
211220
$(MAKE) -C $(POCO_BASE)/CppParser clean
212221
$(MAKE) -C $(POCO_BASE)/CppParser/testsuite clean
213222
$(MAKE) -C $(POCO_BASE)/CppUnit clean
223+
$(MAKE) -C $(POCO_BASE)/JSON clean
224+
$(MAKE) -C $(POCO_BASE)/JSON/testsuite clean
225+
$(MAKE) -C $(POCO_BASE)/JSON/samples clean
214226

215227
distclean:
216228
rm -rf $(POCO_BUILD)/lib

components

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ PDF
1717
CppParser
1818
PocoDoc
1919
ProGen
20-
20+
JSON

0 commit comments

Comments
 (0)