本文整理汇总了C++中json::Value::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::get方法的具体用法?C++ Value::get怎么用?C++ Value::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::Value
的用法示例。
在下文中一共展示了Value::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static interface::ModuleMeta load_module_meta(const json::Value &v)
{
interface::ModuleMeta r;
r.disable_cpp = v.get("disable_cpp").as_boolean();
r.cxxflags = v.get("cxxflags").as_string();
r.ldflags = v.get("ldflags").as_string();
r.cxxflags_windows = v.get("cxxflags_windows").as_string();
r.ldflags_windows = v.get("ldflags_windows").as_string();
r.cxxflags_linux = v.get("cxxflags_linux").as_string();
r.ldflags_linux = v.get("ldflags_linux").as_string();
const json::Value &deps_v = v.get("dependencies");
for(unsigned int i = 0; i < deps_v.size(); i++){
const json::Value &dep_v = deps_v.at(i);
interface::ModuleDependency dep = load_module_dependency(deps_v.at(i));
r.dependencies.push_back(dep);
}
const json::Value &rev_deps_v = v.get("reverse_dependencies");
for(unsigned int i = 0; i < rev_deps_v.size(); i++){
interface::ModuleDependency dep = load_module_dependency(rev_deps_v.at(i));
r.reverse_dependencies.push_back(dep);
}
return r;
}
示例2: loadPreferences
void MadeupWindow::loadPreferences() {
canvas->makeCurrent();
try {
std::ifstream in(config_path);
Json::Reader reader;
Json::Value prefs;
reader.parse(in, prefs);
int width = prefs.get("window.width", 1200).asUInt();
int height = prefs.get("window.height", 600).asUInt();
resize(width, height);
int x = prefs.get("window.x", -1).asInt();
int y = prefs.get("window.y", -1).asInt();
if (x >= 0 && y >= 0) {
move(x, y);
}
float stroke_width = (float) prefs.get("path.stroke.width", renderer->getPathStrokeWidth()).asDouble();
renderer->setPathStrokeWidth(stroke_width);
path_stroke_width_spinner->setValue(stroke_width);
float vertex_size = (float) prefs.get("vertex.size", renderer->getVertexSize()).asDouble();
renderer->setVertexSize(vertex_size);
vertex_size_spinner->setValue(vertex_size);
string font_face = prefs.get("font.face", "Courier New").asString();
int font_size = prefs.get("font.size", 18).asUInt();
QFont font;
font.setFamily(font_face.c_str());
font.setPointSize(font_size);
editor->setFont(font);
console->setFont(font);
renderer->showHeading(prefs.get("show.heading", renderer->showHeading()).asBool());
show_heading_checkbox->setChecked(renderer->showHeading());
renderer->showHeading(prefs.get("show.path", renderer->showPath()).asBool());
show_path_checkbox->setChecked(renderer->showPath());
renderer->showStops(prefs.get("show.stops", renderer->showStops()).asBool());
show_stops_checkbox->setChecked(renderer->showStops());
Json::Value show_axis_node = prefs.get("show.axis", Json::nullValue);
Json::Value show_grid_node = prefs.get("show.grid", Json::nullValue);
Json::Value grid_extent_node = prefs.get("grid.extent", Json::nullValue);
Json::Value grid_spacing_node = prefs.get("grid.spacing", Json::nullValue);
for (int d = 0; d < 3; ++d) {
bool show_axis = show_axis_node.get(Json::ArrayIndex(d), renderer->showAxis(d)).asBool();
renderer->showAxis(d, show_axis);
show_axis_checkboxes[d]->setChecked(renderer->showAxis(d));
bool show_grid = show_grid_node.get(Json::ArrayIndex(d), renderer->showGrid(d)).asBool();
renderer->showGrid(d, show_grid);
show_grid_checkboxes[d]->setChecked(renderer->showGrid(d));
float grid_extent = (float) grid_extent_node.get(Json::ArrayIndex(d), renderer->getGridExtent(d)).asDouble();
renderer->setGridExtent(d, grid_extent);
grid_extent_spinners[d]->setValue(renderer->getGridExtent(d));
float grid_spacing = (float) grid_spacing_node.get(Json::ArrayIndex(d), renderer->getGridSpacing(d)).asDouble();
renderer->setGridSpacing(d, grid_spacing);
grid_spacing_spinners[d]->setValue(renderer->getGridSpacing(d));
}
// Background color
Json::Value background_color_node = prefs.get("background.color", Json::nullValue);
if (!background_color_node.isNull()) {
td::QVector4<float> color = renderer->getBackgroundColor();
for (int i = 0; i < 4; ++i) {
color[i] = (float) background_color_node.get(i, 0.0).asDouble();
}
renderer->setBackgroundColor(color);
}
QPalette background_color_palette;
background_color_palette.setColor(QPalette::Button, toQColor(renderer->getBackgroundColor()));
background_color_button->setPalette(background_color_palette);
// Path color
Json::Value path_color_node = prefs.get("path.color", Json::nullValue);
if (!path_color_node.isNull()) {
td::QVector4<float> color = renderer->getPathColor();
for (int i = 0; i < 4; ++i) {
color[i] = (float) path_color_node.get(i, 0.0).asDouble();
}
renderer->setPathColor(color);
}
QPalette path_color_palette;
path_color_palette.setColor(QPalette::Button, toQColor(renderer->getPathColor()));
path_color_button->setPalette(path_color_palette);
// Vertex color
Json::Value vertex_color_node = prefs.get("vertex.color", Json::nullValue);
if (!vertex_color_node.isNull()) {
//.........这里部分代码省略.........
示例3: parsePrefab
void Physics::parsePrefab(json::Value& val)
{
const std::string bodyshape = val["shape"].asString();
const std::string bodytype = val["bodytype"].asString();
const bool isBullet = val.get("bullet", 0).asBool();
BodyType type;
if(bodytype == "dynamic") type = Dynamic; else
if(bodytype == "static") type = Static; else
if(bodytype == "kinematic") type = Kinematic;
else szerr << "Unsupported body type: " << bodytype << ErrorStream::error;
if(bodyshape == "box")
{
createBox(
static_cast<float>(val["size"][0U].asDouble()),
static_cast<float>(val["size"][1U].asDouble()),
type, isBullet
);
}
else if(bodyshape == "circle")
{
createCircle(
static_cast<float>(val["radius"].asDouble()),
type, isBullet
);
}
else if(bodyshape == "polygon")
{
std::vector<sf::Vector2f> vertices;
sf::Uint32 count = val["vertices"].size();
for(sf::Uint32 i=0; i < count; i += 2)
{
vertices.push_back(sf::Vector2f(
static_cast<float>(val["vertices"][i+0].asDouble()),
static_cast<float>(val["vertices"][i+1].asDouble())
));
}
createPolygon(vertices, type, isBullet);
}
else
{
szerr << "Unsupported body shape: " << bodyshape << ErrorStream::error;
}
finalizeBody(
static_cast<float>(val["friction"].asDouble()),
static_cast<float>(val["restitution"].asDouble()),
static_cast<float>(val["density"].asDouble())
);
m_body->SetGravityScale(
static_cast<float>(val.get("gravityscale", 1).asDouble())
);
setSpeedLimit(
static_cast<float>(val.get("speedlimit", 0.f).asDouble())
);
}
示例4: LoadChunkFromData
bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int a_UncompressedSize, const AString & a_Data, cWorld * a_World)
{
// Crude data integrity check:
if (a_UncompressedSize < cChunkDef::BlockDataSize)
{
LOGWARNING("Chunk [%d, %d] has too short decompressed data (%d bytes out of %d needed), erasing",
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ,
a_UncompressedSize, cChunkDef::BlockDataSize
);
EraseChunkData(a_Chunk);
return false;
}
// Decompress the data:
AString UncompressedData;
int errorcode = UncompressString(a_Data.data(), a_Data.size(), UncompressedData, (size_t)a_UncompressedSize);
if (errorcode != Z_OK)
{
LOGERROR("Error %d decompressing data for chunk [%d, %d]",
errorcode,
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ
);
return false;
}
if (a_UncompressedSize != (int)UncompressedData.size())
{
LOGWARNING("Uncompressed data size differs (exp %d bytes, got " SIZE_T_FMT ") for chunk [%d, %d]",
a_UncompressedSize, UncompressedData.size(),
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ
);
return false;
}
cEntityList Entities;
cBlockEntityList BlockEntities;
bool IsLightValid = false;
if (a_UncompressedSize > cChunkDef::BlockDataSize)
{
Json::Value root; // will contain the root value after parsing.
Json::Reader reader;
if ( !reader.parse( UncompressedData.data() + cChunkDef::BlockDataSize, root, false ) )
{
LOGERROR("Failed to parse trailing JSON in chunk [%d, %d]!",
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ
);
}
else
{
LoadEntitiesFromJson(root, Entities, BlockEntities, a_World);
IsLightValid = root.get("IsLightValid", false).asBool();
}
}
BLOCKTYPE * BlockData = (BLOCKTYPE *)UncompressedData.data();
NIBBLETYPE * MetaData = (NIBBLETYPE *)(BlockData + MetaOffset);
NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + LightOffset);
NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + SkyLightOffset);
a_World->SetChunkData(
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ,
BlockData, MetaData,
IsLightValid ? BlockLight : NULL,
IsLightValid ? SkyLight : NULL,
NULL, NULL,
Entities, BlockEntities,
false
);
return true;
}
示例5: loadConfigInfo
void GUI::loadConfigInfo()
{
cout << "Loading Config Info\n";
Json::Value root;
Json::Reader reader;
ifstream config(configPath.c_str());
//read all of config file.
string configContents;
if (config)
{
config.seekg(0, std::ios::end);
configContents.resize(config.tellg());
config.seekg(0, std::ios::beg);
config.read(&configContents[0], configContents.size());
config.close();
}
bool parsed = reader.parse(configContents, root);
if(!parsed) return;
//load glyph coloring
int antB = root["color_map"]["glyph"]["antecedent"].get("blue", 105).asInt();
int antG = root["color_map"]["glyph"]["antecedent"].get("green", 0).asInt();
int antR = root["color_map"]["glyph"]["antecedent"].get("red", 0).asInt();
int consB = root["color_map"]["glyph"]["consequent"].get("blue", 0).asInt();
int consG = root["color_map"]["glyph"]["consequent"].get("green", 255).asInt();
int consR = root["color_map"]["glyph"]["consequent"].get("red", 0).asInt();
int conB = root["color_map"]["glyph"]["connect"].get("blue", 164).asInt();
int conG = root["color_map"]["glyph"]["connect"].get("green", 160).asInt();
int conR = root["color_map"]["glyph"]["connect"].get("red", 160).asInt();
int misB = root["color_map"]["glyph"]["missing"].get("blue", 164).asInt();
int misG = root["color_map"]["glyph"]["missing"].get("green", 0).asInt();
int misR = root["color_map"]["glyph"]["missing"].get("red", 160).asInt();
int ramp = root["color_map"].get("ramp", 2).asInt();
colorMappings->glyphAntecedentColor.setRed(antR);
colorMappings->glyphAntecedentColor.setGreen(antG);
colorMappings->glyphAntecedentColor.setBlue(antB);
colorMappings->glyphConsequentColor.setRed(consR);
colorMappings->glyphConsequentColor.setGreen(consG);
colorMappings->glyphConsequentColor.setBlue(consB);
colorMappings->glyphConnectColor.setRed(conR);
colorMappings->glyphConnectColor.setGreen(conG);
colorMappings->glyphConnectColor.setBlue(conB);
colorMappings->glyphMissingColor.setRed(misR);
colorMappings->glyphMissingColor.setGreen(misG);
colorMappings->glyphMissingColor.setBlue(misB);
colorMappings->setColorRamp(this->colorManage->getPredefinedColorRamp(ramp));
//load graph settings.
int granularity = root.get("granularity", 50.0).asDouble();
bool redun = root.get("redundancies", false).asBool();
int ruleMode = root.get("rule_mode", 0).asInt();
bool gridLines = root["graph"].get("grid_lines", true).asBool();
bool skyline = root["graph"].get("skyline", true).asBool();
int skylineCardinality = root["graph"].get("skyline_cardinality_value", 0).asInt();
evCont->setRuleMode(RuleMode(ruleMode));
this->truncateVal = granularity;
evCont->updateRedundancy(redun);
graphInstance->setConfig(gridLines, skyline, redun, RuleMode(ruleMode), skylineCardinality,granularity);
//load default file.
string defaultFile = root.get("default_file", "").asString();
bool successfullyLoaded = pInstance->loadFile(defaultFile);
if(successfullyLoaded) updateForLoadedIndex(QString::fromStdString(defaultFile));
}
示例6: loadFromJson
void SkillCharacter::loadFromJson( Json::Value p_json )
{
this->setIdSkillCharacter(p_json.get(SKILL_JSON_IDCHARACTERSKILL, -1).asInt64());
this->setLevel(p_json.get(SKILL_JSON_LEVEL, 0).asInt());
this->setSkill(FactoryGet::getSkillFactory()->getSkill(p_json.get(SKILL_JSON_IDSKILL, -1).asInt()));
}
示例7: InitializePropertiesFromFile
/* Method to read properties from file and Initialize to Properties Instance.
* Parameters are:
* WIoTP Properties file path.
* Properties instance to get initialized.
*/
bool IOTP_Client::InitializePropertiesFromFile(const std::string& filePath,Properties& prop) {
std::string methodName = __func__;
logger.debug(methodName+" Entry: ");
bool rc = true;
Json::Reader reader;
Json::Value root;
std::filebuf fb;
if (fb.open(filePath, std::ios::in)) {
std::istream is(&fb);
if (!reader.parse(is, root)) {
logger.error("Failed to parse configurations from input file: " +filePath);
fb.close();
rc = false;
}
else {
fb.close();
std::string org = root.get("Organization-ID", "").asString();
if (org.size() == 0) {
logger.error("Failed to parse Organization-ID from given configuration.");
rc = false;
}
else
prop.setorgId(org);
std::string domain = root.get("Domain", "").asString();
if (domain.size() != 0)
prop.setdomain(domain);
std::string deviceType = root.get("Device-Type", "").asString();
if (deviceType.size() == 0) {
logger.error("Failed to parse Device-Type from given configuration.");
rc = false;
}
else
prop.setdeviceType(deviceType);
std::string deviceId = root.get("Device-ID", "").asString();
if (deviceId.size() == 0) {
logger.error("Failed to parse Device-ID from given configuration.");
rc = false;
}
else
prop.setdeviceId(deviceId);
std::string customPort = root.get("Port", "8883").asString();
if (customPort.size() == 0){
logger.error("Failed to parse useClientCertificates from given configuration.");
rc = false;
}
else{
if (prop.getorgId().compare("quickstart") == 0)
prop.setPort(1883);
else
prop.setPort(std::stoi(customPort));
}
if(org.compare("quickstart") != 0) {
std::string username = root.get("Authentication-Method", "").asString();
if (username.size() == 0) {
logger.error("Failed to parse username from given configuration.");
rc = false;
}
else
prop.setauthMethod(username);
std::string password = root.get("Authentication-Token", "").asString();
if (password.size() == 0) {
logger.error("Failed to parse password from given configuration.");
rc = false;
}
else
prop.setauthToken(password);
std::string trustStore = root.get("clientTrustStorePath", "").asString();
if (trustStore.size() == 0) {
logger.error("Failed to parse clientTrustStorePath from given configuration.");
rc = false;
}
else
prop.settrustStore(trustStore);
std::string useCerts = root.get("useClientCertificates", "false").asString();
if (useCerts.size() == 0){
logger.error("Failed to parse useClientCertificates from given configuration.");
rc = false;
}
else{
if (useCerts.compare("true") == 0)
prop.setuseCerts(true);
else
prop.setuseCerts(false);
}
if (prop.getuseCerts()){
//.........这里部分代码省略.........
示例8: Deserialize
//---------------------------------------------------------------------------
void sgStagingCode::Deserialize( Json::Value& root )
{
_table = root.get("table","").asString();
_code = root.get("code","").asString();
_isValid = root.get("is_valid","").asBool();
}
示例9: getSourceFromJson
static inline std::string
getSourceFromJson(Json::Value const &routingDirective) {
return routingDirective.get(routing_keys::source(), "")
.toStyledString();
}
示例10: getDestinationFromJson
static inline std::string
getDestinationFromJson(Json::Value const &routingDirective) {
return routingDirective.get(routing_keys::destination(), "").asString();
}
示例11: process
void lsd_server_t::process(ev::idle&, int) {
if(m_socket.pending()) {
zmq::message_t message;
route_t route;
do {
m_socket.recv(&message);
if(!message.size()) {
break;
}
route.push_back(
std::string(
static_cast<const char*>(message.data()),
message.size()
)
);
} while(m_socket.more());
if(route.empty() || !m_socket.more()) {
log().error("got a corrupted request - invalid route");
return;
}
while(m_socket.more()) {
// Receive the envelope.
m_socket.recv(&message);
// Parse the envelope and setup the job policy.
Json::Reader reader(Json::Features::strictMode());
Json::Value root;
if(!reader.parse(
static_cast<const char*>(message.data()),
static_cast<const char*>(message.data()) + message.size(),
root))
{
log().error(
"got a corrupted request - invalid envelope - %s",
reader.getFormatedErrorMessages().c_str()
);
continue;
}
client::policy_t policy(
root.get("urgent", false).asBool(),
root.get("timeout", 0.0f).asDouble(),
root.get("deadline", 0.0f).asDouble()
);
boost::shared_ptr<lsd_job_t> job;
try {
job.reset(new lsd_job_t(*this, policy, root.get("uuid", "").asString(), route));
} catch(const std::runtime_error& e) {
log().error(
"got a corrupted request - invalid envelope - %s",
e.what()
);
continue;
}
if(!m_socket.more()) {
log().error("got a corrupted request - missing body");
job->process_event(events::error_t(client::request_error, "missing body"));
continue;
}
m_socket.recv(&job->request());
m_engine.enqueue(job);
}
} else {
m_processor.stop();
}
}
示例12: LoadChildOnlineInfo
void CProtectChildManager::LoadChildOnlineInfo()
{
try
{
std::string sJsonStr;
std::string sTemp;
//c++解析utf-8的json文件乱码,还是需要ascii
std::string sFileName = GetAppPathA() + CHILD_FILE_NAME;
if (!IsFileExistsA(sFileName.c_str()))
return;
ifstream configFile;
configFile.open(sFileName);
//--------------------------------
//--------------------------------
//--------------------------------
//--------这里死循环了
while (!configFile.eof())
{
configFile >> sTemp;
sJsonStr.append(sTemp);
}
configFile.close();
Json::Reader reader;
Json::Value root;
if (reader.parse(sJsonStr, root))
{
if (root.isArray())
{
std::string sCD;
std::string sTemp;
Json::Value childItem;
Json::Value roleListItem;
Json::Value roleItem;
POnLineChild pChild = nullptr;
POnLineRoleName pRoleName = nullptr;
for (int i = 0; i < (int)root.size(); i++)
{
childItem = root.get(i, nullptr);
if (childItem == nullptr)
continue;
sCD = childItem.get("CD", "").asString();
if (sCD.compare("") == 0)
return;
pChild = new TOnLineChild();
pChild->sIdentificationID = sCD;
pChild->iOnLineSecond = childItem.get("OS", 0).asInt();
pChild->iOnLinePeriod = childItem.get("OP", 0).asInt();
pChild->uiLogoutTime = childItem.get("LT", 0).asInt64();
m_OnLineChildren.Add(sCD, pChild);
roleListItem = childItem.get("RL", nullptr);
if ((roleListItem != nullptr) && (roleListItem.isArray()))
{
for (int j = 0; j < (int)roleListItem.size(); j++)
{
roleItem = roleListItem.get(j, nullptr);
if (roleItem == nullptr)
continue;
pRoleName = new TOnLineRoleName();
pRoleName->sRoleName = roleItem.get("RN", "").asString();
pRoleName->iServerID = roleItem.get("SD", 0).asInt();
pChild->RoleNameList.push_back(pRoleName);
++m_iTotalChildCount;
}
}
}
}
}
}
catch (...)
{
Log("LoadChildOnlineInfo:", lmtException);
}
}
示例13: AuthWithYggdrasil
bool cAuthenticator::AuthWithYggdrasil(AString & a_UserName, const AString & a_ServerId, AString & a_UUID, Json::Value & a_Properties)
{
LOGD("Trying to authenticate user %s", a_UserName.c_str());
// Create the GET request:
AString ActualAddress = m_Address;
ReplaceString(ActualAddress, "%USERNAME%", a_UserName);
ReplaceString(ActualAddress, "%SERVERID%", a_ServerId);
AString Request;
Request += "GET " + ActualAddress + " HTTP/1.0\r\n";
Request += "Host: " + m_Server + "\r\n";
Request += "User-Agent: MCServer\r\n";
Request += "Connection: close\r\n";
Request += "\r\n";
AString Response;
if (!SecureGetFromAddress(StarfieldCACert(), m_Server, Request, Response))
{
return false;
}
// Check the HTTP status line:
const AString Prefix("HTTP/1.1 200 OK");
AString HexDump;
if (Response.compare(0, Prefix.size(), Prefix))
{
LOGINFO("User %s failed to auth, bad HTTP status line received", a_UserName.c_str());
LOGD("Response: \n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
return false;
}
// Erase the HTTP headers from the response:
size_t idxHeadersEnd = Response.find("\r\n\r\n");
if (idxHeadersEnd == AString::npos)
{
LOGINFO("User %s failed to authenticate, bad HTTP response header received", a_UserName.c_str());
LOGD("Response: \n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
return false;
}
Response.erase(0, idxHeadersEnd + 4);
// Parse the Json response:
if (Response.empty())
{
return false;
}
Json::Value root;
Json::Reader reader;
if (!reader.parse(Response, root, false))
{
LOGWARNING("cAuthenticator: Cannot parse received data (authentication) to JSON!");
return false;
}
a_UserName = root.get("name", "Unknown").asString();
a_UUID = root.get("id", "").asString();
a_Properties = root["properties"];
// If the UUID doesn't contain the hashes, insert them at the proper places:
if (a_UUID.size() == 32)
{
a_UUID.insert(8, "-");
a_UUID.insert(13, "-");
a_UUID.insert(18, "-");
a_UUID.insert(23, "-");
}
return true;
}
示例14: AddAnswer
static void AddAnswer(DicomFindAnswers& answers,
const Json::Value& resource,
const DicomArray& query,
const std::list<DicomTag>& sequencesToReturn,
const DicomMap* counters)
{
DicomMap result;
for (size_t i = 0; i < query.GetSize(); i++)
{
if (query.GetElement(i).GetTag() == DICOM_TAG_QUERY_RETRIEVE_LEVEL)
{
// Fix issue 30 on Google Code (QR response missing "Query/Retrieve Level" (008,0052))
result.SetValue(query.GetElement(i).GetTag(), query.GetElement(i).GetValue());
}
else if (query.GetElement(i).GetTag() == DICOM_TAG_SPECIFIC_CHARACTER_SET)
{
// Do not include the encoding, this is handled by class ParsedDicomFile
}
else
{
std::string tag = query.GetElement(i).GetTag().Format();
std::string value;
if (resource.isMember(tag))
{
value = resource.get(tag, Json::arrayValue).get("Value", "").asString();
result.SetValue(query.GetElement(i).GetTag(), value, false);
}
else
{
result.SetValue(query.GetElement(i).GetTag(), "", false);
}
}
}
if (counters != NULL)
{
DicomArray tmp(*counters);
for (size_t i = 0; i < tmp.GetSize(); i++)
{
result.SetValue(tmp.GetElement(i).GetTag(), tmp.GetElement(i).GetValue().GetContent(), false);
}
}
if (result.GetSize() == 0 &&
sequencesToReturn.empty())
{
LOG(WARNING) << "The C-FIND request does not return any DICOM tag";
}
else if (sequencesToReturn.empty())
{
answers.Add(result);
}
else
{
ParsedDicomFile dicom(result);
for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin();
tag != sequencesToReturn.end(); ++tag)
{
const Json::Value& source = resource[tag->Format()];
if (source.type() == Json::objectValue &&
source.isMember("Type") &&
source.isMember("Value") &&
source["Type"].asString() == "Sequence" &&
source["Value"].type() == Json::arrayValue)
{
Json::Value content = Json::arrayValue;
for (Json::Value::ArrayIndex i = 0; i < source["Value"].size(); i++)
{
Json::Value item;
Toolbox::SimplifyTags(item, source["Value"][i], DicomToJsonFormat_Short);
content.append(item);
}
dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent);
}
}
answers.Add(dicom);
}
}
示例15: deserialize
void Item::deserialize(Json::Value& root) {
_type = root.get("type", 0).asInt();
_count = root.get("count", 0).asInt();
_template = ItemTemplate::getTemplate(_type);
}