6

Is there an alternative to to "boost/property_tree" ?

Actually I'm trying to remove all boost implementations of C++ and use standard library functions. I've been able to find alternatives to some other implementations of boost C++ but none so for property tree.

Motivation to not use boost: Mostly dealing with added dependencies

bool Processor::init(std::istream& xml, std::istream& rioxml, const std::string& logconfig, const std::string& recoveryConfig) {
    boost::property_tree::ptree config;
    boost::property_tree::ptree rioconfig;
    try {
        boost::property_tree::xml_parser::read_xml(xml, config,
                boost::property_tree::xml_parser::no_comments);

        boost::property_tree::xml_parser::read_xml(rioxml, rioconfig,
                boost::property_tree::xml_parser::no_comments);

        return Initialize(config, rioconfig, logconfig, recoveryConfig);
    }
    catch(const boost::property_tree::xml_parser::xml_parser_error& ex){
        LOG_ERROR(LOGCAT_DEFAULT, MSGID_UNKNOWN, "Failed to parse business config: " << logconfig);
        return false;
    }
}
Mayank Jha
  • 939
  • 3
  • 12
  • 24
  • Why would you not want boost ? – darune Jan 24 '20 at 10:26
  • I think the motivation is mostly surrounding this:https://stackoverflow.com/a/33453112/7054831 – Mayank Jha Jan 24 '20 at 10:32
  • 4
    boost is supplement to std - not a replacement or other implemenation - and to answer your question: No - and probably not in the near future either – darune Jan 24 '20 at 10:35
  • 1
    You could always write your own replacement. – Marshall Clow Jan 24 '20 at 14:59
  • Are you only looking for something in the std library or are other third party libs not boost okay? – AndyG Feb 02 '20 at 14:46
  • I'm looking for something in the standard library – Mayank Jha Feb 03 '20 at 08:35
  • From what I can see, you are attempting to use `ptree` as a convenient XML configuration parser. There is no known standard library equivalent for that. I suggest [this](https://github.com/leethomason/tinyxml2) as a _lightweight_ replacement. A discussion is [here](https://stackoverflow.com/questions/9387610/what-xml-parser-should-i-use-in-c). – Code Maverick Feb 04 '20 at 21:59

1 Answers1

0

I think there aren't any similar alternatives.

You can write you own implementation.

Nickeron-dev
  • 53
  • 2
  • 8