advgetopt/conf_file.cpp
/** \brief Check whether the string starts with a comment introducer.
 *
 * This function checks whether the \p s string starts with a comment.
 *
 * We support different types of comment introducers. This function
 * checks the flags as defined in the constructor and returns true
 * if the type of character introducer defines a comment.
 *
 * We currently support:
 *
 * \li .ini file comments, introduced by a semi-colon (;)
 *
 * \li Shell file comments, introduced by a hash character (#)
 *
 * \li C++ comment, introduced by two slashes (//)
 *
 * \param[in] s  The string to check for a comment.
 *
 * \return `true` if the string represents a comment.
 */
\brief Check whether the string starts with a comment introducer.
This function checks whether the \p s string starts with a comment.

We support different types of comment introducers. This function
checks the flags as defined in the constructor and returns true
if the type of character introducer defines a comment.

We currently support.

\li .ini file comments, introduced by a semi-colon (;)

\li Shell file comments, introduced by a hash character (#)

\li C++ comment, introduced by two slashes (//)

\param[in] s  The string to check for a comment.

\return `true` if the string represents a comment.
\ brief Check whether the string starts with a comment introducer . This function checks whether the \ p s string starts with a comment . We support different types of comment introducers . This function checks the flags as defined in the constructor and returns true if the type of character introducer defines a comment . We currently support . \ li . ini file comments introduced by a semi - colon ( ; ) \ li Shell file comments introduced by a hash character ( # ) \ li C ++ comment introduced by two slashes ( // ) \ param [ in ] s The string to check for a comment . \ return ` true ` if the string represents a comment .
bool conf_file::is_comment(char const * s) const
{
    comment_t const comment(f_setup.get_comment());
    if((comment & COMMENT_INI) != 0
    && *s == ';')
    {
        return true;
    }
    if((comment & COMMENT_SHELL) != 0
    && *s == '#')
    {
        return true;
    }
    if((comment & COMMENT_CPP) != 0
    && s[0] == '/'
    && s[1] == '/')
    {
        return true;
    }
    return false;
}
bool conf_file :: is_comment ( char const * s ) const { comment_t const comment ( f_setup . get_comment ( ) ) ; if ( ( comment & COMMENT_INI ) != 0 && * s == ' ' ) { return true ; } if ( ( comment & COMMENT_SHELL ) != 0 && * s == ' ' ) { return true ; } if ( ( comment & COMMENT_CPP ) != 0 && s [ 0 ] == ' ' && s [ 1 ] == ' ' ) { return true ; } return false ; }
\brief Check whether the string starts with a comment introducer.
\ brief Check whether the string starts with a comment introducer .