github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_portrait_ok_easyjson.go (about)

     1  // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
     2  
     3  package esi
     4  
     5  import (
     6  	json "encoding/json"
     7  
     8  	easyjson "github.com/mailru/easyjson"
     9  	jlexer "github.com/mailru/easyjson/jlexer"
    10  	jwriter "github.com/mailru/easyjson/jwriter"
    11  )
    12  
    13  // suppress unused package warning
    14  var (
    15  	_ *json.RawMessage
    16  	_ *jlexer.Lexer
    17  	_ *jwriter.Writer
    18  	_ easyjson.Marshaler
    19  )
    20  
    21  func easyjson157419baDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdPortraitOkList) {
    22  	isTopLevel := in.IsStart()
    23  	if in.IsNull() {
    24  		in.Skip()
    25  		*out = nil
    26  	} else {
    27  		in.Delim('[')
    28  		if *out == nil {
    29  			if !in.IsDelim(']') {
    30  				*out = make(GetCharactersCharacterIdPortraitOkList, 0, 1)
    31  			} else {
    32  				*out = GetCharactersCharacterIdPortraitOkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetCharactersCharacterIdPortraitOk
    39  			(v1).UnmarshalEasyJSON(in)
    40  			*out = append(*out, v1)
    41  			in.WantComma()
    42  		}
    43  		in.Delim(']')
    44  	}
    45  	if isTopLevel {
    46  		in.Consumed()
    47  	}
    48  }
    49  func easyjson157419baEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdPortraitOkList) {
    50  	if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
    51  		out.RawString("null")
    52  	} else {
    53  		out.RawByte('[')
    54  		for v2, v3 := range in {
    55  			if v2 > 0 {
    56  				out.RawByte(',')
    57  			}
    58  			(v3).MarshalEasyJSON(out)
    59  		}
    60  		out.RawByte(']')
    61  	}
    62  }
    63  
    64  // MarshalJSON supports json.Marshaler interface
    65  func (v GetCharactersCharacterIdPortraitOkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson157419baEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetCharactersCharacterIdPortraitOkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson157419baEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetCharactersCharacterIdPortraitOkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson157419baDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetCharactersCharacterIdPortraitOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson157419baDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson157419baDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdPortraitOk) {
    88  	isTopLevel := in.IsStart()
    89  	if in.IsNull() {
    90  		if isTopLevel {
    91  			in.Consumed()
    92  		}
    93  		in.Skip()
    94  		return
    95  	}
    96  	in.Delim('{')
    97  	for !in.IsDelim('}') {
    98  		key := in.UnsafeFieldName(false)
    99  		in.WantColon()
   100  		if in.IsNull() {
   101  			in.Skip()
   102  			in.WantComma()
   103  			continue
   104  		}
   105  		switch key {
   106  		case "px128x128":
   107  			out.Px128x128 = string(in.String())
   108  		case "px256x256":
   109  			out.Px256x256 = string(in.String())
   110  		case "px512x512":
   111  			out.Px512x512 = string(in.String())
   112  		case "px64x64":
   113  			out.Px64x64 = string(in.String())
   114  		default:
   115  			in.SkipRecursive()
   116  		}
   117  		in.WantComma()
   118  	}
   119  	in.Delim('}')
   120  	if isTopLevel {
   121  		in.Consumed()
   122  	}
   123  }
   124  func easyjson157419baEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdPortraitOk) {
   125  	out.RawByte('{')
   126  	first := true
   127  	_ = first
   128  	if in.Px128x128 != "" {
   129  		const prefix string = ",\"px128x128\":"
   130  		first = false
   131  		out.RawString(prefix[1:])
   132  		out.String(string(in.Px128x128))
   133  	}
   134  	if in.Px256x256 != "" {
   135  		const prefix string = ",\"px256x256\":"
   136  		if first {
   137  			first = false
   138  			out.RawString(prefix[1:])
   139  		} else {
   140  			out.RawString(prefix)
   141  		}
   142  		out.String(string(in.Px256x256))
   143  	}
   144  	if in.Px512x512 != "" {
   145  		const prefix string = ",\"px512x512\":"
   146  		if first {
   147  			first = false
   148  			out.RawString(prefix[1:])
   149  		} else {
   150  			out.RawString(prefix)
   151  		}
   152  		out.String(string(in.Px512x512))
   153  	}
   154  	if in.Px64x64 != "" {
   155  		const prefix string = ",\"px64x64\":"
   156  		if first {
   157  			first = false
   158  			out.RawString(prefix[1:])
   159  		} else {
   160  			out.RawString(prefix)
   161  		}
   162  		out.String(string(in.Px64x64))
   163  	}
   164  	out.RawByte('}')
   165  }
   166  
   167  // MarshalJSON supports json.Marshaler interface
   168  func (v GetCharactersCharacterIdPortraitOk) MarshalJSON() ([]byte, error) {
   169  	w := jwriter.Writer{}
   170  	easyjson157419baEncodeGithubComAntihaxGoesiEsi1(&w, v)
   171  	return w.Buffer.BuildBytes(), w.Error
   172  }
   173  
   174  // MarshalEasyJSON supports easyjson.Marshaler interface
   175  func (v GetCharactersCharacterIdPortraitOk) MarshalEasyJSON(w *jwriter.Writer) {
   176  	easyjson157419baEncodeGithubComAntihaxGoesiEsi1(w, v)
   177  }
   178  
   179  // UnmarshalJSON supports json.Unmarshaler interface
   180  func (v *GetCharactersCharacterIdPortraitOk) UnmarshalJSON(data []byte) error {
   181  	r := jlexer.Lexer{Data: data}
   182  	easyjson157419baDecodeGithubComAntihaxGoesiEsi1(&r, v)
   183  	return r.Error()
   184  }
   185  
   186  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   187  func (v *GetCharactersCharacterIdPortraitOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
   188  	easyjson157419baDecodeGithubComAntihaxGoesiEsi1(l, v)
   189  }