仅使用Boost库中的属性树 [英] Use only property tree from boost libraries

查看:147
本文介绍了仅使用Boost库中的属性树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用boost库中的属性树来解析大型XML文件。

I need to parse a large XML file using property tree in boost libraries. How to use them ONLY instead of including the whole boost libraries?

推荐答案

您完全不需要包括整个Boost库吗? 。例如,如果您在适当的XML属性树增强文档页面,您会看到只需要包含以下内容:

There's no need for you whatsoever to include the whole boost libraries. For example, if you look in the quick tutorial in the appropriate boost documentation page for XML Property Trees, you see that you only need to include the following:

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>

为了获得功能完整的教程代码,编译时不会出错。

In order to get the fully functional tutorial code compile error-free.

所以,这回答了您的问题:

So, this answers your question:


如何仅使用它们而不是包括整个boost库?

How to use them ONLY instead of including the whole boost libraries?

但是,如果您实际上是说必须打包/部署整个Boost库 ,而不是包括整个boost库,那么您就有 bcp 工具本身就是增强功能的一部分(也提到了这篇文章),以帮助您筛选整个过程并了解确切地说,要使用property_tree库需要使用库的哪些部分。

But, in case you actually meant having to package/deploy the whole boost libraries in contrast to including the whole boost libraries, then you have the bcp tool, itself a part of boost (also mentioned this post) to aid you sift through the entire ordeal and know exactly what parts of the library are needed to use the property_tree library.

我已经为您运行了此操作:

I have run this for you:

bcp --list property_tree

结果非常好...答案很长。就像in_property_tree库本身依赖于整个boost库中的很大一部分。

and the results are well... way to long to put in this answer. As in, the property_tree library itself is dependent on quite a large portion out of the entire boost libraries.

因此,打包它们之间不会有明显的区别。

So, there won't be such a noticeable difference between packaging the entire boost as part of your project, and shipping only whats needed for property_tree to build.

底线:如果您需要的只是XML解析功能,那么所有的boost也是如此那么对您大有帮助,那么我建议您检查其中的许多XML库之一如TinyXML-2 - -它是一个简单,小型,高效的C ++ XML解析器,可以轻松集成到其他程序中。

Bottom line: If all you need is XML parsing capabilities and all of boost is too big for you then I suggest checking out one of the many XML libraries out there such as TinyXML-2 -- it is a "simple, small, efficient, C++ XML parser that can be easily integrated into other programs."

这篇关于仅使用Boost库中的属性树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆