Boost C++ Libraries: Ticket #3264: open config file https://svn.boost.org/trac10/ticket/3264 <p> It would be nice if it is possible to call parse_config_file(const std::basic_string&lt;charT&gt;&amp;, const options_description&amp;, bool allow_unregistered = false); also, next to parse_config_file(std::basic_istream&lt;charT&gt;&amp;, const options_description&amp;, bool allow_unregistered = false); where parse_config_file would take care of opening the file. This would allow for less boiler-plate on part of the user and optimizes the interface for parsign the config file. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3264 Trac 1.4.3 Diederick C. Niehorster <dcnieho@…> Wed, 15 Jul 2009 02:51:43 GMT <link>https://svn.boost.org/trac10/ticket/3264#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3264#comment:1</guid> <description> <p> Sorry, that needed some formatting: </p> <p> It would be nice if it is possible to call </p> <p> <code>parse_config_file(const std::basic_string&lt;charT&gt;&amp;, const options_description&amp;, bool allow_unregistered = false);</code> </p> <p> also, next to </p> <p> <code>parse_config_file(std::basic_istream&lt;charT&gt;&amp;, const options_description&amp;, bool allow_unregistered = false);</code> </p> <p> where parse_config_file would take care of opening the file. This would allow for less boiler-plate on part of the user and optimizes the interface for parsign the config file. </p> </description> <category>Ticket</category> </item> <item> <author>s.ochsenknecht@…</author> <pubDate>Mon, 02 Nov 2009 08:56:39 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/3264#comment:2 https://svn.boost.org/trac10/ticket/3264#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">s.ochsenknecht@…</span> added </li> </ul> <p> I see one problem here. How to determine if a ifstream or a wifstream should be used? Both take (const char*) as type for the file name. </p> <p> One Solution could be: We can implement a template with a basic_string&lt;char&gt; and basic_string&lt;wchar_t&gt; instantiation for the file name. So, if the file name comes with a basic_string&lt;wchar_t&gt; then we use wifstream, the file name has to be converted to (const char* ). </p> <pre class="wiki">template&lt;charT&gt; parse_config_file(const std::basic_string&lt;charT&gt;&amp;, ...); </pre><p> Another solution could be: The function takes const char* parameter for file name which is directly passed to ifstream/wifstream: </p> <pre class="wiki">template&lt;charT&gt; parse_config_file(const char*, ...); </pre><p> But how the user can choose now between ifstream and wifstream? </p> Ticket Sascha Ochsenknecht Wed, 09 Dec 2009 13:42:52 GMT owner, status, milestone changed https://svn.boost.org/trac10/ticket/3264#comment:3 https://svn.boost.org/trac10/ticket/3264#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Vladimir Prus</span> to <span class="trac-author">Sascha Ochsenknecht</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.40.0</span> → <span class="trac-field-new">Boost 1.42.0</span> </li> </ul> <p> Implemented option (2). The template parameter is mandatory (char or wchar_t). Default template parameter are not allowed for functions. </p> <p> Cheers, SAscha </p> Ticket Sascha Ochsenknecht Wed, 09 Dec 2009 13:45:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3264#comment:4 https://svn.boost.org/trac10/ticket/3264#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/58248" title="Allow passing file name to parse_config_file(), Fixes #3264">[58248]</a>) Allow passing file name to parse_config_file(), Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3264" title="#3264: Feature Requests: open config file (closed: fixed)">#3264</a> </p> Ticket