void FlightSetupPanel::SetBallast() { const bool ballastable = polar_settings.glide_polar_task.IsBallastable(); SetRowVisible(Ballast, ballastable); if (ballastable) LoadValue(Ballast, polar_settings.glide_polar_task.GetBallastLitres()); const fixed wl = polar_settings.glide_polar_task.GetWingLoading(); SetRowVisible(WingLoading, positive(wl)); if (positive(wl)) LoadValue(WingLoading, wl); if (device_blackboard != NULL) { const Plane &plane = CommonInterface::GetComputerSettings().plane; if (positive(plane.dry_mass)) { fixed fraction = polar_settings.glide_polar_task.GetBallast(); fixed overload = (plane.dry_mass + fraction * plane.max_ballast) / plane.dry_mass; MessageOperationEnvironment env; device_blackboard->SetBallast(fraction, overload, env); } } }
void Update(const SwitchState &switches) { LoadValueEnum(AIRBRAKE_STATE, switches.airbrake_state); LoadValueEnum(FLAP_POSITION, (unsigned)switches.flap_position); LoadValue(GEAR_DOWN, switches.vega.GetGearExtended()); LoadValue(ACKNOWLEDGE, switches.vega.GetAcknowledge()); LoadValue(SPEED_COMMAND, switches.vega.GetSpeedCommand()); }
void FlightSetupPanel::SetBallast() { const bool ballastable = polar_settings.glide_polar_task.IsBallastable(); SetRowVisible(Ballast, ballastable); if (ballastable) LoadValue(Ballast, polar_settings.glide_polar_task.GetBallastLitres()); const auto wl = polar_settings.glide_polar_task.GetWingLoading(); SetRowVisible(WingLoading, wl > 0); if (wl > 0) LoadValue(WingLoading, wl, UnitGroup::WING_LOADING); if (device_blackboard != NULL) { const Plane &plane = CommonInterface::GetComputerSettings().plane; if (plane.dry_mass > 0) { auto fraction = polar_settings.glide_polar_task.GetBallast(); auto overload = (plane.dry_mass + fraction * plane.max_ballast) / plane.dry_mass; MessageOperationEnvironment env; device_blackboard->SetBallast(fraction, overload, env); } } }
void PlanePolarWidget::Update() { LoadPolarShape(plane.polar_shape); UpdatePolarLabel(); LoadValue(REFERENCE_MASS, plane.reference_mass); LoadValue(DRY_MASS, plane.dry_mass); }
inline void PlaneEditWidget::PolarButtonClicked() { bool changed = false; if (!Save(changed)) return; dlgPlanePolarShowModal(plane); UpdatePolarButton(); /* reload attributes that may have been modified */ LoadValue(WING_AREA, plane.wing_area); LoadValue(MAX_BALLAST, plane.max_ballast); LoadValue(MAX_SPEED, plane.max_speed, UnitGroup::HORIZONTAL_SPEED); }
void WindSettingsPanel::UpdateVector() { if (!edit_manual_wind) return; const DerivedInfo &calculated = CommonInterface::Calculated(); const WindSettings &settings = CommonInterface::SetComputerSettings().wind; const TCHAR *source = nullptr; switch (manual_modified ? DerivedInfo::WindSource::MANUAL : calculated.wind_source) { case DerivedInfo::WindSource::NONE: source = _("None"); break; case DerivedInfo::WindSource::MANUAL: source = _("Manual"); break; case DerivedInfo::WindSource::CIRCLING: source = _("Circling"); break; case DerivedInfo::WindSource::EKF: source = _("ZigZag"); break; case DerivedInfo::WindSource::EXTERNAL: source = _("External"); break; } SetText(SOURCE, source); if (!manual_modified && !settings.manual_wind_available) { SpeedVector wind = CommonInterface::Calculated().GetWindOrZero(); LoadValue(Speed, Units::ToUserWindSpeed(wind.norm)); LoadValue(Direction, wind.bearing); } const bool visible = settings.manual_wind_available; if (clear_manual_button) SetRowVisible(CLEAR_MANUAL_BUTTON, visible); else if (clear_manual_window != nullptr) clear_manual_window->SetVisible(visible); }
void FontEditWidget::Load() { #ifdef USE_GDI { DataFieldEnum &df = (DataFieldEnum &)GetDataField(FACE); df.SetStringAutoAdd(data.lfFaceName); GetControl(FACE).RefreshDisplay(); } #endif LoadValue(HEIGHT, (int)data.lfHeight); LoadValue(WEIGHT, data.lfWeight > 500); LoadValue(ITALIC, !!data.lfItalic); UpdatePreview(); }
void TaskCalculatorPanel::Refresh() { const auto &calculated = CommonInterface::Calculated(); const TaskStats &task_stats = calculated.ordered_task_stats; TCHAR buffer[32]; if (target_button != nullptr) target_button->SetVisible(task_stats.has_targets); SetRowVisible(AAT_TIME, task_stats.has_targets); if (task_stats.has_targets) { FormatTimespanSmart(buffer, (int)protected_task_manager->GetOrderedTaskSettings().aat_min_time, 2); SetText(AAT_TIME, buffer); } FormatTimespanSmart(buffer, (int)task_stats.GetEstimatedTotalTime(), 2); SetText(AAT_ESTIMATED, buffer); fixed rPlanned = task_stats.total.solution_planned.IsDefined() ? task_stats.total.solution_planned.vector.distance : fixed(0); if (positive(rPlanned)) LoadValue(DISTANCE, rPlanned, UnitGroup::DISTANCE); else ClearValue(DISTANCE); LoadValue(MC, CommonInterface::GetComputerSettings().polar.glide_polar_task.GetMC(), UnitGroup::VERTICAL_SPEED); LoadValue(EFFECTIVE_MC, emc, UnitGroup::VERTICAL_SPEED); if (positive(rPlanned)) { fixed rMax = task_stats.distance_max; fixed rMin = task_stats.distance_min; if (rMin < rMax) { fixed range = Double((rPlanned - rMin) / (rMax - rMin)) - fixed(1); LoadValue(RANGE, range * 100); } else ClearValue(RANGE); } else ClearValue(RANGE); if (task_stats.total.remaining_effective.IsDefined()) LoadValue(SPEED_REMAINING, task_stats.total.remaining_effective.GetSpeed(), UnitGroup::TASK_SPEED); else ClearValue(SPEED_REMAINING); if (task_stats.total.travelled.IsDefined()) LoadValue(SPEED_ACHIEVED, task_stats.total.travelled.GetSpeed(), UnitGroup::TASK_SPEED); else ClearValue(SPEED_ACHIEVED); LoadValue(CRUISE_EFFICIENCY, task_stats.cruise_efficiency * 100); }
void FlightSetupPanel::ShowAltitude(fixed altitude) { if (fabs(altitude - last_altitude) >= fixed(1)) { last_altitude = altitude; LoadValue(Altitude, altitude, UnitGroup::ALTITUDE); } ShowRow(Altitude); }
void WindSettingsPanel::UpdateVector() { if (!edit_manual_wind) return; const DerivedInfo &calculated = CommonInterface::Calculated(); const WindSettings &settings = CommonInterface::SetComputerSettings().wind; const TCHAR *source = nullptr; switch (manual_modified ? DerivedInfo::WindSource::MANUAL : calculated.wind_source) { case DerivedInfo::WindSource::NONE: source = _("None"); break; case DerivedInfo::WindSource::MANUAL: source = _("Manual"); break; case DerivedInfo::WindSource::AUTO: source = _("Auto"); break; case DerivedInfo::WindSource::EXTERNAL: source = _("External"); break; } SetText(SOURCE, source); if (!manual_modified && !settings.manual_wind_available) { SpeedVector wind = CommonInterface::Calculated().GetWindOrZero(); LoadValue(Speed, Units::ToUserWindSpeed(wind.norm)); LoadValue(Direction, wind.bearing); } }
void TaskPropertiesPanel::RefreshView() { const TaskFactoryType ftype = ordered_task->GetFactoryType(); const OrderedTaskBehaviour &p = ordered_task->GetOrderedTaskBehaviour(); bool aat_types = (ftype == TaskFactoryType::AAT); bool fai_start_finish = p.fai_finish; SetRowVisible(MIN_TIME, aat_types); LoadValueTime(MIN_TIME, (int)p.aat_min_time); SetRowVisible(START_MAX_SPEED, !fai_start_finish); LoadValue(START_MAX_SPEED, p.start_max_speed, UnitGroup::HORIZONTAL_SPEED); SetRowVisible(START_MAX_HEIGHT, !fai_start_finish); LoadValue(START_MAX_HEIGHT, fixed(p.start_max_height), UnitGroup::ALTITUDE); SetRowVisible(START_HEIGHT_REF, !fai_start_finish); LoadValueEnum(START_HEIGHT_REF, p.start_max_height_ref); SetRowVisible(FINISH_MIN_HEIGHT, !fai_start_finish); LoadValue(FINISH_MIN_HEIGHT, fixed(p.finish_min_height), UnitGroup::ALTITUDE); SetRowVisible(FINISH_HEIGHT_REF, !fai_start_finish); LoadValueEnum(FINISH_HEIGHT_REF, p.finish_min_height_ref); LoadValue(FAI_FINISH_HEIGHT, p.fai_finish); LoadValueEnum(TASK_TYPE, ftype); if (wTaskView != NULL) wTaskView->Invalidate(); // fixed aat_min_time // finish_min_height }
void TSession::LoadValue( const TStr &Cookie, const TStr &Name, TSessionValue *p) { TStr s; if( LoadValue(Cookie,Name,s) ) { m_ssi::TStringList sl; while( s.Length() > 0 ) { int Len = s.GetBefore("-").ToIntDef(0); TStr n(s.GetBefore(Len)); sl.Add(n.CopyBefore("="),n.CopyAfter("=")); } p->LoadValues(sl); } }
bool PListFile::LoadArray(PListValueVector& array, const XMLElement& arrayElem) { if (!arrayElem) return false; for (XMLElement valueElem = arrayElem.GetChild(); valueElem; valueElem = valueElem.GetNext()) { PListValue value; if (!LoadValue(value, valueElem)) return false; array.Push(value); } return true; }
bool Shader::Load(const void* wrapper) { EntityManager::Ptr entityMgr = EntityManager::Instance(); std::string str; if (!LoadMemberValue(wrapper, "type", str)) { FURYE << "Shader param 'type' not found!"; return false; } m_Type = EnumUtil::ShaderTypeFromString(str); // read shader texture flags std::vector<ShaderTexture> textures; m_TextureFlags = 0; if (LoadArray(wrapper, "textures", [&](const void* node) -> bool { if (!LoadValue(node, str)) { FURYE << "Shader's texture flag not found!"; return false; } textures.push_back(EnumUtil::ShaderTextureFromString(str)); return true; })) { for (auto texture : textures) m_TextureFlags = m_TextureFlags | (unsigned int)texture; } // end: read shader texture flags if (!LoadMemberValue(wrapper, "path", str)) { FURYE << "Shader param 'path' not found!"; return false; } LoadAndCompile(FileUtil::GetAbsPath() + str); return true; }
bool PListFile::LoadDict(PListValueMap& dict, const XMLElement& dictElem) { if (!dictElem) return false; XMLElement keyElem = dictElem.GetChild("key"); XMLElement valueElem = keyElem.GetNext(); while (keyElem && valueElem) { String key = keyElem.GetValue(); valueElem = keyElem.GetNext(); PListValue value; if (!LoadValue(value, valueElem)) return false; dict[key] = value; keyElem = valueElem.GetNext("key"); valueElem = keyElem.GetNext(); } return true; }
void TaskStatusPanel::Refresh() { if (protected_task_manager == nullptr) return; const DerivedInfo &calculated = CommonInterface::Calculated(); const TaskStats &task_stats = calculated.ordered_task_stats; SetRowVisible(TaskTime, task_stats.has_targets); if (task_stats.has_targets) SetText(TaskTime, FormatSignedTimeHHMM((int)protected_task_manager->GetOrderedTaskSettings().aat_min_time)); SetText(ETETime, FormatSignedTimeHHMM((int)task_stats.GetEstimatedTotalTime())); SetText(RemainingTime, FormatSignedTimeHHMM((int)task_stats.total.time_remaining_now)); if (task_stats.total.planned.IsDefined()) SetText(TaskDistance, FormatUserDistanceSmart(task_stats.total.planned.GetDistance())); else ClearText(TaskDistance); if (task_stats.total.remaining.IsDefined()) SetText(RemainingDistance, FormatUserDistanceSmart(task_stats.total.remaining.GetDistance())); if (task_stats.total.planned.IsDefined()) SetText(EstimatedSpeed, FormatUserTaskSpeed(task_stats.total.planned.GetSpeed())); else ClearText(EstimatedSpeed); if (task_stats.total.travelled.IsDefined()) SetText(AverageSpeed, FormatUserTaskSpeed(task_stats.total.travelled.GetSpeed())); else ClearText(AverageSpeed); LoadValue(MC, CommonInterface::GetComputerSettings().polar.glide_polar_task.GetMC(), UnitGroup::VERTICAL_SPEED); if (task_stats.total.planned.IsDefined()) { auto rMax = task_stats.distance_max; auto rMin = task_stats.distance_min; if (rMin < rMax) { auto range = 2 * (task_stats.total.planned.GetDistance() - rMin) / (rMax - rMin) - 1; LoadValue(RANGE, range * 100); } else ClearValue(RANGE); } else ClearValue(RANGE); if (task_stats.total.remaining_effective.IsDefined()) LoadValue(SPEED_REMAINING, task_stats.total.remaining_effective.GetSpeed(), UnitGroup::TASK_SPEED); else ClearValue(SPEED_REMAINING); LoadValue(EFFECTIVE_MC, task_stats.effective_mc, UnitGroup::VERTICAL_SPEED); if (task_stats.total.travelled.IsDefined()) LoadValue(SPEED_ACHIEVED, task_stats.total.travelled.GetSpeed(), UnitGroup::TASK_SPEED); else ClearValue(SPEED_ACHIEVED); LoadValue(CRUISE_EFFICIENCY, task_stats.cruise_efficiency * 100); }
int32_t Consensus::LoadValue(const std::string &name, int64_t &value) { std::string strvalue; int32_t ret = LoadValue(name, strvalue); if (ret > 0) value = utils::String::Stoi64(strvalue); return ret; }
nsresult nsMsgFilterList::LoadTextFilters(nsIInputStream *aStream) { nsresult err = NS_OK; uint64_t bytesAvailable; nsCOMPtr<nsIInputStream> bufStream; err = NS_NewBufferedInputStream(getter_AddRefs(bufStream), aStream, 10240); NS_ENSURE_SUCCESS(err, err); nsMsgFilterFileAttribValue attrib; nsCOMPtr<nsIMsgRuleAction> currentFilterAction; // We'd really like to move lot's of these into the objects that they refer to. do { nsAutoCString value; nsresult intToStringResult; char curChar; curChar = LoadAttrib(attrib, bufStream); if (curChar == (char) -1) //reached eof break; err = LoadValue(value, bufStream); if (NS_FAILED(err)) break; switch(attrib) { case nsIMsgFilterList::attribNone: if (m_curFilter) m_curFilter->SetUnparseable(true); break; case nsIMsgFilterList::attribVersion: m_fileVersion = value.ToInteger(&intToStringResult); if (NS_FAILED(intToStringResult)) { attrib = nsIMsgFilterList::attribNone; NS_ASSERTION(false, "error parsing filter file version"); } break; case nsIMsgFilterList::attribLogging: m_loggingEnabled = StrToBool(value); m_unparsedFilterBuffer.Truncate(); //we are going to buffer each filter as we read them, make sure no garbage is there m_startWritingToBuffer = true; //filters begin now break; case nsIMsgFilterList::attribName: //every filter starts w/ a name { if (m_curFilter) { int32_t nextFilterStartPos = m_unparsedFilterBuffer.RFind("name"); nsAutoCString nextFilterPart; nextFilterPart = Substring(m_unparsedFilterBuffer, nextFilterStartPos, m_unparsedFilterBuffer.Length()); m_unparsedFilterBuffer.SetLength(nextFilterStartPos); bool unparseableFilter; m_curFilter->GetUnparseable(&unparseableFilter); if (unparseableFilter) { m_curFilter->SetUnparsedBuffer(m_unparsedFilterBuffer); m_curFilter->SetEnabled(false); //disable the filter because we don't know how to apply it } m_unparsedFilterBuffer = nextFilterPart; } nsMsgFilter *filter = new nsMsgFilter; if (filter == nullptr) { err = NS_ERROR_OUT_OF_MEMORY; break; } filter->SetFilterList(static_cast<nsIMsgFilterList*>(this)); if (m_fileVersion == k45Version) { nsAutoString unicodeStr; err = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(), value, unicodeStr); if (NS_FAILED(err)) break; filter->SetFilterName(unicodeStr); } else { // ### fix me - this is silly. PRUnichar *unicodeString = nsTextFormatter::smprintf(unicodeFormatter, value.get()); filter->SetFilterName(nsDependentString(unicodeString)); nsTextFormatter::smprintf_free(unicodeString); } m_curFilter = filter; m_filters.AppendElement(filter); } break; case nsIMsgFilterList::attribEnabled: if (m_curFilter) m_curFilter->SetEnabled(StrToBool(value)); break; case nsIMsgFilterList::attribDescription: if (m_curFilter) m_curFilter->SetFilterDesc(value); break; case nsIMsgFilterList::attribType: if (m_curFilter) { // Older versions of filters didn't have the ability to turn on/off the // manual filter context, so default manual to be on in that case int32_t filterType = value.ToInteger(&intToStringResult); if (m_fileVersion < kManualContextVersion) filterType |= nsMsgFilterType::Manual; m_curFilter->SetType((nsMsgFilterTypeType) filterType); } break; case nsIMsgFilterList::attribScriptFile: if (m_curFilter) m_curFilter->SetFilterScript(&value); break; case nsIMsgFilterList::attribAction: if (m_curFilter) { nsMsgRuleActionType actionType = nsMsgFilter::GetActionForFilingStr(value); if (actionType == nsMsgFilterAction::None) m_curFilter->SetUnparseable(true); else { err = m_curFilter->CreateAction(getter_AddRefs(currentFilterAction)); NS_ENSURE_SUCCESS(err, err); currentFilterAction->SetType(actionType); m_curFilter->AppendAction(currentFilterAction); } } break; case nsIMsgFilterList::attribActionValue: if (m_curFilter && currentFilterAction) { nsMsgRuleActionType type; currentFilterAction->GetType(&type); if (type == nsMsgFilterAction::MoveToFolder || type == nsMsgFilterAction::CopyToFolder) err = m_curFilter->ConvertMoveOrCopyToFolderValue(currentFilterAction, value); else if (type == nsMsgFilterAction::ChangePriority) { nsMsgPriorityValue outPriority; nsresult res = NS_MsgGetPriorityFromString(value.get(), outPriority); if (NS_SUCCEEDED(res)) currentFilterAction->SetPriority(outPriority); else NS_ASSERTION(false, "invalid priority in filter file"); } else if (type == nsMsgFilterAction::Label) { // upgrade label to corresponding tag/keyword nsresult res; int32_t labelInt = value.ToInteger(&res); if (NS_SUCCEEDED(res)) { nsAutoCString keyword("$label"); keyword.Append('0' + labelInt); currentFilterAction->SetType(nsMsgFilterAction::AddTag); currentFilterAction->SetStrValue(keyword); } } else if (type == nsMsgFilterAction::JunkScore) { nsresult res; int32_t junkScore = value.ToInteger(&res); if (NS_SUCCEEDED(res)) currentFilterAction->SetJunkScore(junkScore); } else if (type == nsMsgFilterAction::Forward || type == nsMsgFilterAction::Reply || type == nsMsgFilterAction::AddTag || type == nsMsgFilterAction::Custom) { currentFilterAction->SetStrValue(value); } } break; case nsIMsgFilterList::attribCondition: if (m_curFilter) { if (m_fileVersion == k45Version) { nsAutoString unicodeStr; err = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(), value, unicodeStr); if (NS_FAILED(err)) break; char *utf8 = ToNewUTF8String(unicodeStr); value.Assign(utf8); nsMemory::Free(utf8); } err = ParseCondition(m_curFilter, value.get()); if (err == NS_ERROR_INVALID_ARG) err = m_curFilter->SetUnparseable(true); NS_ENSURE_SUCCESS(err, err); } break; case nsIMsgFilterList::attribCustomId: if (m_curFilter && currentFilterAction) { err = currentFilterAction->SetCustomId(value); NS_ENSURE_SUCCESS(err, err); } break; } } while (NS_SUCCEEDED(bufStream->Available(&bytesAvailable))); if (m_curFilter) { bool unparseableFilter; m_curFilter->GetUnparseable(&unparseableFilter); if (unparseableFilter) { m_curFilter->SetUnparsedBuffer(m_unparsedFilterBuffer); m_curFilter->SetEnabled(false); //disable the filter because we don't know how to apply it } } return err; }
static void LoadPoint(PolarShapeEditWidget::PointEditor &pe, const PolarPoint &point) { LoadValue(*pe.v, point.v, UnitGroup::HORIZONTAL_SPEED); LoadValue(*pe.w, point.w, UnitGroup::VERTICAL_SPEED); }
/********************************************************************* * * FUNCTION: WebApiRead * * ARGUMENTS: fat_index Index of the file system table entry * wLen Lenght of the request string from the web page * bSession Http session * * RETURNS: None * * DESCRIPTION: * *********************************************************************/ void WebApiRead (BYTE fat_index, UINT16 wLen, BYTE bSession) { USR_DYNAMIC_FIELDS* StringFieldPtr; UINT16 ValuePairEnd; BYTE tmpbuf [100]; char szName [32]; char szValue[32]; fat_index++; // evitar warning (void)strcpy((char*)sndbuf, scsHeader); do { ValuePairEnd = GetNameValuePair(wLen, szName, szValue); StringFieldPtr = FindTableName(szName, (USR_DYNAMIC_FIELDS *)(StringFields)); if(StringFieldPtr != NULL) { if ( StringFieldPtr->fieldDataSource != NULL ) { LoadValue((char*)tmpbuf, sizeof(tmpbuf),StringFieldPtr); if ( (sizeof(sndbuf) - strlen((char*)sndbuf)) > strlen((char*)tmpbuf)) { (void)strcat((char*)sndbuf, (char*)tmpbuf); } else { https[bSession].fstart = (UINT32)https_ack_page_Bad; https[bSession].flen = strlen((char *)https_ack_page_Bad); https[bSession].fstart |= (UINT32)0xF0000000; https[bSession].fpoint = 0; https[bSession].funacked = 0; return; } } else if ( StringFieldPtr->GetVarFunction != NULL ) { (void)memset ((char*)tmpbuf, 0x00, sizeof(tmpbuf) ); StringFieldPtr->GetVarFunction(StringFieldPtr->FunctionParam, StringFieldPtr->FunctionLen, (void*)tmpbuf); if ( (sizeof(sndbuf) - strlen((char*)sndbuf)) > strlen((char*)tmpbuf)) { (void)strcat((char*)sndbuf, (char*)tmpbuf); } else { https[bSession].fstart = (UINT32)https_ack_page_Bad; https[bSession].flen = strlen((char *)https_ack_page_Bad); https[bSession].fstart |= (UINT32)0xF0000000; https[bSession].fpoint = 0; https[bSession].funacked = 0; return; } } } wLen -= ValuePairEnd; }while(ValuePairEnd); (void)strcpy((char*)tmpbuf, scsTrailer); // para poder obtener la longitud del string if ( (sizeof(sndbuf) - strlen((char*)sndbuf)) > strlen((char*)tmpbuf)) { (void)strcat((char*)sndbuf, scsTrailer); https[bSession].fstart = (UINT32)sndbuf; https[bSession].flen = strlen((char*)sndbuf); } else { #if DEBUG_AT(DBG_LEVEL_3) if (SYS_ConfigParam.DebugLevel>= DBG_LEVEL_3) { (void)sprintf((char *)udp_buf,"WebRead: buf:%d, used:%d, need:%d \n", sizeof(sndbuf) , strlen((char*)sndbuf), strlen((char*)tmpbuf) ); udp_data_to_send = TRUE; } #endif https[bSession].fstart = (UINT32)https_ack_page_Bad; https[bSession].flen = strlen((char *)https_ack_page_Bad); } https[bSession].fstart |= (UINT32)0xF0000000; https[bSession].fpoint = 0; https[bSession].funacked = 0; return; }
void Update(const SwitchState &switches) { LoadValueEnum(USER_SWITCH, switches.user_switch); LoadValue(FLIGHT_MODE, switches.flight_mode == SwitchState::FlightMode::CIRCLING); }
bool Pass::Load(const void* wrapper) { EntityUtil::Ptr entityUtil = EntityUtil::Instance(); EnumUtil::Ptr enumUtil = EnumUtil::Instance(); std::string str; if (!IsObject(wrapper)) return false; if (!LoadMemberValue(wrapper, "camera", str)) { LOGE << "Pass param 'camera' not found!"; return false; } if (auto camNode = entityUtil->FindEntity<SceneNode>(str)) SetCameraNode(camNode); if (!LoadMemberValue(wrapper, "blendMode", str)) { LOGE << "Pass param 'blendMode' not found!"; return false; } SetBlendMode(enumUtil->BlendModeFromString(str)); if (!LoadMemberValue(wrapper, "compareMode", str)) { LOGE << "Pass param 'compareMode' not found!"; return false; } SetCompareMode(enumUtil->CompareModeFromString(str)); if (!LoadMemberValue(wrapper, "cullMode", str)) { LOGE << "Pass param 'cullMode' not found!"; return false; } SetCullMode(enumUtil->CullModeFromString(str)); if (!LoadMemberValue(wrapper, "drawMode", str)) { LOGE << "Pass param 'drawMode' not found!"; return false; } SetDrawMode(enumUtil->DrawModeFromString(str)); if (!LoadMemberValue(wrapper, "index", (int&)m_RenderIndex)) { LOGE << "Pass param 'index' not found!"; return false; } if (!LoadArray(wrapper, "shaders", [&](const void* node) -> bool { if (!LoadValue(node, str)) { LOGE << "Pass's shader name not found!"; return false; } if (auto shader = entityUtil->FindEntity<Shader>(str)) { AddShader(shader); return true; } else { LOGW << "Shader " << str << " not found!"; return false; } })) return false; if (!LoadArray(wrapper, "input", [&](const void* node) -> bool { if (!LoadValue(node, str)) { LOGE << "Pass's inputTexture name not found!"; return false; } if (auto texture = entityUtil->FindEntity<Texture>(str)) { AddTexture(texture, true); return true; } else { LOGW << "Input Texture " << str << " not found!"; return false; } })) return false; if (!LoadArray(wrapper, "output", [&](const void* node) -> bool { if (!LoadValue(node, str)) { LOGE << "Pass's outputTexture name not found!"; return false; } if (auto texture = entityUtil->FindEntity<Texture>(str)) { AddTexture(texture, false); return true; } else { LOGW << "Output Texture " << str << " not found!"; return false; } })) return false; return true; }
void RowFormWidget::LoadValue(unsigned i, Angle value) { LoadValue(i, value.Degrees()); }
/********************************************************************* * * FUNCTION: DemoXML * * ARGUMENTS: fat_index Index of the file system table entry * wLen Lenght of the request string from the web page * bSession Http session * * RETURNS: None * * DESCRIPTION: Builds the XML tags and send it to the web page to populate the page * * RESTRICTIONS: * *********************************************************************/ void DemoXML(BYTE fat_index, WORD wLen, BYTE bSession) { // static BYTE sndbuf[512]; static BYTE sndbuf[450]; BYTE tmpbuf[100]; WORD i = 0; USR_DYNAMIC_INITIALIZE * StringFieldPtr; // fat_index++; //not used - stops compiler warning wLen++; //not used - stops compiler warning (void)strcpy((char*)sndbuf, scsHeader); switch (fat_index){ case 1: StringFieldPtr = (USR_DYNAMIC_INITIALIZE *)StringStatistic; break; case 3: // DataObs.xml = Campo de observaciones (void)strcat((char*)sndbuf, (char*)"<par_HW_obs>"); eeprom_read_buffer(EE_ADDR_VER_TEXT,(UINT8*)tmpbuf,30); (void)strcat((char*)sndbuf, (char*)tmpbuf); (void)strcat((char*)sndbuf, (char*)"</par_HW_obs>\n"); (void)strcat((char*)sndbuf, scsTrailer); https[bSession].fstart = (UINT32)sndbuf; https[bSession].fstart |= (UINT32)0xF0000000; https[bSession].flen = strlen((char*)sndbuf); https[bSession].fpoint = 0; https[bSession].funacked = 0; return; break; #ifdef DNP_MASTER_MODE case 4: StringFieldPtr = (USR_DYNAMIC_INITIALIZE *)Socket_01; break; case 5: StringFieldPtr = (USR_DYNAMIC_INITIALIZE *)Socket_02; break; case 6: StringFieldPtr = (USR_DYNAMIC_INITIALIZE *)Socket_03; break; #endif default: StringFieldPtr = (USR_DYNAMIC_INITIALIZE *)StringFields; break; } while (StringFieldPtr[i].fieldDataSource != NULL) { LoadValue((char*)tmpbuf, sizeof(tmpbuf),(USR_DYNAMIC_INITIALIZE *)&StringFieldPtr[i]); (void)strcat((char*)sndbuf, (char*)tmpbuf); i++; } (void)strcat((char*)sndbuf, scsTrailer); // ABR: agregar verificación de longitud máxima.. (ToDo) /* Modify structure */ https[bSession].fstart = (UINT32)sndbuf; https[bSession].fstart |= (UINT32)0xF0000000; https[bSession].flen = strlen((char*)sndbuf); https[bSession].fpoint = 0; https[bSession].funacked = 0; }