The Battle for Wesnoth  1.15.2+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:
Inheritance graph

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 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 boost::any &iter) const
 Implements the dereference functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_inc (boost::any &) const
 Implements the increment functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_dec (boost::any &) const
 Implements the decrement functionality of variant_iterator for a value of this type. More...
 
virtual bool iterator_equals (const boost::any &, const boost::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 209 of file variant_value.hpp.

Constructor & Destructor Documentation

◆ variant_numeric()

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

Definition at line 212 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 214 of file variant_value.hpp.

◆ 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 224 of file variant_value.hpp.

References wfl::value_ref_cast().

◆ get_numeric_value()

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

Definition at line 219 of file variant_value.hpp.

◆ 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 229 of file variant_value.hpp.

Member Data Documentation

◆ value_

int wfl::variant_numeric::value_
protected

Definition at line 235 of file variant_value.hpp.


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