Example #1
0
void CMultiColumnList::AddRow(LPCSTR text){
	if (m_nSortBy == -1) {
		m_vRows.push_back(string(text));
	} else {

		// TODO: TEST THIS, it probably doesn't work
		// put it in to the vector in the right position
		vector<string>::iterator it = m_vRows.begin();
		string item(GetNthItemInRow(string(text), m_nSortBy));
		int row = 0;
		for (; it != m_vRows.end(); it++){
			string rowitem(GetNthItemInRow(m_vRows[row], m_nSortBy));
			if (rowitem.compare(item) > 0) {
				m_vRows.insert(it, string(text));
				break;
			}
			row++;
		}
	}
	UpdateBounds();
}
void StreamTimerListe::SerializeAjax( Json::Value& root )
{
   // serialize primitives
	int size = LD_StreamListe.size();

	Json::Value timer_value(Json::arrayValue); // []
	Json::Value row(Json::arrayValue);
	Json::Value rowitem(Json::arrayValue);
	Json::Value rowdata(Json::arrayValue);
	Json::Value ledvalues(Json::arrayValue);
	Json::Value zeile(Json::objectValue);
	//arr_value.append("Test1");
	//arr_value.append("Test2");
	Json::Value obj_value(Json::objectValue);
	for(int i=0; i<size; i++)
	{
		for (int ii=0;ii<TIMERSTORECOUNT;ii++)
		{
			ledvalues.append(LD_StreamListe[i].getLdTimeArray()[ii]);
		}
		zeile["id"]   = LD_StreamListe[i].getLdNumber();
		rowitem.append(LD_StreamListe[i].getLdNumber());
		rowitem.append(LD_StreamListe[i].getLdName());
		rowitem.append(LD_StreamListe[i].getLdI2cChannel());
		rowitem.append(ledvalues);
		rowitem.append(LD_StreamListe[i].getChartColor());
		zeile["cell"] = rowitem;

		root["StreamListe"].append(zeile);
		ledvalues.clear();
		rowitem.clear();
	}
	// version tag into stream
	root["version"] = "2.0";
	root["fooddelay"] = FOOD_DELAY;								// Time in Sec that the streams are in food mode
	root["foodpower"] = FOOD_MIN_POWER;
}