The Battle for Wesnoth  1.19.1+dev
Classes | Namespaces | Typedefs | Functions | Variables
translation.hpp File Reference
#include <vector>
#include <map>
#include <cstdint>
#include <boost/bimap.hpp>
#include <boost/bimap/set_of.hpp>
#include <boost/bimap/multiset_of.hpp>
#include "exceptions.hpp"
#include "map/location.hpp"
#include <string_view>
Include dependency graph for translation.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  t_translation::terrain_code
 A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separated by a caret and each group consists of 2 to 4 characters if no second layer is defined it is stored as 0xFFFFFFFF, if the second layer is empty (needed for matching) the layer has the value 0. More...
struct  t_translation::ter_map
struct  t_translation::ter_match
 This structure can be used for matching terrain strings. More...
struct  t_translation::error




typedef uint32_t t_translation::ter_layer
typedef std::vector< terrain_code > t_translation::ter_list
using t_translation::coordinate = map_location
 Contains an x and y coordinate used for starting positions in maps. More...
using t_translation::starting_positions = boost::bimaps::bimap< boost::bimaps::set_of< std::string >, boost::bimaps::multiset_of< coordinate > >


int t_translation::max_map_size ()
 Return the maximum allowed map size (in either dimension), the maximum map area is, therefore, this value squared. More...
bool t_translation::operator< (const terrain_code &a, const terrain_code &b)
bool t_translation::operator== (const terrain_code &a, const terrain_code &b)
bool t_translation::operator!= (const terrain_code &a, const terrain_code &b)
terrain_code t_translation::operator& (const terrain_code &a, const terrain_code &b)
terrain_code t_translation::operator| (const terrain_code &a, const terrain_code &b)
terrain_code t_translation::read_terrain_code (std::string_view str, const ter_layer filler=NO_LAYER)
 Reads a single terrain from a string. More...
std::string t_translation::write_terrain_code (const terrain_code &tcode)
 Writes a single terrain code to a string. More...
std::ostream & t_translation::operator<< (std::ostream &s, const terrain_code &a)
ter_list t_translation::read_list (std::string_view str, const ter_layer filler=NO_LAYER)
 Reads a list of terrains from a string, when reading the. More...
std::string t_translation::write_list (const ter_list &list)
 Writes a list of terrains to a string, only writes the new format. More...
ter_map t_translation::read_game_map (std::string_view str, starting_positions &positions, coordinate border_offset=coordinate{ 0, 0 })
 Reads a gamemap string into a 2D vector. More...
std::string t_translation::write_game_map (const ter_map &map, const starting_positions &positions=starting_positions(), coordinate border_offset=coordinate{ 0, 0 })
 Write a gamemap in to a vector string. More...
bool t_translation::terrain_matches (const terrain_code &src, const ter_list &dest)
 Tests whether a specific terrain matches a list of expressions. More...
bool t_translation::terrain_matches (const terrain_code &src, const terrain_code &dest)
 Tests whether a specific terrain matches an expression, for matching rules see above. More...
bool t_translation::terrain_matches (const terrain_code &src, const ter_match &dest)
 Tests whether a certain terrain matches a list of expressions, for matching rules see above. More...
bool t_translation::has_wildcard (const terrain_code &tcode)
 Tests whether a terrain code contains a wildcard. More...
bool t_translation::has_wildcard (const ter_list &list)
 Tests whether a terrain-code list contains at least one item with a wildcard. More...
ter_map t_translation::read_builder_map (const std::string &str)
 Reads a builder map. More...


const ter_layer t_translation::WILDCARD = 0x2A000000
const ter_layer t_translation::NO_LAYER = 0xFFFFFFFF
const terrain_code t_translation::NONE_TERRAIN = terrain_code()
const ter_match t_translation::ALL_OFF_MAP
const ter_match t_translation::ALL_FORESTS
const ter_layer t_translation::TB_STAR = '*' << 24
const ter_layer t_translation::TB_DOT = '.' << 24