github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/golang/text/internal/number/common.go (about)

     1  // This file was generated by go generate; DO NOT EDIT
     2  
     3  package number
     4  
     5  import (
     6  	"unicode/utf8"
     7  
     8  	"github.com/insionng/yougam/libraries/x/text/internal/format/plural"
     9  )
    10  
    11  // A system identifies a CLDR numbering system.
    12  type system byte
    13  
    14  type systemData struct {
    15  	id        system
    16  	digitSize byte              // number of UTF-8 bytes per digit
    17  	zero      [utf8.UTFMax]byte // UTF-8 sequence of zero digit.
    18  }
    19  
    20  // A SymbolType identifies a symbol of a specific kind.
    21  type SymbolType int
    22  
    23  const (
    24  	SymDecimal SymbolType = iota
    25  	SymGroup
    26  	SymList
    27  	SymPercentSign
    28  	SymPlusSign
    29  	SymMinusSign
    30  	SymExponential
    31  	SymSuperscriptingExponent
    32  	SymPerMille
    33  	SymInfinity
    34  	SymNan
    35  	SymTimeSeparator
    36  
    37  	NumSymbolTypes
    38  )
    39  
    40  type altSymData struct {
    41  	compactTag uint16
    42  	system     system
    43  	symIndex   byte
    44  }
    45  
    46  var countMap = map[string]plural.Form{
    47  	"other": plural.Other,
    48  	"zero":  plural.Zero,
    49  	"one":   plural.One,
    50  	"two":   plural.Two,
    51  	"few":   plural.Few,
    52  	"many":  plural.Many,
    53  }
    54  
    55  type pluralCheck struct {
    56  	// category:
    57  	// 3..7: opID
    58  	// 0..2: category
    59  	cat   byte
    60  	setID byte
    61  }
    62  
    63  // opID identifies the type of operand in the plural rule, being i, n or f.
    64  // (v, w, and t are treated as filters in our implementation.)
    65  type opID byte
    66  
    67  const (
    68  	opMod           opID = 0x1    // is '%' used?
    69  	opNotEqual      opID = 0x2    // using "!=" to compare
    70  	opI             opID = 0 << 2 // integers after taking the absolute value
    71  	opN             opID = 1 << 2 // full number (must be integer)
    72  	opF             opID = 2 << 2 // fraction
    73  	opV             opID = 3 << 2 // number of visible digits
    74  	opW             opID = 4 << 2 // number of visible digits without trailing zeros
    75  	opBretonM       opID = 5 << 2 // hard-wired rule for Breton
    76  	opItalian800    opID = 6 << 2 // hard-wired rule for Italian
    77  	opAzerbaijan00s opID = 7 << 2 // hard-wired rule for Azerbaijan
    78  )
    79  const (
    80  	// Use this plural form to indicate the next rule needs to match as well.
    81  	// The last condition in the list will have the correct plural form.
    82  	andNext  = 0x7
    83  	formMask = 0x7
    84  
    85  	opShift = 3
    86  
    87  	// numN indicates the maximum integer, or maximum mod value, for which we
    88  	// have inclusion masks.
    89  	numN = 100
    90  	// The common denominator of the modulo that is taken.
    91  	maxMod = 100
    92  )