nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
nanommo::PluralRule Class Reference

#include <translations.h>

Public Member Functions

 PluralRule ()=default
 English's: one form for 1, and the other for any other count.
int forms () const
int Form (uint64_t n) const
 The form for the count, from 0.

Static Public Member Functions

static absl::StatusOr< PluralRule > Parse (std::string_view forms)

Detailed Description

How a language picks among a plural's forms by the count, as a PO file's Plural-Forms says, such as Romanian's "nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);": a C expression of n, with ?:, ||, &&, the comparisons, %, numbers and brackets.

Definition at line 21 of file translations.h.

Constructor & Destructor Documentation

◆ PluralRule()

nanommo::PluralRule::PluralRule ( )
default

English's: one form for 1, and the other for any other count.

Member Function Documentation

◆ Form()

int nanommo::PluralRule::Form ( uint64_t n) const

The form for the count, from 0.

Definition at line 440 of file translations.cc.

◆ forms()

int nanommo::PluralRule::forms ( ) const
inline

Definition at line 30 of file translations.h.

◆ Parse()

absl::StatusOr< PluralRule > nanommo::PluralRule::Parse ( std::string_view forms)
static

A rule that can't be read, or that picks a form past its last, is refused.

Definition at line 406 of file translations.cc.


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