MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / get_config_json_from_data_file

Method get_config_json_from_data_file

DSView/pv/mainwindow.cpp:1702–1737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1700 }
1701
1702 QJsonDocument MainWindow::get_config_json_from_data_file(QString file, bool &bSucesss)
1703 {
1704 QJsonDocument sessionDoc;
1705 QJsonParseError error;
1706 bSucesss = false;
1707
1708 if (file == ""){
1709 dsv_err("File name is empty.");
1710 assert(false);
1711 }
1712
1713 auto f_name = pv::path::ConvertPath(file);
1714 ZipReader rd(f_name.c_str());
1715 auto *data = rd.GetInnterFileData("session");
1716
1717 if (data != NULL)
1718 {
1719 QByteArray raw_bytes = QByteArray::fromRawData(data->data(), data->size());
1720 QString jsonStr(raw_bytes.data());
1721 QByteArray qbs = jsonStr.toUtf8();
1722 sessionDoc = QJsonDocument::fromJson(qbs, &error);
1723
1724 if (error.error != QJsonParseError::NoError)
1725 {
1726 QString estr = error.errorString();
1727 dsv_err("File::get_session(), parse json error:\"%s\"!", estr.toUtf8().data());
1728 }
1729 else{
1730 bSucesss = true;
1731 }
1732
1733 rd.ReleaseInnerFileData(data);
1734 }
1735
1736 return sessionDoc;
1737 }
1738
1739 QJsonArray MainWindow::get_decoder_json_from_data_file(QString file, bool &bSucesss)
1740 {

Callers

nothing calls this directly

Calls 5

ConvertPathFunction · 0.85
GetInnterFileDataMethod · 0.80
sizeMethod · 0.80
ReleaseInnerFileDataMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected