void WareGroupMapper::fromPersistent(Object* object, const ResultRecord& record) { WareGroup* group = (WareGroup*)object; group->setCode(record.getValue(GROUP_CODE)); group->setTitle(record.getValue(GROUP_TITLE)); group->setText(record.getValue(GROUP_TEXT)); group->assignParent(fromString<int>(record.getValue(GROUP_PARENT_ID))); }
void AdditionMapper::fromPersistent(Object* object, const ResultRecord& record) { WareAddition * wa = (WareAddition*) object; WareAdditionInfo wa_info; wa_info.code = record.getValue(ADDITION_CODE); wa_info.article = record.getValue(ADDITION_ARTICLE); wa_info.price = fromString<double>(record.getValue(ADDITION_PRICE)); wa_info.quantity = fromString<double>(record.getValue(ADDITION_QUANTITY)); wa_info.ware_id = fromString<int>(record.getValue(ADDITION_WARE_ID)); wa->replaceInfo(wa_info); }
void TaxRateGrMapper::fromPersistent(Object* object, const ResultRecord& record) { TaxRateGr * taxrategr = (TaxRateGr*)object; TaxRateGrInfo taxrategr_info; taxrategr_info.code = fromString<int>(record.getValue( TAXRATEGR_ID_FIELD )); taxrategr_info.rate_id = fromString<int>(record.getValue( TAXRATEGR_RATE_ID )); taxrategr_info.group_id = fromString<int>(record.getValue( TAXRATEGR_GROUP_ID )); taxrategr_info.switchbase = record.getValue( TAXRATEGR_BASE ) == "t" ? true : false; taxrategr->setInfo(taxrategr_info); }
void MIFrameStackModel::handleThreadInfo(const ResultRecord& r) { const Value& threads = r["threads"]; // Traverse GDB threads in backward order -- since GDB // reports them in backward order. We want UI to // show thread IDs in the natural order. // FIXME: at least GDB 7.11 is reporting in the right order, // consider sort the list afterwards. QList<KDevelop::FrameStackModel::ThreadItem> threadsList; int gidx = threads.size()-1; for (; gidx >= 0; --gidx) { KDevelop::FrameStackModel::ThreadItem i; const Value & threadMI = threads[gidx]; i.nr = threadMI["id"].toInt(); if (threadMI["state"].literal() == "stopped") { i.name = getFunctionOrAddress(threads[gidx]["frame"]); } else { i.name = i18n("(running)"); } threadsList << i; } setThreads(threadsList); if (r.hasField("current-thread-id")) { int currentThreadId = r["current-thread-id"].toInt(); setCurrentThread(currentThreadId); if (session()->hasCrashed()) { setCrashedThreadIndex(currentThreadId); } } }
void MIFrameStackModel::handleThreadInfo(const ResultRecord& r) { const Value& threads = r["threads"]; QList<FrameStackModel::ThreadItem> threadsList; for (int i = 0; i!= threads.size(); ++i) { const auto &threadMI = threads[i]; FrameStackModel::ThreadItem threadItem; threadItem.nr = threadMI["id"].toInt(); if (threadMI["state"].literal() == "stopped") { threadItem.name = getFunctionOrAddress(threadMI["frame"]); } else { i18n("(running)"); } threadsList << threadItem; } // Sort the list by id, some old version of GDB // reports them in backward order. We want UI to // show thread IDs in the natural order. std::sort(threadsList.begin(), threadsList.end(), [](const FrameStackModel::ThreadItem &a, const FrameStackModel::ThreadItem &b){ return a.nr < b.nr; }); setThreads(threadsList); if (r.hasField("current-thread-id")) { int currentThreadId = r["current-thread-id"].toInt(); setCurrentThread(currentThreadId); if (session()->hasCrashed()) { setCrashedThreadIndex(currentThreadId); } } }
void handle(const ResultRecord &r) override { if (!m_variable) return; --m_activeCommands; MIVariable* variable = m_variable.data(); if (r.hasField("children")) { const Value& children = r["children"]; for (int i = 0; i < children.size(); ++i) { const Value& child = children[i]; const QString& exp = child["exp"].literal(); if (exp == "public" || exp == "protected" || exp == "private") { ++m_activeCommands; m_session->addCommand(VarListChildren, QString("--all-values \"%1\"").arg(child["name"].literal()), this/*use again as handler*/); } else { variable->createChild(child); // it's automatically appended to variable's children list } } } /* Note that we don't set hasMore to true if there are still active commands. The reason is that we don't want the user to have even theoretical ability to click on "..." item and confuse us. */ bool hasMore = false; if (r.hasField("has_more")) hasMore = r["has_more"].toInt(); variable->setHasMore(hasMore); if (m_activeCommands == 0) { variable->emitAllChildrenFetched(); delete this; } }
void handle(const ResultRecord &r) override { if (!m_variable) return; bool hasValue = false; MIVariable* variable = m_variable.data(); variable->deleteChildren(); variable->setInScope(true); if (r.reason == "error") { variable->setShowError(true); } else { variable->setVarobj(r["name"].literal()); bool hasMore = false; if (r.hasField("has_more") && r["has_more"].toInt()) // GDB swears there are more children. Trust it hasMore = true; else // There are no more children in addition to what // numchild reports. But, in KDevelop, the variable // is not yet expanded, and those numchild are not // fetched yet. So, if numchild != 0, hasMore should // be true. hasMore = r["numchild"].toInt() != 0; variable->setHasMore(hasMore); variable->setType(r["type"].literal()); variable->setValue(variable->formatValue(r["value"].literal())); hasValue = !r["value"].literal().isEmpty(); if (variable->isExpanded() && r["numchild"].toInt()) { variable->fetchMoreChildren(); } if (variable->format() != KDevelop::Variable::Natural) { //TODO doesn't work for children as they are not yet loaded variable->formatChanged(); } } if (m_callback && m_callbackMethod) { QMetaObject::invokeMethod(m_callback, m_callbackMethod, Q_ARG(bool, hasValue)); } }
void LldbFrameStackModel::handleThreadInfo(const ResultRecord& r) { const Value& threads = r["threads"]; QList<FrameStackModel::ThreadItem> threadsList; for (int gidx = 0; gidx != threads.size(); ++gidx) { FrameStackModel::ThreadItem i; const Value & threadMI = threads[gidx]; i.nr = threadMI["id"].toInt(); if (threadMI["state"].literal() == "stopped") { // lldb-mi returns multiple frame entry for each thread // so can't directly use threadMI["frame"] auto &th = dynamic_cast<const TupleValue&>(threadMI); Value *topFrame = nullptr; for (auto res : th.results) { if (res->variable == "frame") { if (!topFrame || (*res->value)["level"].toInt() < (*topFrame)["level"].toInt()) { topFrame = res->value; } } } i.name = getFunctionOrAddress(*topFrame); } else { i.name = i18n("(running)"); } threadsList << i; } setThreads(threadsList); if (r.hasField("current-thread-id")) { int currentThreadId = r["current-thread-id"].toInt(); setCurrentThread(currentThreadId); if (session()->hasCrashed()) { setCrashedThreadIndex(currentThreadId); } } // lldb-mi doesn't have current-thread-id field. Use the thread-id field when inferiorStopped if (stoppedAtThread != -1) { setCurrentThread(stoppedAtThread); } stoppedAtThread = -1; }
void handle(const ResultRecord &r) override { if(m_variable && r.hasField("value")) m_variable->setValue(m_variable->formatValue(r["value"].literal())); }
void UserProfileMapper::fromPersistent(Object* object, const ResultRecord& record) { UserProfile * profile = (UserProfile*)object; UserProfileInfo p_info; p_info.profile_code = fromString<int>(record.getValue( PROFILE_ID )); p_info.profile_name = record.getValue(PROFILE_NAME); p_info.access_rigths[AR_REGISTRATION_BY_CODE] = record.getValue(PROFILE_R_CODEREG) == "t"; p_info.access_rigths[AR_REGISTRATION_BY_BARCODE] = record.getValue(PROFILE_R_SCANERREG) == "t"; p_info.access_rigths[AR_REGISTRATION_BY_MANUAL_INPUT_BARCODE] = record.getValue(PROFILE_R_BARCODEMANUALREG) == "t"; p_info.access_rigths[AR_REGISTRATION_BY_VISUAL_SEARCH] = record.getValue(PROFILE_R_VSREG) == "t"; p_info.access_rigths[AR_REGISTRATION_CANCEL] = record.getValue(PROFILE_R_CANCELREG) == "t"; p_info.access_rigths[AR_QUANTITY_EDITION] = record.getValue(PROFILE_R_QUANTITYEDITION) == "t"; p_info.access_rigths[AR_PRICE_EDITION] = record.getValue(PROFILE_R_PRICEEDITION) == "t"; p_info.access_rigths[AR_REGISTRATION_REPEAT] = record.getValue(PROFILE_R_REGISTRATION_REPEAT) == "t"; p_info.access_rigths[AR_CHECK_CANCEL] = record.getValue(PROFILE_R_CHECK_CANCEL) == "t"; p_info.access_rigths[AR_MANUAL_DISCOUNT] = record.getValue(PROFILE_R_MANUAL_DISCOUNT) == "t"; p_info.access_rigths[AR_FIXED_DISCOUNT] = record.getValue(PROFILE_R_FIXED_DISCOUNT) == "t"; p_info.access_rigths[AR_DISCOUNT_CANCEL] = record.getValue(PROFILE_R_DISCOUNT_CANCEL) == "t"; p_info.access_rigths[AR_RETURN_BY_NUMBER] = record.getValue(PROFILE_R_RETURN_BY_NUMBER) == "t"; p_info.access_rigths[AR_RETURN_MANUAL] = record.getValue(PROFILE_R_RETURN_MANUAL) == "t"; p_info.access_rigths[AR_CASH_PAYMENT] = record.getValue(PROFILE_R_CASH_PAYMENT) == "t"; p_info.access_rigths[AR_CREDIT_PAYMENT] = record.getValue(PROFILE_R_CREDIT_PAYMENT) == "t"; p_info.access_rigths[AR_CONT_PAYMENT] = record.getValue(PROFILE_R_CONT_PAYMENT) == "t"; p_info.access_rigths[AR_Z_REPORT] = record.getValue(PROFILE_R_Z_REPORT) == "t"; p_info.access_rigths[AR_OTHER_REPORT] = record.getValue(PROFILE_R_OTHER_REPORT) == "t"; p_info.access_rigths[AR_KKM_SYNCHRONIZATION] = record.getValue(PROFILE_R_KKM_SYNCHRONIZATION) == "t"; p_info.access_rigths[AR_ENTERING] = record.getValue(PROFILE_R_ENTERING) == "t"; p_info.access_rigths[AR_GETTING] = record.getValue(PROFILE_R_GETTING) == "t"; p_info.access_rigths[AR_CHECK_COPY] = record.getValue(PROFILE_R_CHECK_COPY) == "t"; p_info.access_rigths[AR_OPEN_BOX] = record.getValue(PROFILE_R_OPEN_BOX) == "t"; p_info.access_rigths[AR_PROGRAMM_SETUP] = record.getValue(PROFILE_R_PROGRAMM_SETUP) == "t"; p_info.access_rigths[AR_HANDLE_UNLOAD] = record.getValue(PROFILE_R_HANDLE_UNLOAD) == "t"; p_info.access_rigths[AR_HANDLE_UPLOAD] = record.getValue(PROFILE_R_HANDLE_UPLOAD) == "t"; p_info.access_rigths[AR_PS_RECONSILIATION] = record.getValue(PROFILE_R_PS_RECONSILIATION) == "t"; profile->replaceInfo(p_info); }