Skip to content

Use BOOST_OVERRIDE on functions that override #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/boost/program_options/errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ namespace boost { namespace program_options {

/** Creates the error_message on the fly
* Currently a thin wrapper for substitute_placeholders() */
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW;
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;

protected:
/** Used to hold the error text returned by what() */
Expand Down Expand Up @@ -256,7 +256,7 @@ namespace boost { namespace program_options {
}

/** Does NOT set option name, because no option name makes sense */
virtual void set_option_name(const std::string&) {}
virtual void set_option_name(const std::string&) BOOST_OVERRIDE {}

BOOST_DEFAULTED_FUNCTION(~error_with_no_option_name() BOOST_NOEXCEPT_OR_NOTHROW, {})
};
Expand Down Expand Up @@ -289,7 +289,7 @@ namespace boost { namespace program_options {

protected:
/** Makes all substitutions using the template */
virtual void substitute_placeholders(const std::string& error_template) const;
virtual void substitute_placeholders(const std::string& error_template) const BOOST_OVERRIDE;
private:
// TODO: copy ctor might throw
std::vector<std::string> m_alternatives;
Expand Down Expand Up @@ -343,7 +343,7 @@ namespace boost { namespace program_options {
BOOST_DEFAULTED_FUNCTION(~invalid_config_file_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {})

/** Convenience functions for backwards compatibility */
virtual std::string tokens() const {return m_substitutions.find("invalid_line")->second; }
virtual std::string tokens() const BOOST_OVERRIDE {return m_substitutions.find("invalid_line")->second; }
};


Expand Down
38 changes: 19 additions & 19 deletions include/boost/program_options/value_semantic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace boost { namespace program_options {
private: // base overrides
void parse(boost::any& value_store,
const std::vector<std::string>& new_tokens,
bool utf8) const;
bool utf8) const BOOST_OVERRIDE;
protected: // interface for derived classes.
virtual void xparse(boost::any& value_store,
const std::vector<std::string>& new_tokens)
Expand All @@ -112,7 +112,7 @@ namespace boost { namespace program_options {
private: // base overrides
void parse(boost::any& value_store,
const std::vector<std::string>& new_tokens,
bool utf8) const;
bool utf8) const BOOST_OVERRIDE;
protected: // interface for derived classes.
#if !defined(BOOST_NO_STD_WSTRING)
virtual void xparse(boost::any& value_store,
Expand All @@ -130,28 +130,28 @@ namespace boost { namespace program_options {
: m_zero_tokens(zero_tokens)
{}

std::string name() const;
std::string name() const BOOST_OVERRIDE;

unsigned min_tokens() const;
unsigned max_tokens() const;
unsigned min_tokens() const BOOST_OVERRIDE;
unsigned max_tokens() const BOOST_OVERRIDE;

bool is_composing() const { return false; }
bool is_composing() const BOOST_OVERRIDE { return false; }

bool is_required() const { return false; }
bool is_required() const BOOST_OVERRIDE { return false; }

/** If 'value_store' is already initialized, or new_tokens
has more than one elements, throws. Otherwise, assigns
the first string from 'new_tokens' to 'value_store', without
any modifications.
*/
void xparse(boost::any& value_store,
const std::vector<std::string>& new_tokens) const;
const std::vector<std::string>& new_tokens) const BOOST_OVERRIDE;

/** Does nothing. */
bool apply_default(boost::any&) const { return false; }
bool apply_default(boost::any&) const BOOST_OVERRIDE { return false; }

/** Does nothing. */
void notify(const boost::any&) const {}
void notify(const boost::any&) BOOST_OVERRIDE const {}
private:
bool m_zero_tokens;
};
Expand Down Expand Up @@ -299,11 +299,11 @@ namespace boost { namespace program_options {

public: // value semantic overrides

std::string name() const;
std::string name() const BOOST_OVERRIDE;

bool is_composing() const { return m_composing; }
bool is_composing() const BOOST_OVERRIDE { return m_composing; }

unsigned min_tokens() const
unsigned min_tokens() const BOOST_OVERRIDE
{
if (m_zero_tokens || !m_implicit_value.empty()) {
return 0;
Expand All @@ -312,7 +312,7 @@ namespace boost { namespace program_options {
}
}

unsigned max_tokens() const {
unsigned max_tokens() const BOOST_OVERRIDE {
if (m_multitoken) {
return std::numeric_limits<unsigned>::max BOOST_PREVENT_MACRO_SUBSTITUTION();
} else if (m_zero_tokens) {
Expand All @@ -322,19 +322,19 @@ namespace boost { namespace program_options {
}
}

bool is_required() const { return m_required; }
bool is_required() const BOOST_OVERRIDE { return m_required; }

/** Creates an instance of the 'validator' class and calls
its operator() to perform the actual conversion. */
void xparse(boost::any& value_store,
const std::vector< std::basic_string<charT> >& new_tokens)
const;
const BOOST_OVERRIDE;

/** If default value was specified via previous call to
'default_value', stores that value into 'value_store'.
Returns true if default value was stored.
*/
virtual bool apply_default(boost::any& value_store) const
virtual bool apply_default(boost::any& value_store) const BOOST_OVERRIDE
{
if (m_default_value.empty()) {
return false;
Expand All @@ -347,12 +347,12 @@ namespace boost { namespace program_options {
/** If an address of variable to store value was specified
when creating *this, stores the value there. Otherwise,
does nothing. */
void notify(const boost::any& value_store) const;
void notify(const boost::any& value_store) const BOOST_OVERRIDE;

public: // typed_value_base overrides

#ifndef BOOST_NO_RTTI
const std::type_info& value_type() const
const std::type_info& value_type() const BOOST_OVERRIDE
{
return typeid(T);
}
Expand Down
2 changes: 1 addition & 1 deletion include/boost/program_options/variables_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace boost { namespace program_options {
private:
/** Implementation of abstract_variables_map::get
which does 'find' in *this. */
const variable_value& get(const std::string& name) const;
const variable_value& get(const std::string& name) const BOOST_OVERRIDE;

/** Names of option with 'final' values \-- which should not
be changed by subsequence assignments. */
Expand Down