The Battle for Wesnoth  1.19.7+dev
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
t_string_base Class Reference

Helper class for translatable strings. More...

#include <tstring.hpp>

Classes

class  walker
 

Public Member Functions

 t_string_base ()
 
 ~t_string_base ()
 Default implementation, but defined out-of-line for efficiency reasons. More...
 
 t_string_base (const t_string_base &)
 Default implementation, but defined out-of-line for efficiency reasons. More...
 
 t_string_base (t_string_base &&) noexcept=default
 
 t_string_base (const std::string &string)
 
 t_string_base (std::string &&string)
 
 t_string_base (const std::string &string, const std::string &textdomain)
 
 t_string_base (const std::string &sing, const std::string &pl, int count, const std::string &textdomain)
 
 t_string_base (const char *string)
 
std::string to_serialized () const
 
t_string_baseoperator= (const t_string_base &)
 Default implementation, but defined out-of-line for efficiency reasons. More...
 
t_string_baseoperator= (t_string_base &&) noexcept=default
 
t_string_baseoperator= (const std::string &)
 
t_string_baseoperator= (const char *)
 
t_string_base operator+ (const t_string_base &) const
 
t_string_base operator+ (const std::string &) const
 
t_string_base operator+ (const char *) const
 
t_string_baseoperator+= (const t_string_base &)
 
t_string_baseoperator+= (const std::string &)
 
t_string_baseoperator+= (const char *)
 
bool operator== (const t_string_base &) const
 
bool operator== (const std::string &) const
 
bool operator== (const char *string) const
 
bool operator!= (const t_string_base &that) const
 
bool operator!= (const std::string &that) const
 
bool operator!= (const char *that) const
 
bool operator< (const t_string_base &string) const
 
bool empty () const
 
std::string::size_type size () const
 
 operator const std::string & () const
 
const std::string & str () const
 
const char * c_str () const
 
bool translatable () const
 
const std::string & value () const
 
std::string base_str () const
 
std::size_t hash_value () const
 

Static Public Member Functions

static t_string_base from_serialized (const std::string &string)
 

Private Attributes

std::string value_
 
std::string translated_value_
 
unsigned translation_timestamp_
 
bool translatable_
 
bool last_untranslatable_
 

Static Private Attributes

static std::vector< std::string > id_to_textdomain
 
static std::map< std::string, unsigned int > textdomain_to_id
 

Friends

class walker
 

Detailed Description

Helper class for translatable strings.

Definition at line 26 of file tstring.hpp.

Constructor & Destructor Documentation

◆ t_string_base() [1/8]

t_string_base::t_string_base ( )

Definition at line 220 of file tstring.cpp.

Referenced by from_serialized().

◆ ~t_string_base()

t_string_base::~t_string_base ( )

Default implementation, but defined out-of-line for efficiency reasons.

Definition at line 229 of file tstring.cpp.

◆ t_string_base() [2/8]

t_string_base::t_string_base ( const t_string_base string)

Default implementation, but defined out-of-line for efficiency reasons.

Definition at line 233 of file tstring.cpp.

◆ t_string_base() [3/8]

t_string_base::t_string_base ( t_string_base &&  )
defaultnoexcept

◆ t_string_base() [4/8]

t_string_base::t_string_base ( const std::string &  string)

Definition at line 242 of file tstring.cpp.

◆ t_string_base() [5/8]

t_string_base::t_string_base ( std::string &&  string)

Definition at line 251 of file tstring.cpp.

◆ t_string_base() [6/8]

t_string_base::t_string_base ( const std::string &  string,
const std::string &  textdomain 
)

Definition at line 260 of file tstring.cpp.

References empty(), id, id_to_textdomain, textdomain_to_id, translatable_, and value_.

◆ t_string_base() [7/8]

t_string_base::t_string_base ( const std::string &  sing,
const std::string &  pl,
int  count,
const std::string &  textdomain 
)

Definition at line 289 of file tstring.cpp.

References c, data, id, id_to_textdomain, textdomain_to_id, translatable_, and value_.

◆ t_string_base() [8/8]

t_string_base::t_string_base ( const char *  string)

Definition at line 331 of file tstring.cpp.

Member Function Documentation

◆ base_str()

std::string t_string_base::base_str ( ) const

Definition at line 365 of file tstring.cpp.

References w.

Referenced by t_string::base_str().

◆ c_str()

const char* t_string_base::c_str ( ) const
inline

Definition at line 108 of file tstring.hpp.

References str().

Referenced by t_string::c_str().

◆ empty()

bool t_string_base::empty ( ) const
inline

Definition at line 103 of file tstring.hpp.

References value_.

Referenced by t_string::empty(), from_serialized(), operator+=(), and t_string_base().

◆ from_serialized()

t_string_base t_string_base::from_serialized ( const std::string &  string)
static

Definition at line 340 of file tstring.cpp.

References empty(), t_string_base(), translatable_, and w.

Referenced by t_string::from_serialized().

◆ hash_value()

std::size_t t_string_base::hash_value ( ) const

Definition at line 47 of file tstring.cpp.

References last_untranslatable_, translatable_, and value_.

Referenced by hash_value().

◆ operator const std::string &()

t_string_base::operator const std::string & ( ) const
inline

Definition at line 106 of file tstring.hpp.

References str().

◆ operator!=() [1/3]

bool t_string_base::operator!= ( const char *  that) const
inline

Definition at line 98 of file tstring.hpp.

References operator==().

◆ operator!=() [2/3]

bool t_string_base::operator!= ( const std::string &  that) const
inline

Definition at line 96 of file tstring.hpp.

References operator==().

◆ operator!=() [3/3]

bool t_string_base::operator!= ( const t_string_base that) const
inline

Definition at line 94 of file tstring.hpp.

References operator==().

◆ operator+() [1/3]

t_string_base t_string_base::operator+ ( const char *  string) const

Definition at line 445 of file tstring.cpp.

◆ operator+() [2/3]

t_string_base t_string_base::operator+ ( const std::string &  string) const

Definition at line 438 of file tstring.cpp.

◆ operator+() [3/3]

t_string_base t_string_base::operator+ ( const t_string_base string) const

Definition at line 431 of file tstring.cpp.

◆ operator+=() [1/3]

t_string_base & t_string_base::operator+= ( const char *  string)

Definition at line 521 of file tstring.cpp.

References last_untranslatable_, translatable_, translated_value_, and value_.

◆ operator+=() [2/3]

t_string_base & t_string_base::operator+= ( const std::string &  string)

Definition at line 495 of file tstring.cpp.

References empty(), last_untranslatable_, translatable_, translated_value_, and value_.

◆ operator+=() [3/3]

t_string_base & t_string_base::operator+= ( const t_string_base string)

Definition at line 452 of file tstring.cpp.

References last_untranslatable_, translatable_, translated_value_, and value_.

◆ operator<()

bool t_string_base::operator< ( const t_string_base string) const

Definition at line 562 of file tstring.cpp.

References value_.

◆ operator=() [1/4]

t_string_base & t_string_base::operator= ( const char *  string)

◆ operator=() [2/4]

t_string_base & t_string_base::operator= ( const std::string &  string)

◆ operator=() [3/4]

t_string_base & t_string_base::operator= ( const t_string_base string)

Default implementation, but defined out-of-line for efficiency reasons.

Definition at line 398 of file tstring.cpp.

References last_untranslatable_, translatable_, translated_value_, translation_timestamp_, and value_.

◆ operator=() [4/4]

t_string_base& t_string_base::operator= ( t_string_base &&  )
defaultnoexcept

◆ operator==() [1/3]

bool t_string_base::operator== ( const char *  string) const

Definition at line 557 of file tstring.cpp.

References translatable_, and value_.

◆ operator==() [2/3]

bool t_string_base::operator== ( const std::string &  that) const

Definition at line 552 of file tstring.cpp.

References translatable_, and value_.

◆ operator==() [3/3]

bool t_string_base::operator== ( const t_string_base that) const

Definition at line 547 of file tstring.cpp.

References translatable_, and value_.

Referenced by operator!=().

◆ size()

std::string::size_type t_string_base::size ( ) const
inline

Definition at line 104 of file tstring.hpp.

References str().

Referenced by t_string::size().

◆ str()

const std::string & t_string_base::str ( ) const

◆ to_serialized()

std::string t_string_base::to_serialized ( ) const

Definition at line 375 of file tstring.cpp.

References last_untranslatable_, translatable_, value(), value_, and w.

Referenced by t_string::to_serialized().

◆ translatable()

bool t_string_base::translatable ( ) const
inline

Definition at line 109 of file tstring.hpp.

References translatable_.

Referenced by t_string::translatable().

◆ value()

const std::string& t_string_base::value ( ) const
inline

Definition at line 113 of file tstring.hpp.

References value_.

Referenced by to_serialized(), and t_string::value().

Friends And Related Function Documentation

◆ walker

friend class walker
friend

Definition at line 57 of file tstring.hpp.

Member Data Documentation

◆ id_to_textdomain

std::vector<std::string> t_string_base::id_to_textdomain
inlinestaticprivate

Definition at line 123 of file tstring.hpp.

Referenced by t_string_base(), and t_string_base::walker::update().

◆ last_untranslatable_

bool t_string_base::last_untranslatable_
private

Definition at line 122 of file tstring.hpp.

Referenced by hash_value(), operator+=(), operator=(), and to_serialized().

◆ textdomain_to_id

std::map<std::string, unsigned int> t_string_base::textdomain_to_id
inlinestaticprivate

Definition at line 124 of file tstring.hpp.

Referenced by t_string_base().

◆ translatable_

bool t_string_base::translatable_
private

◆ translated_value_

std::string t_string_base::translated_value_
mutableprivate

Definition at line 120 of file tstring.hpp.

Referenced by operator+=(), operator=(), and str().

◆ translation_timestamp_

unsigned t_string_base::translation_timestamp_
mutableprivate

Definition at line 121 of file tstring.hpp.

Referenced by operator=(), and str().

◆ value_

std::string t_string_base::value_
private

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