Exemple #1
0
	   static void callback(const json_string & msg){
		  #ifdef JSON_STRING_HEADER
			 echo("callback triggered, but can't display string");
		  #else
			 #ifdef JSON_UNICODE
				const std::string res = std::string(msg.begin(), msg.end());
				echo(res);
			 #else
				echo(msg);
			 #endif
		  #endif
	   }
Exemple #2
0
//Something went wrong or an assert failed
void JSONDebug::_JSON_FAIL(const json_string & msg){
	#ifdef JSON_STDERROR  //no callback, just use stderror
		#ifndef JSON_UNICODE
			std::cerr << msg << std::endl;
		#else
			std::cerr << std::string(msg.begin(), msg.end()) << std::endl;
		#endif
	#else
		if (ErrorCallback){  //only do anything if the callback is registered
			#ifdef JSON_LIBRARY
				ErrorCallback(msg.c_str());
			#else
				ErrorCallback(msg);
			#endif
		}
	#endif
}