当前位置: 首页>>代码示例>>C++>>正文


C++ StringBuffer::GetBuffer方法代码示例

本文整理汇总了C++中StringBuffer::GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::GetBuffer方法的具体用法?C++ StringBuffer::GetBuffer怎么用?C++ StringBuffer::GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuffer的用法示例。


在下文中一共展示了StringBuffer::GetBuffer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: load_sensors_config

bool Sprinkler::load_sensors_config() {
	StringBuffer sb;
		Vector<SensorPtr> new_sensors;


	// Load sensors
	bool ret = Communication::GetWebPage(SENSORS_CONFIGURATION_URL, sb);
	if (ret)
			ret = JSON::parse_sensors(sb.GetBuffer(), new_sensors);
	if(ret)
	{
		// Check if need to update sensors.
		if(sensors.size() != new_sensors.size()) {
			sensors = new_sensors;
		}
		else {
			const unsigned int number_of_sensors = sensors.size();
			for(unsigned int sensor_index = 0 ; sensor_index < number_of_sensors ; sensor_index++) {
				if(sensors[sensor_index]->UpdateFrom(new_sensors[sensor_index].get())) {
					sensors[sensor_index] = new_sensors[sensor_index];
				}
			}
		}
		
		// assign listener
		const unsigned int number_of_sensors = sensors.size();
		for(unsigned int sensor_index = 0 ; sensor_index < number_of_sensors ; sensor_index++)
			sensors[sensor_index]->SetListener(this);
	}
	
	return ret;
}
开发者ID:supox,项目名称:sprinkler_arm,代码行数:32,代码来源:Sprinkler.cpp

示例2: load_sprinkler_config

bool Sprinkler::load_sprinkler_config()
{
	StringBuffer sb;
	bool ret = Communication::GetWebPage(SPRINKLER_CONFIGURATION_URL, sb);
	if (ret)
		ret = JSON::parse_sprinkler_configuration(sb.GetBuffer(), *this); // I'll go to hell bcz of this circular dependency.
	
	return ret;
}
开发者ID:supox,项目名称:sprinkler_arm,代码行数:9,代码来源:Sprinkler.cpp

示例3: load_valves_config

bool Sprinkler::load_valves_config() 
{
	StringBuffer sb;
	bool ret = Communication::GetWebPage(SPRINKLER_VALVES_URL, sb);
	if (ret) {
		Vector<ValfPtr> new_valves;
		ret = JSON::parse_valves(sb.GetBuffer(), new_valves);
		if(ret)
			valves = new_valves;
	}

	return ret;
}
开发者ID:supox,项目名称:sprinkler_arm,代码行数:13,代码来源:Sprinkler.cpp

示例4: load_time

bool Sprinkler::load_time()
{
	bool ret;
	StringBuffer sb;

	Logger::AddLine("Sprinkler::load_time : Updating clock.", Logger::DUMP);
	ret = Communication::GetWebPage(TIME_URL, sb);
	if (ret) {
		unsigned int current_time = 0;
		ret = JSON::parse_time(sb.GetBuffer(), current_time);
		if(ret)
			TimeManager::SetSystemTime(current_time);
	}

	if(!ret) {
			Logger::AddLine("sprinkler_load_irrigations : failed load irrigations instructions.", Logger::ERROR);
	}
	return ret;

}
开发者ID:supox,项目名称:sprinkler_arm,代码行数:20,代码来源:Sprinkler.cpp

示例5: load_irrigations_instructions

bool Sprinkler::load_irrigations_instructions() {
	// load irrigation definitions
	bool ret;
	StringBuffer sb;

	Logger::AddLine("sprinkler_load_irrigations : Loading irrigations instructions.", Logger::DUMP);
	ret = Communication::GetWebPage(SPRINKLER_IRRIGATION_URL, sb);
	if (ret) {
		Vector<Irrigation> new_irrigations;
		ret = JSON::parse_irrigations(sb.GetBuffer(), new_irrigations);
		if(ret) {
			last_irrigation_load_time = TimeManager::GetSystemTime();
			irrigations = new_irrigations;
		}
	}

	if(!ret) {
			Logger::AddLine("sprinkler_load_irrigations : failed load irrigations instructions.", Logger::ERROR);
	}
	return ret;
}
开发者ID:supox,项目名称:sprinkler_arm,代码行数:21,代码来源:Sprinkler.cpp


注:本文中的StringBuffer::GetBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。