Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
TranslatableString::PluralTemp< N > Struct Template Reference
Collaboration diagram for TranslatableString::PluralTemp< N >:
[legend]

Public Member Functions

template<typename... Args>
TranslatableString && operator() (Args &&... args)
 

Public Attributes

TranslatableStringts
 
const wxString & pluralStr
 

Detailed Description

template<size_t N>
struct TranslatableString::PluralTemp< N >

Definition at line 248 of file TranslatableString.h.

Member Function Documentation

◆ operator()()

template<size_t N>
template<typename... Args>
TranslatableString && TranslatableString::PluralTemp< N >::operator() ( Args &&...  args)
inline

Definition at line 252 of file TranslatableString.h.

253 {
254 // Pick from the pack the argument that specifies number
255 auto selector =
256 std::template get< N >( std::forward_as_tuple( args... ) );
257 // We need an unsigned value. Guard against negative values.
258 auto nn = static_cast<unsigned>(
259 std::max<unsigned long long>( 0, selector )
260 );
261 auto plural = this->pluralStr;
262 auto prevFormatter = this->ts.mFormatter;
263 this->ts.mFormatter = [prevFormatter, plural, nn, args...]
264 (const wxString &str, Request request) -> wxString {
265 switch ( request ) {
266 case Request::Context:
267 return TranslatableString::DoGetContext( prevFormatter );
268 case Request::Format:
270 default:
271 {
272 bool debug = request == Request::DebugFormat;
273 return wxString::Format(
275 prevFormatter, str, plural, nn, debug ),
277 );
278 }
279 }
280 };
281 return std::move(ts);
282 }
#define str(a)
Class to construct the HTTP request.
static wxString DoChooseFormat(const Formatter &formatter, const wxString &singular, const wxString &plural, unsigned nn, bool debug)
@ Format
Given the msgid, format the string for end users.
@ DebugFormat
Given the msgid, format the string for developers.
@ Context
return a disambiguating context string
static wxString DoGetContext(const Formatter &formatter)
static const T & TranslateArgument(const T &arg, bool)

References TranslatableString::DoChooseFormat(), TranslatableString::DoGetContext(), TranslatableString::mFormatter, str, and TranslatableString::TranslateArgument().

Here is the call graph for this function:

Member Data Documentation

◆ pluralStr

template<size_t N>
const wxString& TranslatableString::PluralTemp< N >::pluralStr

Definition at line 250 of file TranslatableString.h.

◆ ts

template<size_t N>
TranslatableString& TranslatableString::PluralTemp< N >::ts

Definition at line 249 of file TranslatableString.h.


The documentation for this struct was generated from the following file: