Audacity  3.0.3
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 ),
276  TranslatableString::TranslateArgument( args, debug )...
277  );
278  }
279  }
280  };
281  return std::move(ts);
282  }

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:
TranslatableString::Request::Format
@ Format
Given the msgid, format the string for end users.
TranslatableString::DoGetContext
static wxString DoGetContext(const Formatter &formatter)
Definition: TranslatableString.cpp:89
str
#define str(a)
Definition: DBConnection.cpp:30
TranslatableString::PluralTemp::ts
TranslatableString & ts
Definition: TranslatableString.h:249
TranslatableString::PluralTemp::pluralStr
const wxString & pluralStr
Definition: TranslatableString.h:250
TranslatableString::DoChooseFormat
static wxString DoChooseFormat(const Formatter &formatter, const wxString &singular, const wxString &plural, unsigned nn, bool debug)
Definition: TranslatableString.cpp:103
TranslatableString::Request::Context
@ Context
return a disambiguating context string
TranslatableString::mFormatter
Formatter mFormatter
Definition: TranslatableString.h:286
TranslatableString::TranslateArgument
static const T & TranslateArgument(const T &arg, bool)
Definition: TranslatableString.h:236
TranslatableString::Request::DebugFormat
@ DebugFormat
Given the msgid, format the string for developers.
Request
Class to construct the HTTP request.