コード例 #1
0
void plotly::plot(unsigned long x, float y, char *token){
    reconnectStream();

    char s_[15];
    dtostrf(y,2,3,s_);

    jsonStart(len_(x)+len_(s_)-1);
    print_(x);
    jsonMiddle();
    print_(y);
    jsonEnd(token);
}
コード例 #2
0
ファイル: jsonformatter.cpp プロジェクト: hackorama/plethora
std::string JsonFormatter::format(std::map<std::string, std::string> map) {
	std::string buffer;
	buffer.append(jsonBegin());
	for (std::map<std::string, std::string>::iterator it = map.begin();
	        it != map.end(); it++) {
		buffer.append(format(it->first, it->second));
		if (it != --map.end()) {
			buffer.append(jsonValueSeparator());
			buffer.append(jsonLineFeed());
		}
	}
	buffer.append(jsonEnd());
	return (buffer);
}