本文整理汇总了C++中ptree::put方法的典型用法代码示例。如果您正苦于以下问题:C++ ptree::put方法的具体用法?C++ ptree::put怎么用?C++ ptree::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ptree
的用法示例。
在下文中一共展示了ptree::put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/// \brief Save the specified coord to the specified Boost Property Tree ptree
///
/// \relates coord
void cath::geom::save_to_ptree(ptree &arg_ptree, ///< The ptree to which the coord should be saved
const coord &arg_coord ///< The coord to be saved
) {
arg_ptree.put( "x", arg_coord.get_x() );
arg_ptree.put( "y", arg_coord.get_y() );
arg_ptree.put( "z", arg_coord.get_z() );
}
示例2: WritePtree
void ProjectConfiguration::WritePtree(ptree& pt,
const wxString& proj_path)
{
pt.put("project.title", project_title);
ptree& subtree = pt.put("project.layers.layer","");
layer_confs[0]->WritePtree(subtree, proj_path);
}
示例3: save
void save(ptree & pt)
{
LOG(LTRACE) << "CvFindChessboardCornersProps::save()\n";
pt.put("width", patternSize.width);
pt.put("height", patternSize.height);
pt.put("squareSize", squareSize);
pt.put("findSubpix", findSubpix);
}
示例4: saveHelper
void EnvObject::saveHelper( ptree &tree ) {
tree.put("x", xCoordinate);
tree.put("y", yCoordinate);
tree.put("width", width);
tree.put("height", height);
tree.put("temp", temp);
tree.put("source", source);
}
示例5: save
/*!
* \copydoc Base::Props::save
*/
void save(ptree & pt)
{
pt.put("dev.device", device);
pt.put("dev.input", input);
pt.put("dev.norm", norm);
pt.put("dev.format", format);
pt.put("dev.width", width);
pt.put("dev.height", height);
pt.put("image.brightness", brightness);
pt.put("image.contrast", contrast);
pt.put("image.saturation", saturation);
pt.put("image.hue", hue);
}
示例6: write
void DeviceMatcher::write(const DeviceMatcher &matcher,ptree& writeTo){
writeTo.put(CLASS_NAME_KEY,matcher.className());
matcher.writeSelf(writeTo);
}
示例7: put
//for yaw and pitch
std::string JsonObj::put(std::string& data, ptree& node){
node.put("",data);
//savoir si c'est l'arbre yaw ou pitch
std::ostringstream buf;
write_json (buf, node, false);
std::string json = buf.str();
}
示例8: api_call
ptree api_call(const Remote &r, const String &api, ptree request)
{
request.put("auth.user", r.user);
request.put("auth.token", r.token);
HttpRequest req = httpSettings;
req.type = HttpRequest::POST;
req.url = r.url + "/api/" + api;
req.data = ptree2string(request);
auto resp = url_request(req);
auto ret = string2ptree(resp.response);
if (resp.http_code != 200)
{
auto e = ret.get<String>("error", "");
throw std::runtime_error(e);
}
return string2ptree(resp.response);
}
示例9: ptreeFromParam
bool ConfigTree::ptreeFromParam(ConfigParameter fromParam, ptree &toPtree)
{
CONFIGSYS_DEBUG_CALLS;
toPtree = ptree();
toPtree.put("desc", fromParam.getDescription());
std::string modStr = (fromParam.isModified())? "true" : "false";
toPtree.put("modified", modStr);
std::string lockStr = (fromParam.isLocked())? "true" : "false";
toPtree.put("locked", lockStr);
value_type vt = fromParam.getType();
std::string typStr = makeValueTypeString(vt);
toPtree.put("type", typStr);
return addParamValueandRangeToPtree(fromParam, toPtree);
}
示例10: process_pde_element
void process_pde_element(PdeElementP element, ptree& node) {
if (!element) return;
node.put("id", element->GetId());
PdfRect bbox;
element->GetBBox(&bbox);
node.put("left", bbox.left);
node.put("bottom", bbox.bottom);
node.put("right", bbox.right);
node.put("top", bbox.top);
switch (element->GetType())
{
case kPdeText:
case kPdeTextLine:
case kPdeWord:
process_pde_text((PdeText*)element, node);
break;
case kPdeImage:
process_pde_image((PdeImage*)element, node);
break;
case kPdePath:
case kPdeLine:
case kPdeRect:
process_pde_path((PdePath*)element, node);
break;
case kPdeTable:
process_pde_table((PdeTable*)element, node);
break;
default:
break;
}
auto num_childs = element->GetNumChildren();
for (auto i = 0; i < num_childs; i++) {
ptree elem_node;
PdeElementP child = element->GetChild(i);
process_pde_element(child, elem_node);
node.add_child("element", elem_node);
}
}
示例11: save
void CameraProps::save(ptree & pt) {
pt.put("device.device", device);
pt.put("device.io", convIOMethod(io));
pt.put("device.video_standard", convStandard(standard));
pt.put("device.width", width);
pt.put("device.height", height);
pt.put("device.channel", channel);
}
示例12: save
void save(ptree & pt) {
pt.put("directory", directory);
pt.put("pattern", pattern);
pt.put("sort", sort);
pt.put("prefetch", prefetch);
pt.put("triggered", triggered);
pt.put("loop", loop);
}
示例13: process_pde_text
void process_pde_text(PdeTextP text, ptree& node) {
PdfTextState ts;
switch (text->GetType())
{
case kPdeText:
{
node.put("type", "text_paragraph");
std::wstring s;
s.resize(text->GetText(nullptr, 0));
text->GetText((wchar_t*)s.c_str(), s.size());
node.put("text", w2utf8(s.c_str()));
text->GetTextState(&ts);
auto num_lines = text->GetNumTextLines();
for (auto i = 0; i < num_lines; i++) {
ptree line_node;
PdeTextLineP text_line = text->GetTextLine(i);
process_pde_element((PdeElementP)text_line, line_node);
node.add_child("element", line_node);
}
}
break;
case kPdeTextLine:
{
PdeTextLineP text_line = (PdeTextLine*)text;
node.put("type", "text_line");
std::wstring s;
s.resize(text_line->GetText(nullptr, 0));
text_line->GetText((wchar_t*)s.c_str(), s.size());
node.put("text", w2utf8(s.c_str()));
text_line->GetTextState(&ts);
auto num_word = text_line->GetNumWords();
for (auto i = 0; i < num_word; i++) {
ptree word_node;
PdeWordP text_word = text_line->GetWord(i);
process_pde_element((PdeElementP)text_word, word_node);
node.add_child("element", word_node);
}
}
break;
case kPdeWord:
{
PdeWordP word = (PdeWord*)text;
node.put("type", "text_word");
std::wstring s;
s.resize(word->GetText(nullptr, 0));
word->GetText((wchar_t*)s.c_str(), s.size());
node.put("text", w2utf8(s.c_str()));
word->GetTextState(&ts);
}
break;
}
process_pdf_text_state(ts, node);
}
示例14: process_page
void process_page(PdfPageP page, ptree& node) {
if (!page) return;
node.put("number", page->GetNumber());
node.put("rotate", page->GetRotate());
PdfPageMapParams params;
PdePageMapP page_map = page->AcquirePageMap(¶ms, nullptr, nullptr);
if (page_map == nullptr)
return;
int num_elements = page_map->GetNumElements();
for (auto i = 0; i < num_elements; i++) {
ptree elem_tree;
PdeElementP element = page_map->GetElement(i);
process_pde_element(element, elem_tree);
node.add_child("element", elem_tree);
}
page->ReleasePageMap();
}
示例15: process_pdf_text_state
void process_pdf_text_state(PdfTextState& ts, ptree& node) {
node.put("char_spacing", ts.char_spacing);
node.put("flags", ts.flags);
process_pdf_font(ts.font, node);
node.put("font_size", ts.font_size);
node.put("fill_alpha", ts.color_state.fill_opacity);
process_pdf_rgb(ts.color_state.fill_color, node);
node.put("stroke_alpha", ts.color_state.stroke_opacity);
process_pdf_rgb(ts.color_state.stroke_color, node);
node.put("word_spacing", ts.word_spacing);
}