gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

any_int32.go (1142B)


      1 package jsoniter
      2 
      3 import (
      4 	"strconv"
      5 )
      6 
      7 type int32Any struct {
      8 	baseAny
      9 	val int32
     10 }
     11 
     12 func (any *int32Any) LastError() error {
     13 	return nil
     14 }
     15 
     16 func (any *int32Any) ValueType() ValueType {
     17 	return NumberValue
     18 }
     19 
     20 func (any *int32Any) MustBeValid() Any {
     21 	return any
     22 }
     23 
     24 func (any *int32Any) ToBool() bool {
     25 	return any.val != 0
     26 }
     27 
     28 func (any *int32Any) ToInt() int {
     29 	return int(any.val)
     30 }
     31 
     32 func (any *int32Any) ToInt32() int32 {
     33 	return any.val
     34 }
     35 
     36 func (any *int32Any) ToInt64() int64 {
     37 	return int64(any.val)
     38 }
     39 
     40 func (any *int32Any) ToUint() uint {
     41 	return uint(any.val)
     42 }
     43 
     44 func (any *int32Any) ToUint32() uint32 {
     45 	return uint32(any.val)
     46 }
     47 
     48 func (any *int32Any) ToUint64() uint64 {
     49 	return uint64(any.val)
     50 }
     51 
     52 func (any *int32Any) ToFloat32() float32 {
     53 	return float32(any.val)
     54 }
     55 
     56 func (any *int32Any) ToFloat64() float64 {
     57 	return float64(any.val)
     58 }
     59 
     60 func (any *int32Any) ToString() string {
     61 	return strconv.FormatInt(int64(any.val), 10)
     62 }
     63 
     64 func (any *int32Any) WriteTo(stream *Stream) {
     65 	stream.WriteInt32(any.val)
     66 }
     67 
     68 func (any *int32Any) Parse() *Iterator {
     69 	return nil
     70 }
     71 
     72 func (any *int32Any) GetInterface() interface{} {
     73 	return any.val
     74 }