The Battle for Wesnoth  1.19.6+dev
Public Member Functions | Private Attributes | List of all members
schema_validation::wml_key Class Reference

wml_key is used to save the information about one key. More...

#include <key.hpp>

Public Member Functions

 wml_key ()
 
 wml_key (const std::string &name, const std::string &type, const std::string &def="\"\"")
 
 wml_key (const config &)
 
const std::string & get_name () const
 
const std::string & get_type () const
 
const std::string & get_default () const
 
bool is_mandatory () const
 
bool is_fuzzy () const
 
void set_name (const std::string &name)
 
void set_type (const std::string &type)
 
void set_default (const std::string &def)
 
void set_mandatory (bool mandatory)
 
void set_fuzzy (bool f)
 
void print (std::ostream &os, int level) const
 is used to print key info the format is next [key] name="name" type="type" default="default" mandatory="true/false" [/key] More...
 
bool operator< (const wml_key &k) const
 Compares keys by name. More...
 

Private Attributes

std::string name_
 Name of key. More...
 
std::string type_
 Type of key. More...
 
std::string default_
 Default value. More...
 
bool mandatory_
 Shows, if key is a mandatory key. More...
 
bool fuzzy_
 Whether the key is a fuzzy match. More...
 

Detailed Description

wml_key is used to save the information about one key.

Key has next info: name, type, default value or key is mandatory.

Definition at line 36 of file key.hpp.

Constructor & Destructor Documentation

◆ wml_key() [1/3]

schema_validation::wml_key::wml_key ( )
inline

Definition at line 39 of file key.hpp.

◆ wml_key() [2/3]

schema_validation::wml_key::wml_key ( const std::string &  name,
const std::string &  type,
const std::string &  def = "\"\"" 
)
inline

Definition at line 48 of file key.hpp.

◆ wml_key() [3/3]

schema_validation::wml_key::wml_key ( const config cfg)

Definition at line 28 of file key.cpp.

References default_, config::has_attribute(), and mandatory_.

Member Function Documentation

◆ get_default()

const std::string& schema_validation::wml_key::get_default ( ) const
inline

Definition at line 69 of file key.hpp.

References default_.

◆ get_name()

const std::string& schema_validation::wml_key::get_name ( ) const
inline

Definition at line 59 of file key.hpp.

References name_.

Referenced by schema_validation::wml_tag::add_key(), and operator<().

◆ get_type()

const std::string& schema_validation::wml_key::get_type ( ) const
inline

Definition at line 64 of file key.hpp.

References type_.

Referenced by schema_validation::schema_validator::validate_key().

◆ is_fuzzy()

bool schema_validation::wml_key::is_fuzzy ( ) const
inline

Definition at line 79 of file key.hpp.

References fuzzy_.

◆ is_mandatory()

bool schema_validation::wml_key::is_mandatory ( ) const
inline

Definition at line 74 of file key.hpp.

References mandatory_.

Referenced by print().

◆ operator<()

bool schema_validation::wml_key::operator< ( const wml_key k) const
inline

Compares keys by name.

Used in std::sort, i.e.

Definition at line 123 of file key.hpp.

References get_name().

◆ print()

void schema_validation::wml_key::print ( std::ostream &  os,
int  level 
) const

is used to print key info the format is next [key] name="name" type="type" default="default" mandatory="true/false" [/key]

Definition at line 44 of file key.cpp.

References default_, is_mandatory(), game_config::images::level, name_, s, and type_.

◆ set_default()

void schema_validation::wml_key::set_default ( const std::string &  def)
inline

Definition at line 93 of file key.hpp.

References default_, and mandatory_.

◆ set_fuzzy()

void schema_validation::wml_key::set_fuzzy ( bool  f)
inline

Definition at line 106 of file key.hpp.

References f, and fuzzy_.

◆ set_mandatory()

void schema_validation::wml_key::set_mandatory ( bool  mandatory)
inline

Definition at line 101 of file key.hpp.

References mandatory_.

◆ set_name()

void schema_validation::wml_key::set_name ( const std::string &  name)
inline

Definition at line 83 of file key.hpp.

References name_.

◆ set_type()

void schema_validation::wml_key::set_type ( const std::string &  type)
inline

Definition at line 88 of file key.hpp.

References type_.

Member Data Documentation

◆ default_

std::string schema_validation::wml_key::default_
private

Default value.

Definition at line 136 of file key.hpp.

Referenced by get_default(), print(), set_default(), and wml_key().

◆ fuzzy_

bool schema_validation::wml_key::fuzzy_
private

Whether the key is a fuzzy match.

Definition at line 142 of file key.hpp.

Referenced by is_fuzzy(), and set_fuzzy().

◆ mandatory_

bool schema_validation::wml_key::mandatory_
private

Shows, if key is a mandatory key.

Definition at line 139 of file key.hpp.

Referenced by is_mandatory(), set_default(), set_mandatory(), and wml_key().

◆ name_

std::string schema_validation::wml_key::name_
private

Name of key.

Definition at line 130 of file key.hpp.

Referenced by get_name(), print(), and set_name().

◆ type_

std::string schema_validation::wml_key::type_
private

Type of key.

Definition at line 133 of file key.hpp.

Referenced by get_type(), print(), and set_type().


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