Opened 12 years ago

Closed 11 years ago

#5379 closed Feature Requests (fixed)

Support '#' comments in property_tree ini parser

Reported by: Dimitri Kaparis <kaparis.dimitri@…> Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.45.0 Severity: Not Applicable
Keywords: Cc:

Description

The INI parser currently supports only the semi-colon symbol as comment marker.

The wikipedia article on INI files, http://en.wikipedia.org/wiki/INI_file#Varying_features notes:

Some software supports the use of the number sign (#) as an alternative to the semicolon for indicating comments.

The feature would be useful to me, since I'm using a number of existing files that use '#' as a comment marker. Also, this would make the ini parser compatible with java properties files.

I'm attaching a patch that enables the use of # for comments. A more elaborate implementation could make the feature optional, as to avoid breaking ini files with properties starting with #.

Attachments (1)

boost_1.45_libpropertytree.patch (824 bytes ) - added by Dimitri Kaparis <kaparis.dimitri@…> 12 years ago.
Patch to support # as comment marker in ini parser

Download all attachments as: .zip

Change History (3)

by Dimitri Kaparis <kaparis.dimitri@…>, 12 years ago

Patch to support # as comment marker in ini parser

comment:1 by Sebastian Redl, 12 years ago

As it happens, I had the very same need a few days ago and implemented this, so it's available on trunk.

comment:2 by Sebastian Redl, 11 years ago

Resolution: fixed
Status: newclosed

Fixed in r71994.

Note: See TracTickets for help on using tickets.