Re: [Cppcms-users] Set a null value on JSON without quotes
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2012-11-01 08:37:02
|
To be honest, I'm not sure it is good idea. I'll explain why: In C++ JSON object has valuesemantics, unlike the reference semantics in JavaScript, so using NULL pointer or pointer to cppcms::json::null would be alien. That is why object cppcms::json::null exists, it is dummy object that represents null value and it works perfectly fine. Using pointer as substitution may be misleading as users may assume that they assign pointers to json object and not values themselves. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Lee Elenbaas <lee...@gm...> >To: Artyom Beilis <art...@ya...> >Sent: Thursday, November 1, 2012 12:53 AM >Subject: Re: [Cppcms-users] Set a null value on JSON without quotes > > >Hi Artyom, > >attached is a tested and working solution for the nullptr assignment >i have 2 issues with it: > >1. i am not sure that the support for the C++03 syntax of >my_object["val"] = (cppcms::json::null*)NULL; gives anything at all - so i think that should be removed, but i whould like your input on this >2. i did not understand the config.h mechanism yet - and i think the support for autoptr should be inserted only in the case of C++11 and not in other modes - so conditioning for this is also missing > >lee > > >On Wed, Oct 31, 2012 at 11:55 AM, Lee Elenbaas <lee...@gm...> wrote: > >Since this message bounced from the mailing list (probably due to the attachment) >>i thought i will send it directly to you >> >> >>as far as agreement to the copy write - i already gave you my consent about the tmpl_cc tool - just extend it to this or anything else i will send over in the future unless i will explicitly tell you not to >> >> >> >>---------- Forwarded message ---------- >>From: Lee Elenbaas <lee...@gm...> >>Date: Wed, Oct 31, 2012 at 11:51 AM >>Subject: Re: [Cppcms-users] Set a null value on JSON without quotes >>To: cpp...@li... >> >> >> >>i did not found how to bring it up through source forge >>i did not had time to check and see if it works yet (i will probably get around to it tonight) >> >> >>but attached is the updated file that should support the following syntax: >> >> >>always: >>my_object["name"]=(json::null*)NULL; >> >> >>in C++11 also >>my_object["name"]=nullptr; >> >>if anyone manage to check it before i do - please let me know >> >> >>On Wed, Oct 31, 2012 at 10:14 AM, Marcel Hellwig <ke...@co...> wrote: >> >> >>>-----BEGIN PGP SIGNED MESSAGE----- >>>Hash: SHA1 >>> >>>Am 31.10.2012 08:29, schrieb Lee Elenbaas: >>> >>>> Any chance that cppcms under C++11 will support the syntax: >>>> >>>> my_object["name"]=nullptr; >>> I don't see any arguments against this. Write a patch and commit it via sourceforge. Artyom will respond you if he thinks it is worth to implement. >>>> >>>> On Wed, Oct 31, 2012 at 9:09 AM, Artyom Beilis <art...@ya... <mailto:art...@ya...>> wrote: >>>> >>>> my_object["name"]=cppcms::json::null(); >>>> >>>> http://cppcms.com/cppcms_ref/latest/structcppcms_1_1json_1_1null.html >>>> >>>> Artyom Beilis >>>> -------------- >>>> CppCMS - C++ Web Framework: http://cppcms.com/ >>>> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >>>> >>> > ------------------------- >>>> *From:* Daniel Rios <dan...@li... <mailto:dan...@li...>> >>>> *To:* cppcms <cpp...@li... <mailto:cpp...@li...>> >>>> *Sent:* Wednesday, October 31, 2012 <tel:2012> 3:18 AM >>>> *Subject:* [Cppcms-users] Set a null value on JSON without quotes >>> >>>> >>>> Hello there ! I've need to set a null value on JSON without quotes, I've tried the following: >>>> >>>> my_object["name"] = NULL; >>>> my_object["name"] = "null"; >>>> >>>> On the first case I've got "my_object": 0 and then "my_object":"null" >>>> >>>> But I've need "my_object":null >>>> >>>> Any clue ? >>>> >>>> Daniel >>>> >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://p.sf.net/sfu/appdyn_sfd2d_oct >>>> _______________________________________________ >>>> Cppcms-users mailing list >>> > Cpp...@li... <mailto:Cpp...@li...> >>> >>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://p.sf.net/sfu/appdyn_sfd2d_oct >>>> _______________________________________________ >>>> Cppcms-users mailing list >>> > Cpp...@li... <mailto:Cpp...@li...> >>> >>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>>> >>>> >>>> -- >>>> -- >>>> lee >>>> Lee Elenbaas >>> > lee...@gm... <mailto:lee...@gm...> >>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://p.sf.net/sfu/appdyn_sfd2d_oct >>>> >>>> >>>> _______________________________________________ >>>> Cppcms-users mailing list >>>> Cpp...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>>-----BEGIN PGP SIGNATURE----- >>>Version: GnuPG v1.4.12 (GNU/Linux) >>>Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ >>> >>>iQIcBAEBAgAGBQJQkN3JAAoJEIROXYQnkAHpqZsP/3kmWyN5la134Ckc62Zc02F5 >>>LlOKQ5RHmtOcKBxRj78xUSukmGVzwnM3tVe/JnRbnQYo+SFf5n/zl74s3PfzBKp6 >>>CNSEltKObhrhCnRTc1kwCdvXzHi1SNfyXDhwRIkrnLC8PKcWa1DfcwV3VZdvVWRE >>>0XTNDMIc3SbOjuQCWNbnsTsWoGV5o7U5ZeUv9fTqAWCL0w7FQIfn3uSt+d/AqvM7 >>>rVCIxbDs96sunEyEerH0jc1atHmxRWtCPtZdosISgZOKuea72710MrRZ3zpPzWsb >>>9CCIzh0Yo+l+fRAcGKej0VYAuH+i5DC+OrbBCQryukTynp6JjvUnZxOYeSbAj5Ro >>>n3uzY/oatB4br/RjKLZGN3TW6fxz0ZMvNujoRgV5+25mRXyd7Z+nfgpbRDpjVgVL >>>5BQotc+fboPvtANYiF9K6YZjGr82w9yMc95pO2d8x6CEtd7bbLroGSSc3pjNO0rC >>>Cb5D0oW8dM8ivgUz6jR42ud7nwd8OtXaIk+UkIoWswpe1t6P/sKzZyD0awmisqaN >>>bRRZL70mXeAZBQz4bpCPN3br2WhdbbWOR5Fzf/5NhosB/wtQfaWLnRGmIj6e+HOj >>>VxuHzuZVjPlBmVTzdxtKN6fJwTeT3CvOmM9naT/zhvlbBu0uTgFpikgBNVeUUf9I >>>oBlR6SgfrgiC2BuFfgb/ >>>=4nhe >>>-----END PGP SIGNATURE----- >>> >>> >>>------------------------------------------------------------------------------ >>>Everyone hates slow websites. So do we. >>>Make your web apps faster with AppDynamics >>>Download AppDynamics Lite for free today: >>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >> >> >> >>-- >>-- >>lee >>Lee Elenbaas >>lee...@gm... >> >> >> >> >> >>-- >>-- >>lee >>Lee Elenbaas >>lee...@gm... >> >> > > >-- >-- >lee >Lee Elenbaas >lee...@gm... > > > > |