Closed ve3jrw closed 2 years ago
There is a CppWAMP mailing list at https://groups.google.com/forum/#!forum/cppwamp. I get instant notifications when someone posts there.
We do conversions to nested structures all the time here at work. All you need to do is define a convertible nested structure. I suppose I should add an example in the documentation. I'll use this issue as a reminder to add such an example.
Here's an example based on your JSON snippet:
struct BuildingSize
{
float width;
float depth;
float height;
};
template <typename TConverter>
void convert(TConverter& conv, BuildingSize& size)
{
conv("width", size.width)
("depth", size.depth)
("height", size.height);
}
struct Building
{
std::string name;
std::string address;
BuildingSize size;
};
template <typename TConverter>
void convert(TConverter& conv, Building& building)
{
conv("name", building.name)
("address", building.address)
("size", building.size);
}
or, alternatively:
template <typename TConverter>
void convert(TConverter& conv, BuildingSize& size)
{
conv("width", size.width)
("depth", size.depth)
("height", size.height);
}
Just wanted to add that the library is working very well for us. I was initially looking at using Autobahn|CPP but I'm finding cppWamp is a much better fit for us. The prototyping has gone well and we are near finalization of the technologies we want to use.
I'm glad to hear the library is working well for you. :-)
Great, I appreciate that and I'll get hooked up with the mailing list.
Thanks for all your help!
Sorry, this isn't and issue but I don't know how else to contact you to ask this.
I've got converters that work well for flat data structures in a class and structures, but was wondering if it is possible to setup a converter for nested objects such that the javaObject ends up with the data at a reference like x.y.z ?
E.g. a converter that can convert to a javaScript object like this:
var building = { name : "Home", address : "1234 main street", size : { width : 100, depth: 50, height: 20 } }
Can the converter specify something like this? If so, could you provide a simple example?
Thanks!
Just wanted to add that the library is working very well for us. I was initially looking at using Autobahn|CPP but I'm finding cppWamp is a much better fit for us. The prototyping has gone well and we are near finalization of the technologies we want to use.
Chris