Change the comment character in Boost Program Options?

I have an app that has components in both PHP and C++. They need to share some configuration options, and I'd like to use one file to share these -- a simple config file.

Fortunately, PHP has parse_ini_file() and Boost has Program Options and they share virtually identical semantics. They can both can read all the options I need.

The one "gotcha" here is that PHP's function supports semicolon (";") as the comment character, and Boost supports hash ("#"). PHP used to support hash, but now it throws a deprecated error on it.

I'm pretty sure I can't easily change the comment character in PHP. Anyone know if I can change the Boost comment character? I'd love to not have to rewrite all this functionality just for comments.

Answers


Figured out a solution to this problem.

Given that Boost is reasonably robust, I couldn't see a reasonable way to replace the comment character, and the # is a fairly accepted comment character in config files, I solved it in PHP.

I load the config file using file_get_contents, use a preg_replace to remove the lines that begin with #, then pass the result through parse_ini_string.


Need Your Help

Libgdx and Google In-App-Purchase result

java android in-app-purchase libgdx

I followed these instructions to integrate both Libgdx and native android code using ActionResolver interface. I have no problem calling the Android method from the Libgdx part of my code. But I am

Linux (Ubuntu) Java plugin and console

java linux firefox ubuntu applet

I'm trying to test a Java applet in Firefox in Ubuntu 10.10. Unfortunately it doesn't work out of the box. I have two issues:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.