Project Alice
Loading...
Searching...
No Matches
text.hpp File Reference
#include <stdint.h>
#include <variant>
#include <vector>
#include <string>
#include <string_view>
#include "dcon_generated.hpp"
#include "nations.hpp"
#include "unordered_dense.h"
#include "fonts.hpp"
Include dependency graph for text.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  text::line_break
 
struct  text::vector_backed_hash
 
struct  text::vector_backed_eq
 
struct  text::vector_backed_ci_hash
 
struct  text::vector_backed_ci_eq
 
struct  text::fp_one_place
 
struct  text::fp_two_places
 
struct  text::fp_three_places
 
struct  text::fp_four_places
 
struct  text::fp_currency
 
struct  text::pretty_integer
 
struct  text::fp_percentage
 
struct  text::fp_percentage_one_place
 
struct  text::int_percentage
 
struct  text::int_wholenum
 
struct  text::embedded_unit_icon
 
struct  text::embedded_flag
 
struct  text::text_chunk
 
struct  text::layout_parameters
 
struct  text::layout
 
struct  text::layout_box
 
struct  text::layout_base
 
struct  text::columnar_layout
 
struct  text::endless_layout
 
struct  text::single_line_layout
 

Namespaces

namespace  sys
 
namespace  text
 
namespace  text::detail
 

Typedefs

using text::substitution = std::variant< std::string_view, dcon::text_key, dcon::province_id, dcon::state_instance_id, dcon::nation_id, dcon::national_identity_id, int64_t, fp_one_place, sys::date, std::monostate, fp_two_places, fp_three_places, fp_four_places, fp_currency, pretty_integer, fp_percentage, fp_percentage_one_place, int_percentage, int_wholenum, dcon::state_definition_id, embedded_icon, embedded_flag, embedded_unit_icon >
 
using text::substitution_map = ankerl::unordered_dense::map< uint32_t, substitution >
 

Enumerations

enum class  text::text_color : uint8_t {
  text::black , text::white , text::red , text::green ,
  text::yellow , text::unspecified , text::light_blue , text::dark_blue ,
  text::orange , text::lilac , text::light_grey , text::dark_red ,
  text::dark_green , text::gold , text::reset , text::brown
}
 
enum class  text::alignment : uint8_t { text::left , text::right , text::center }
 
enum class  text::variable_type : uint16_t {
  text::error_no_matching_value , text::action , text::active , text::actor ,
  text::adj , text::against , text::agressor , text::allowed ,
  text::amount , text::anyprovince , text::army , text::army_name ,
  text::astate , text::attacker , text::attunit , text::bac ,
  text::badboy , text::badword , text::base , text::base_percentage ,
  text::bat , text::bld , text::bon , text::bonus ,
  text::brig , text::bud , text::building , text::buy ,
  text::cap , text::capital , text::cash , text::casus ,
  text::cat , text::category , text::cb_target_name , text::cb_target_name_adj ,
  text::chan , text::chance , text::change , text::commander ,
  text::con , text::construction , text::continentname , text::cost ,
  text::count , text::countries , text::country , text::country1 ,
  text::country2 , text::countryadj , text::countryculture , text::countryname ,
  text::country_adj , text::creator , text::credits , text::crisisarea ,
  text::crisisattacker , text::crisisdefender , text::crisistaker , text::crisistaker_adj ,
  text::crisistarget , text::crisistarget_adj , text::cul , text::culture ,
  text::culture_group_union , text::curr , text::current , text::d ,
  text::date , text::date_long_0 , text::date_long_1 , text::date_short_0 ,
  text::day , text::days , text::defender , text::defunit ,
  text::desc , text::dest , text::details , text::direction ,
  text::dist , text::effect , text::effects , text::emilist ,
  text::employees , text::employee_max , text::enemy , text::engineermaxunits ,
  text::engineerunits , text::escorts , text::event , text::eventdesc ,
  text::exc , text::exp , text::faction , text::factory ,
  text::first , text::focus , text::folder , text::vtype_for ,
  text::fraction , text::vtype_friend , text::from , text::fromcountry ,
  text::fromcountry_adj , text::fromprovince , text::fromruler , text::funds ,
  text::goal , text::good , text::goods , text::gov ,
  text::government , text::govt , text::gp , text::gp_adj ,
  text::group , text::high_tax , text::hit , text::home ,
  text::hull , text::iamount , text::icountry , text::ide ,
  text::ideology , text::ilocation , text::immlist , text::impact ,
  text::iname , text::income , text::indep , text::inf ,
  text::infamy , text::input , text::inv , text::invention ,
  text::invested , text::invested_in_us_message , text::issue , text::law ,
  text::leader , text::lev , text::level , text::levels ,
  text::lim , text::limit , text::list , text::literacy ,
  text::loc , text::local , text::location , text::lord ,
  text::lose , text::low_tax , text::lvl , text::m ,
  text::max , text::maxloan , text::men , text::messenger ,
  text::mil , text::militancy , text::min , text::monarchtitle ,
  text::money , text::month , text::months , text::movement ,
  text::much , text::name , text::nation , text::nationalvalue ,
  text::natives , text::navy , text::navy_name , text::need ,
  text::needed , text::negative , text::neut , text::vtype_new ,
  text::newcountry , text::nf , text::now , text::num ,
  text::number , text::numfactories , text::numspecialfactories , text::odds ,
  text::old , text::oldcountry , text::vtype_operator , text::opinion ,
  text::opposing_army , text::opposing_navy , text::opressor , text::opt ,
  text::optimal , text::option , text::order , text::org ,
  text::organisation , text::other , text::otherresult , text::ourcapital ,
  text::ourcountry , text::ourcountry_adj , text::our_lead , text::our_num ,
  text::our_res , text::output , text::overlord , text::param ,
  text::party , text::passive , text::pay , text::pen ,
  text::penalty , text::per , text::perc , text::perc2 ,
  text::percent , text::percentage , text::player , text::policy ,
  text::pop , text::poptype , text::popularity , text::position ,
  text::positive , text::power , text::pres , text::prescence ,
  text::prestige , text::produced , text::producer , text::prog ,
  text::progress , text::proj , text::prov , text::provinceculture ,
  text::provincename , text::provincereligion , text::provinces , text::provs ,
  text::province , text::rank , text::rate , text::rec ,
  text::recipient , text::reconmaxunits , text::reconunits , text::reform ,
  text::region , text::rel , text::relation , text::religion ,
  text::req , text::reqlevel , text::required , text::resource ,
  text::result , text::rstate , text::rule , text::runs ,
  text::scr , text::sea , text::second , text::second_country ,
  text::self , text::sell , text::setting , text::ships ,
  text::size , text::skill , text::source , text::speed ,
  text::spheremaster , text::state , text::statename , text::str ,
  text::strata , text::strings_list_4 , text::string_0_0 , text::string_0_1 ,
  text::string_0_2 , text::string_0_3 , text::string_0_4 , text::string_9_0 ,
  text::sub , text::table , text::tag , text::tag0_0 ,
  text::tag_0_0 , text::tag_0_0_ , text::tag_0_0_adj , text::tag_0_0_upper ,
  text::tag_0_1 , text::tag_0_1_adj , text::tag_0_1_upper , text::tag_0_2 ,
  text::tag_0_2_adj , text::tag_0_3 , text::tag_0_3_adj , text::tag_1_0 ,
  text::tag_2_0 , text::tag_2_0_upper , text::tag_3_0 , text::tag_3_0_upper ,
  text::target , text::targetlist , text::target_country , text::tech ,
  text::temperature , text::terms , text::terrain , text::terrainmod ,
  text::text , text::theirlost , text::theirnum , text::theirship ,
  text::their_lead , text::their_num , text::their_res , text::them ,
  text::third , text::threat , text::time , text::title ,
  text::to , text::tot , text::totalemi , text::totalimm ,
  text::tra , text::truth , text::type , text::unemployed ,
  text::vtype_union , text::union_adj , text::unit , text::units ,
  text::until , text::usloss , text::usnum , text::val ,
  text::value , text::value_int1 , text::value_int_0_0 , text::value_int_0_1 ,
  text::value_int_0_2 , text::value_int_0_3 , text::value_int_0_4 , text::verb ,
  text::versus , text::war , text::wargoal , text::we ,
  text::what , text::where , text::which , text::who ,
  text::winner , text::x , text::y , text::year ,
  text::years , text::chief_of_navy , text::chief_of_staff , text::control ,
  text::head_of_government , text::owner , text::playername , text::yesterday ,
  text::avg , text::n , text::strength , text::total ,
  text::infantry , text::cavalry , text::special , text::thiscountry ,
  text::fromcontinent , text::fromcapital , text::crisistaker_continent , text::crisistaker_capital ,
  text::crisisattacker_continent , text::crisisattacker_adj , text::crisisattacker_capital , text::crisisdefender_continent ,
  text::crisisdefender_adj , text::crisisdefender_capital , text::culture_first_name , text::culture_last_name ,
  text::fromstatename , text::spheremaster_adj , text::spheremaster_union_adj
}
 
enum class  text::embedded_icon : uint8_t { text::check , text::xmark , text::army , text::navy }
 

Functions

void text::detail::mum (uint64_t *a, uint64_t *b)
 
auto text::detail::mix (uint64_t a, uint64_t b) -> uint64_t
 
auto text::detail::r8 (const uint8_t *p) -> uint64_t
 
auto text::detail::r4 (const uint8_t *p) -> uint64_t
 
auto text::detail::r3 (const uint8_t *p, size_t k) -> uint64_t
 
auto text::detail::ci_wyhash (void const *key, size_t len) -> uint64_t
 
bool text::detail::lazy_ci_eq (std::string_view a, std::string_view b)
 
layout_box text::open_layout_box (layout_base &dest, int32_t indent)
 
text_color text::char_to_color (char in)
 
endless_layout text::create_endless_layout (sys::state &state, layout &dest, layout_parameters const &params)
 
void text::close_layout_box (endless_layout &dest, layout_box &box)
 
columnar_layout text::create_columnar_layout (sys::state &state, layout &dest, layout_parameters const &params, int32_t column_width)
 
void text::close_layout_box (columnar_layout &dest, layout_box &box)
 
void text::close_layout_box (single_line_layout &dest, layout_box &box)
 
void text::add_unparsed_text_to_layout_box (sys::state &state, layout_base &dest, layout_box &box, std::string_view sv, substitution_map const &mp)
 
void text::add_to_layout_box (sys::state &state, layout_base &dest, layout_box &box, dcon::text_key source_text, substitution_map const &mp)
 
void text::add_to_layout_box (sys::state &state, layout_base &dest, layout_box &box, std::string_view text, text_color color, substitution source)
 
void text::add_to_layout_box (sys::state &state, layout_base &dest, layout_box &box, substitution val, text_color color)
 
void text::add_to_layout_box (sys::state &state, layout_base &dest, layout_box &box, std::string const &val, text_color color)
 
void text::add_space_to_layout_box (sys::state &state, layout_base &dest, layout_box &box)
 
void text::add_line_break_to_layout_box (sys::state &state, layout_base &dest, layout_box &box)
 
void text::add_line_break_to_layout (sys::state &state, columnar_layout &dest)
 
void text::add_line_break_to_layout (sys::state &state, endless_layout &dest)
 
void text::add_to_layout_box (sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
 
void text::add_to_layout_box (sys::state &state, layout_base &dest, layout_box &box, embedded_icon ico)
 
void text::close_layout_box (layout_base &dest, layout_box &box)
 
void text::add_to_substitution_map (substitution_map &mp, variable_type key, substitution value)
 
void text::add_to_substitution_map (substitution_map &mp, variable_type key, std::string const &)
 
void text::consume_csv_file (sys::state &state, char const *file_content, uint32_t file_size, int32_t target_column, bool as_unicode)
 
variable_type text::variable_type_from_name (std::string_view v)
 
char16_t text::win1250toUTF16 (char in)
 
std::string text::produce_simple_string (sys::state const &state, std::string_view txt)
 
std::string text::produce_simple_string (sys::state const &state, dcon::text_key id)
 
text::alignment text::localized_alignment (sys::state &state, text::alignment in)
 
ui::alignment text::localized_alignment (sys::state &state, ui::alignment in)
 
text::alignment text::to_text_alignment (ui::alignment in)
 
dcon::text_key text::find_or_add_key (sys::state &state, std::string_view key, bool as_unicode)
 
std::string text::date_to_string (sys::state &state, sys::date date)
 
std::string text::prettify (int64_t num)
 
std::string text::prettify_currency (float num)
 
std::string text::format_money (float num)
 
std::string text::format_wholenum (int32_t num)
 
std::string text::format_percentage (float num, size_t digits)
 
std::string text::format_float (float num, size_t digits)
 
std::string text::format_ratio (int32_t left, int32_t right)
 
template<class T >
std::string text::get_name_as_string (sys::state &state, T t)
 
template<class T >
std::string text::get_adjective_as_string (sys::state &state, T t)
 
std::string text::get_short_state_name (sys::state &state, dcon::state_instance_id state_id)
 
std::string text::get_dynamic_state_name (sys::state &state, dcon::state_instance_id state_id)
 
std::string text::get_province_state_name (sys::state &state, dcon::province_id prov_id)
 
std::string text::get_focus_category_name (sys::state const &state, nations::focus_type category)
 
std::string text::get_influence_level_name (sys::state const &state, uint8_t v)
 
dcon::text_key text::get_name (sys::state &state, dcon::nation_id id)
 
dcon::text_key text::get_adjective (sys::state &state, dcon::nation_id id)
 
dcon::text_key text::get_ruler_title (sys::state &state, dcon::nation_id n)
 
std::string text::get_name_as_string (sys::state &state, dcon::nation_id n)
 
std::string text::get_adjective_as_string (sys::state &state, dcon::nation_id n)
 
std::string text::get_name_as_string (sys::state &state, dcon::nation_fat_id n)
 
std::string text::get_adjective_as_string (sys::state &state, dcon::nation_fat_id n)
 
void text::localised_format_box (sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
 
void text::localised_single_sub_box (sys::state &state, layout_base &dest, layout_box &box, std::string_view key, variable_type subkey, substitution value)
 
void text::nation_name_and_flag (sys::state &state, dcon::nation_id n, layout_base &dest, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, std::string_view key, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, std::string_view key, variable_type subkey, substitution value, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, std::string_view key, variable_type subkey, substitution value, variable_type subkey_b, substitution value_b, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, std::string_view key, variable_type subkey, substitution value, variable_type subkey_b, substitution value_b, variable_type subkey_c, substitution value_c, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, std::string_view key, variable_type subkey, substitution value, variable_type subkey_b, substitution value_b, variable_type subkey_c, substitution value_c, variable_type subkey_d, substitution value_d, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, dcon::text_key txt, variable_type subkey, substitution value, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, dcon::text_key txt, variable_type subkey, substitution value, variable_type subkey_b, substitution value_b, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, dcon::text_key txt, variable_type subkey, substitution value, variable_type subkey_b, substitution value_b, variable_type subkey_c, substitution value_c, int32_t indent)
 
void text::add_line (sys::state &state, layout_base &dest, dcon::text_key txt, variable_type subkey, substitution value, variable_type subkey_b, substitution value_b, variable_type subkey_c, substitution value_c, variable_type subkey_d, substitution value_d, int32_t indent)
 
void text::add_line_with_condition (sys::state &state, layout_base &dest, std::string_view key, bool condition_met, int32_t indent)
 
void text::add_line_with_condition (sys::state &state, layout_base &dest, std::string_view key, bool condition_met, variable_type subkey, substitution value, int32_t indent)
 
void text::add_line_with_condition (sys::state &state, layout_base &dest, std::string_view key, bool condition_met, variable_type subkey, substitution value, variable_type subkeyb, substitution valueb, int32_t indent)
 
void text::add_line_with_condition (sys::state &state, layout_base &dest, std::string_view key, bool condition_met, variable_type subkey, substitution value, variable_type subkeyb, substitution valueb, variable_type subkeyc, substitution valuec, int32_t indent)
 
size_t text::size_from_utf8 (char const *start, char const *)
 
void text::add_divider_to_layout_box (sys::state &state, layout_base &dest, layout_box &box)
 
std::string text::resolve_string_substitution (sys::state &state, std::string_view key, substitution_map const &mp)
 
std::string text::resolve_string_substitution (sys::state &state, dcon::text_key source_text, substitution_map const &mp)
 
uint32_t text::codepoint_from_utf8 (char const *start, char const *end)