Thread: [Cppcms-users] json settings get and set
Brought to you by:
artyom-beilis
From: Marcel H. <ke...@co...> - 2012-04-24 09:25:19
|
Hi everyone, I have a strange error when I try to do the following: if (hours <= 6 || hours >= 20) { //time between 20 and 6 if (settings().get("internal.isDay", false) == true) { cache().rise("TimeChange"); settings().set("internal.isDay", false); } } else { //time between 7 and 19 if (settings().get("internal.isDay", true) == false) { cache().rise("TimeChange"); settings().set("internal.isDay", true); } } I tried it at first with set<bool> but it does not work either. The error is: /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp: In member function ‘void BackGroundProcessor::TimeToBackground()’: /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: error: no matching function for call to ‘cppcms::json::value::set(const char [15], bool) const’ /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: note: candidates are: In file included from /usr/local/include/cppcms/service.h:18:0, from /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:7: /usr/local/include/cppcms/json.h:342:8: note: void cppcms::json::value::set(const string&, const T&) [with T = bool; std::string = std::basic_string<char>] <near match> /usr/local/include/cppcms/json.h:342:8: note: no known conversion for implicit ‘this’ parameter from ‘const cppcms::json::value*’ to ‘cppcms::json::value*’ /usr/local/include/cppcms/json.h:350:8: note: void cppcms::json::value::set(const char*, const T&) [with T = bool] <near match> /usr/local/include/cppcms/json.h:350:8: note: no known conversion for implicit ‘this’ parameter from ‘const cppcms::json::value*’ to ‘cppcms::json::value*’ make[2]: *** [CMakeFiles/bg.dir/src/backgroundprocessor.cpp.o] Error 1 Any suggestions? Regards, Marcel |
From: Artyom B. <art...@ya...> - 2012-04-24 11:49:33
|
settings() return cppcms::json::value as const reference- you can't modify it with set() Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Marcel Hellwig <ke...@co...> >To: cpp...@li... >Sent: Tuesday, April 24, 2012 12:25 PM >Subject: [Cppcms-users] json settings get and set > >Hi everyone, > >I have a strange error when I try to do the following: > >if (hours <= 6 || hours >= 20) { //time between 20 and 6 >if (settings().get("internal.isDay", false) == true) { >cache().rise("TimeChange"); >settings().set("internal.isDay", false); >} >} else { //time between 7 and 19 >if (settings().get("internal.isDay", true) == false) { >cache().rise("TimeChange"); >settings().set("internal.isDay", true); >} >} > >I tried it at first with set<bool> but it does not work either. >The error is: > >/home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp: In >member function ‘void BackGroundProcessor::TimeToBackground()’: >/home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: >error: no matching function for call to ‘cppcms::json::value::set(const >char [15], bool) const’ >/home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: >note: candidates are: >In file included from /usr/local/include/cppcms/service.h:18:0, >from /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:7: >/usr/local/include/cppcms/json.h:342:8: note: void >cppcms::json::value::set(const string&, const T&) [with T = bool; >std::string = std::basic_string<char>] <near match> >/usr/local/include/cppcms/json.h:342:8: note: no known conversion for >implicit ‘this’ parameter from ‘const cppcms::json::value*’ to >‘cppcms::json::value*’ >/usr/local/include/cppcms/json.h:350:8: note: void >cppcms::json::value::set(const char*, const T&) [with T = bool] <near match> >/usr/local/include/cppcms/json.h:350:8: note: no known conversion for >implicit ‘this’ parameter from ‘const cppcms::json::value*’ to >‘cppcms::json::value*’ >make[2]: *** [CMakeFiles/bg.dir/src/backgroundprocessor.cpp.o] Error 1 > >Any suggestions? > >Regards, > >Marcel > >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: Marcel H. <ke...@co...> - 2012-04-24 12:28:31
|
Am 24.04.2012 13:49, schrieb Artyom Beilis: > settings() return cppcms::json::value as const reference- you can't modify > it with set() oh, my fault. (: Any way to have a global access-able json value? > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------------------------------------------------ > *From:* Marcel Hellwig <ke...@co...> > *To:* cpp...@li... > *Sent:* Tuesday, April 24, 2012 12:25 PM > *Subject:* [Cppcms-users] json settings get and set > > Hi everyone, > > I have a strange error when I try to do the following: > > if (hours <= 6 || hours >= 20) { //time between 20 and 6 > if (settings().get("internal.isDay", false) == true) { > cache().rise("TimeChange"); > settings().set("internal.isDay", false); > } > } else { //time between 7 and 19 > if (settings().get("internal.isDay", true) == false) { > cache().rise("TimeChange"); > settings().set("internal.isDay", true); > } > } > > I tried it at first with set<bool> but it does not work either. > The error is: > > /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp: > In > member function 'void BackGroundProcessor::TimeToBackground()': > /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: > > error: no matching function for call to > 'cppcms::json::value::set(const > char [15], bool) const' > /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: > > note: candidates are: > In file included from /usr/local/include/cppcms/service.h:18:0, > from > /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:7: > /usr/local/include/cppcms/json.h:342:8: note: void > cppcms::json::value::set(const string&, const T&) [with T = bool; > std::string = std::basic_string<char>] <near match> > /usr/local/include/cppcms/json.h:342:8: note: no known conversion for > implicit 'this' parameter from 'const cppcms::json::value*' to > 'cppcms::json::value*' > /usr/local/include/cppcms/json.h:350:8: note: void > cppcms::json::value::set(const char*, const T&) [with T = bool] > <near match> > /usr/local/include/cppcms/json.h:350:8: note: no known conversion for > implicit 'this' parameter from 'const cppcms::json::value*' to > 'cppcms::json::value*' > make[2]: *** [CMakeFiles/bg.dir/src/backgroundprocessor.cpp.o] Error 1 > > Any suggestions? > > Regards, > > Marcel > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the latest in > malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > <mailto:Cpp...@li...> > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@ya...> - 2012-04-24 12:51:19
|
>Am 24.04.2012 13:49, schrieb Artyom Beilis: >settings() return cppcms::json::value as const reference- you can't modify >>it with set() >> > oh, my fault. (: > Any way to have a global access-able json value? Create one on your own? Note, that modifying cppcms::json::value object from multiple threads is not safe... So you would have to protect it. > > >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: Marcel Hellwig <ke...@co...> >>>To: cpp...@li... >>>Sent: Tuesday, April 24, 2012 12:25 PM >>>Subject: [Cppcms-users] json settings get and set >>> >>>Hi everyone, >>> >>>I have a strange error when I try to do the following: >>> >>>if (hours <= 6 || hours >= 20) { //time between 20 and 6 >>>if (settings().get("internal.isDay", false) == true) { >>>cache().rise("TimeChange"); >>>settings().set("internal.isDay", false); >>>} >>>} else { //time between 7 and 19 >>>if (settings().get("internal.isDay", true) == false) { >>>cache().rise("TimeChange"); >>>settings().set("internal.isDay", true); >>>} >>>} >>> >>>I tried it at first with set<bool> but it does not work either. >>>The error is: >>> >>>/home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp: In >>>member function ‘void BackGroundProcessor::TimeToBackground()’: >>>/home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: >>>error: no matching function for call to ‘cppcms::json::value::set(const >>>char [15], bool) const’ >>>/home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:36:42: >>>note: candidates are: >>>In file included from /usr/local/include/cppcms/service.h:18:0, >>>from /home/marcel/projects/cppcms/BrowserGame/src/backgroundprocessor.cpp:7: >>>/usr/local/include/cppcms/json.h:342:8: note: void >>>cppcms::json::value::set(const string&, const T&) [with T = bool; >>>std::string = std::basic_string<char>] <near match> >>>/usr/local/include/cppcms/json.h:342:8: note: no known conversion for >>>implicit ‘this’ parameter from ‘const cppcms::json::value*’ to >>>‘cppcms::json::value*’ >>>/usr/local/include/cppcms/json.h:350:8: note: void >>>cppcms::json::value::set(const char*, const T&) [with T = bool] <near match> >>>/usr/local/include/cppcms/json.h:350:8: note: no known conversion for >>>implicit ‘this’ parameter from ‘const cppcms::json::value*’ to >>>‘cppcms::json::value*’ >>>make[2]: *** [CMakeFiles/bg.dir/src/backgroundprocessor.cpp.o] Error 1 >>> >>>Any suggestions? >>> >>>Regards, >>> >>>Marcel >>> >>>------------------------------------------------------------------------------ >>>Live Security Virtual Conference >>>Exclusive live event will cover all the ways today's security and >>>threat landscape has changed and how IT managers can respond. Discussions >>>will include endpoint security, mobile security and the latest in malware >>>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >> >> >>------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> >> >>_______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users > >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |