The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Protected Attributes | List of all members
wfl::variant_numeric Class Reference

Base class for numeric variant values. More...

#include <variant_value.hpp>

Inheritance diagram for wfl::variant_numeric:

Public Member Functions

 variant_numeric (int value)
 
virtual bool as_bool () const override
 Returns a bool expression of the variant value. More...
 
int get_numeric_value () const
 
virtual bool equals (variant_value_base &other) const override
 Called to determine if this variant is equal to another of the same type. More...
 
virtual bool less_than (variant_value_base &other) const override
 Called to determine if this variant is less than another of the same type. More...
 
- Public Member Functions inherited from wfl::variant_value_base
virtual std::size_t num_elements () const
 Returns the number of elements in a type. More...
 
virtual bool is_empty () const
 Whether the stored value is considered empty or not. More...
 
virtual std::string string_cast () const
 Returns the stored variant value in plain string form. More...
 
virtual std::string get_serialized_string () const
 Returns the stored variant value in formula syntax. More...
 
virtual std::string get_debug_string (formula_seen_stack &, bool) const
 Returns debug info for the variant value. More...
 
virtual const formula_variant::type & get_type () const
 Returns the id of the variant type. More...
 
virtual boost::iterator_range< variant_iteratormake_iterator () const
 Creates an iterator pair that can be used for iteration. More...
 
virtual variant deref_iterator (const utils::any &iter) const
 Implements the dereference functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_inc (utils::any &) const
 Implements the increment functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_dec (utils::any &) const
 Implements the decrement functionality of variant_iterator for a value of this type. More...
 
virtual bool iterator_equals (const utils::any &, const utils::any &) const
 Implements the equality functionality of variant_iterator for a value of this type. More...
 
virtual ~variant_value_base ()
 

Protected Attributes

int value_
 

Detailed Description

Base class for numeric variant values.

Currently only supports a value stored as an integer, but for now, that's all that's necessary.

Definition at line 195 of file variant_value.hpp.

Constructor & Destructor Documentation

◆ variant_numeric()

wfl::variant_numeric::variant_numeric ( int  value)
inlineexplicit

Definition at line 198 of file variant_value.hpp.

Member Function Documentation

◆ as_bool()

virtual bool wfl::variant_numeric::as_bool ( ) const
inlineoverridevirtual

Returns a bool expression of the variant value.

Reimplemented from wfl::variant_value_base.

Definition at line 200 of file variant_value.hpp.

References value_.

◆ equals()

virtual bool wfl::variant_numeric::equals ( variant_value_base ) const
inlineoverridevirtual

Called to determine if this variant is equal to another of the same type.

This function is only called if get_type() returns the same result for both arguments.

Reimplemented from wfl::variant_value_base.

Definition at line 210 of file variant_value.hpp.

References value_.

◆ get_numeric_value()

int wfl::variant_numeric::get_numeric_value ( ) const
inline

Definition at line 205 of file variant_value.hpp.

References value_.

◆ less_than()

virtual bool wfl::variant_numeric::less_than ( variant_value_base ) const
inlineoverridevirtual

Called to determine if this variant is less than another of the same type.

This function is only called if get_type() returns the same result for both arguments.

Reimplemented from wfl::variant_value_base.

Definition at line 215 of file variant_value.hpp.

Member Data Documentation

◆ value_

int wfl::variant_numeric::value_
protected

The documentation for this class was generated from the following file: