OpenXcom  1.0
Open-source clone of the original X-Com
Public Member Functions | List of all members
OpenXcom::LocalizedText Class Reference

A string that is already translated. More...

#include <LocalizedText.h>

Public Member Functions

 LocalizedText (const std::string &)
 Create from existing string. More...
 
 LocalizedText ()
 Create the empty string.
 
 operator std::string const & () const OX_REQUIRED_RESULT
 Return constant string.
 
const char * c_str () const OX_REQUIRED_RESULT
 Get a pointer to underlying char data.
 
LocalizedText arg (const std::string &) const OX_REQUIRED_RESULT
 Replace next argument. More...
 
LocalizedTextarg (const std::string &) OX_REQUIRED_RESULT
 Replace the next argument placeholder with val. More...
 
template<typename T >
LocalizedText arg (T) const OX_REQUIRED_RESULT
 Replace the next argument placeholder with val. More...
 
template<typename T >
LocalizedTextarg (T) OX_REQUIRED_RESULT
 Replace the next argument placeholder with val. More...
 

Detailed Description

A string that is already translated.

Using this class allows argument substitution in the translated strings.

Constructor & Destructor Documentation

◆ LocalizedText()

OpenXcom::LocalizedText::LocalizedText ( const std::string &  text)
inline

Create from existing string.

Create a LocalizedText from a localized std::string.

Member Function Documentation

◆ arg() [1/4]

LocalizedText OpenXcom::LocalizedText::arg ( const std::string &  val) const

Replace next argument.

Replace the next argument placeholder with val.

Parameters
valThe value to place in the next placeholder's position.
Returns
A translated string with all occurrences of the marker replaced by val.

◆ arg() [2/4]

LocalizedText & OpenXcom::LocalizedText::arg ( const std::string &  val)

Replace the next argument placeholder with val.

Parameters
valThe value to place in the next placeholder's position.
Returns
The translated string with all occurrences of the marker replaced by val.

◆ arg() [3/4]

template<typename T >
LocalizedText OpenXcom::LocalizedText::arg ( val) const

Replace the next argument placeholder with val.

Template Parameters
TThe type of the replacement value. It should be streamable to std::owstringstream.
Parameters
valThe value to place in the next placeholder's position.
Returns
A translated string with all occurrences of the marker replaced by val.

◆ arg() [4/4]

template<typename T >
LocalizedText & OpenXcom::LocalizedText::arg ( val)

Replace the next argument placeholder with val.

Template Parameters
TThe type of the replacement value. It should be streamable to std::owstringstream.
Parameters
valThe value to place in the next placeholder's position.
Returns
The translated string with all occurrences of the marker replaced by val.

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