本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}