github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_universe_systems_system_id_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 easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetUniverseSystemsSystemIdOkList) {
    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(GetUniverseSystemsSystemIdOkList, 0, 0)
    31  			} else {
    32  				*out = GetUniverseSystemsSystemIdOkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetUniverseSystemsSystemIdOk
    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 easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetUniverseSystemsSystemIdOkList) {
    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 GetUniverseSystemsSystemIdOkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetUniverseSystemsSystemIdOkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetUniverseSystemsSystemIdOkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetUniverseSystemsSystemIdOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetUniverseSystemsSystemIdOk) {
    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 "constellation_id":
   107  			out.ConstellationId = int32(in.Int32())
   108  		case "name":
   109  			out.Name = string(in.String())
   110  		case "planets":
   111  			if in.IsNull() {
   112  				in.Skip()
   113  				out.Planets = nil
   114  			} else {
   115  				in.Delim('[')
   116  				if out.Planets == nil {
   117  					if !in.IsDelim(']') {
   118  						out.Planets = make([]GetUniverseSystemsSystemIdPlanet, 0, 1)
   119  					} else {
   120  						out.Planets = []GetUniverseSystemsSystemIdPlanet{}
   121  					}
   122  				} else {
   123  					out.Planets = (out.Planets)[:0]
   124  				}
   125  				for !in.IsDelim(']') {
   126  					var v4 GetUniverseSystemsSystemIdPlanet
   127  					easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi2(in, &v4)
   128  					out.Planets = append(out.Planets, v4)
   129  					in.WantComma()
   130  				}
   131  				in.Delim(']')
   132  			}
   133  		case "position":
   134  			(out.Position).UnmarshalEasyJSON(in)
   135  		case "security_class":
   136  			out.SecurityClass = string(in.String())
   137  		case "security_status":
   138  			out.SecurityStatus = float32(in.Float32())
   139  		case "star_id":
   140  			out.StarId = int32(in.Int32())
   141  		case "stargates":
   142  			if in.IsNull() {
   143  				in.Skip()
   144  				out.Stargates = nil
   145  			} else {
   146  				in.Delim('[')
   147  				if out.Stargates == nil {
   148  					if !in.IsDelim(']') {
   149  						out.Stargates = make([]int32, 0, 16)
   150  					} else {
   151  						out.Stargates = []int32{}
   152  					}
   153  				} else {
   154  					out.Stargates = (out.Stargates)[:0]
   155  				}
   156  				for !in.IsDelim(']') {
   157  					var v5 int32
   158  					v5 = int32(in.Int32())
   159  					out.Stargates = append(out.Stargates, v5)
   160  					in.WantComma()
   161  				}
   162  				in.Delim(']')
   163  			}
   164  		case "stations":
   165  			if in.IsNull() {
   166  				in.Skip()
   167  				out.Stations = nil
   168  			} else {
   169  				in.Delim('[')
   170  				if out.Stations == nil {
   171  					if !in.IsDelim(']') {
   172  						out.Stations = make([]int32, 0, 16)
   173  					} else {
   174  						out.Stations = []int32{}
   175  					}
   176  				} else {
   177  					out.Stations = (out.Stations)[:0]
   178  				}
   179  				for !in.IsDelim(']') {
   180  					var v6 int32
   181  					v6 = int32(in.Int32())
   182  					out.Stations = append(out.Stations, v6)
   183  					in.WantComma()
   184  				}
   185  				in.Delim(']')
   186  			}
   187  		case "system_id":
   188  			out.SystemId = int32(in.Int32())
   189  		default:
   190  			in.SkipRecursive()
   191  		}
   192  		in.WantComma()
   193  	}
   194  	in.Delim('}')
   195  	if isTopLevel {
   196  		in.Consumed()
   197  	}
   198  }
   199  func easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetUniverseSystemsSystemIdOk) {
   200  	out.RawByte('{')
   201  	first := true
   202  	_ = first
   203  	if in.ConstellationId != 0 {
   204  		const prefix string = ",\"constellation_id\":"
   205  		first = false
   206  		out.RawString(prefix[1:])
   207  		out.Int32(int32(in.ConstellationId))
   208  	}
   209  	if in.Name != "" {
   210  		const prefix string = ",\"name\":"
   211  		if first {
   212  			first = false
   213  			out.RawString(prefix[1:])
   214  		} else {
   215  			out.RawString(prefix)
   216  		}
   217  		out.String(string(in.Name))
   218  	}
   219  	if len(in.Planets) != 0 {
   220  		const prefix string = ",\"planets\":"
   221  		if first {
   222  			first = false
   223  			out.RawString(prefix[1:])
   224  		} else {
   225  			out.RawString(prefix)
   226  		}
   227  		{
   228  			out.RawByte('[')
   229  			for v7, v8 := range in.Planets {
   230  				if v7 > 0 {
   231  					out.RawByte(',')
   232  				}
   233  				easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi2(out, v8)
   234  			}
   235  			out.RawByte(']')
   236  		}
   237  	}
   238  	if true {
   239  		const prefix string = ",\"position\":"
   240  		if first {
   241  			first = false
   242  			out.RawString(prefix[1:])
   243  		} else {
   244  			out.RawString(prefix)
   245  		}
   246  		(in.Position).MarshalEasyJSON(out)
   247  	}
   248  	if in.SecurityClass != "" {
   249  		const prefix string = ",\"security_class\":"
   250  		if first {
   251  			first = false
   252  			out.RawString(prefix[1:])
   253  		} else {
   254  			out.RawString(prefix)
   255  		}
   256  		out.String(string(in.SecurityClass))
   257  	}
   258  	if in.SecurityStatus != 0 {
   259  		const prefix string = ",\"security_status\":"
   260  		if first {
   261  			first = false
   262  			out.RawString(prefix[1:])
   263  		} else {
   264  			out.RawString(prefix)
   265  		}
   266  		out.Float32(float32(in.SecurityStatus))
   267  	}
   268  	if in.StarId != 0 {
   269  		const prefix string = ",\"star_id\":"
   270  		if first {
   271  			first = false
   272  			out.RawString(prefix[1:])
   273  		} else {
   274  			out.RawString(prefix)
   275  		}
   276  		out.Int32(int32(in.StarId))
   277  	}
   278  	if len(in.Stargates) != 0 {
   279  		const prefix string = ",\"stargates\":"
   280  		if first {
   281  			first = false
   282  			out.RawString(prefix[1:])
   283  		} else {
   284  			out.RawString(prefix)
   285  		}
   286  		{
   287  			out.RawByte('[')
   288  			for v9, v10 := range in.Stargates {
   289  				if v9 > 0 {
   290  					out.RawByte(',')
   291  				}
   292  				out.Int32(int32(v10))
   293  			}
   294  			out.RawByte(']')
   295  		}
   296  	}
   297  	if len(in.Stations) != 0 {
   298  		const prefix string = ",\"stations\":"
   299  		if first {
   300  			first = false
   301  			out.RawString(prefix[1:])
   302  		} else {
   303  			out.RawString(prefix)
   304  		}
   305  		{
   306  			out.RawByte('[')
   307  			for v11, v12 := range in.Stations {
   308  				if v11 > 0 {
   309  					out.RawByte(',')
   310  				}
   311  				out.Int32(int32(v12))
   312  			}
   313  			out.RawByte(']')
   314  		}
   315  	}
   316  	if in.SystemId != 0 {
   317  		const prefix string = ",\"system_id\":"
   318  		if first {
   319  			first = false
   320  			out.RawString(prefix[1:])
   321  		} else {
   322  			out.RawString(prefix)
   323  		}
   324  		out.Int32(int32(in.SystemId))
   325  	}
   326  	out.RawByte('}')
   327  }
   328  
   329  // MarshalJSON supports json.Marshaler interface
   330  func (v GetUniverseSystemsSystemIdOk) MarshalJSON() ([]byte, error) {
   331  	w := jwriter.Writer{}
   332  	easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi1(&w, v)
   333  	return w.Buffer.BuildBytes(), w.Error
   334  }
   335  
   336  // MarshalEasyJSON supports easyjson.Marshaler interface
   337  func (v GetUniverseSystemsSystemIdOk) MarshalEasyJSON(w *jwriter.Writer) {
   338  	easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi1(w, v)
   339  }
   340  
   341  // UnmarshalJSON supports json.Unmarshaler interface
   342  func (v *GetUniverseSystemsSystemIdOk) UnmarshalJSON(data []byte) error {
   343  	r := jlexer.Lexer{Data: data}
   344  	easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi1(&r, v)
   345  	return r.Error()
   346  }
   347  
   348  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   349  func (v *GetUniverseSystemsSystemIdOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
   350  	easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi1(l, v)
   351  }
   352  func easyjsonF4e2485aDecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetUniverseSystemsSystemIdPlanet) {
   353  	isTopLevel := in.IsStart()
   354  	if in.IsNull() {
   355  		if isTopLevel {
   356  			in.Consumed()
   357  		}
   358  		in.Skip()
   359  		return
   360  	}
   361  	in.Delim('{')
   362  	for !in.IsDelim('}') {
   363  		key := in.UnsafeFieldName(false)
   364  		in.WantColon()
   365  		if in.IsNull() {
   366  			in.Skip()
   367  			in.WantComma()
   368  			continue
   369  		}
   370  		switch key {
   371  		case "asteroid_belts":
   372  			if in.IsNull() {
   373  				in.Skip()
   374  				out.AsteroidBelts = nil
   375  			} else {
   376  				in.Delim('[')
   377  				if out.AsteroidBelts == nil {
   378  					if !in.IsDelim(']') {
   379  						out.AsteroidBelts = make([]int32, 0, 16)
   380  					} else {
   381  						out.AsteroidBelts = []int32{}
   382  					}
   383  				} else {
   384  					out.AsteroidBelts = (out.AsteroidBelts)[:0]
   385  				}
   386  				for !in.IsDelim(']') {
   387  					var v13 int32
   388  					v13 = int32(in.Int32())
   389  					out.AsteroidBelts = append(out.AsteroidBelts, v13)
   390  					in.WantComma()
   391  				}
   392  				in.Delim(']')
   393  			}
   394  		case "moons":
   395  			if in.IsNull() {
   396  				in.Skip()
   397  				out.Moons = nil
   398  			} else {
   399  				in.Delim('[')
   400  				if out.Moons == nil {
   401  					if !in.IsDelim(']') {
   402  						out.Moons = make([]int32, 0, 16)
   403  					} else {
   404  						out.Moons = []int32{}
   405  					}
   406  				} else {
   407  					out.Moons = (out.Moons)[:0]
   408  				}
   409  				for !in.IsDelim(']') {
   410  					var v14 int32
   411  					v14 = int32(in.Int32())
   412  					out.Moons = append(out.Moons, v14)
   413  					in.WantComma()
   414  				}
   415  				in.Delim(']')
   416  			}
   417  		case "planet_id":
   418  			out.PlanetId = int32(in.Int32())
   419  		default:
   420  			in.SkipRecursive()
   421  		}
   422  		in.WantComma()
   423  	}
   424  	in.Delim('}')
   425  	if isTopLevel {
   426  		in.Consumed()
   427  	}
   428  }
   429  func easyjsonF4e2485aEncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetUniverseSystemsSystemIdPlanet) {
   430  	out.RawByte('{')
   431  	first := true
   432  	_ = first
   433  	if len(in.AsteroidBelts) != 0 {
   434  		const prefix string = ",\"asteroid_belts\":"
   435  		first = false
   436  		out.RawString(prefix[1:])
   437  		{
   438  			out.RawByte('[')
   439  			for v15, v16 := range in.AsteroidBelts {
   440  				if v15 > 0 {
   441  					out.RawByte(',')
   442  				}
   443  				out.Int32(int32(v16))
   444  			}
   445  			out.RawByte(']')
   446  		}
   447  	}
   448  	if len(in.Moons) != 0 {
   449  		const prefix string = ",\"moons\":"
   450  		if first {
   451  			first = false
   452  			out.RawString(prefix[1:])
   453  		} else {
   454  			out.RawString(prefix)
   455  		}
   456  		{
   457  			out.RawByte('[')
   458  			for v17, v18 := range in.Moons {
   459  				if v17 > 0 {
   460  					out.RawByte(',')
   461  				}
   462  				out.Int32(int32(v18))
   463  			}
   464  			out.RawByte(']')
   465  		}
   466  	}
   467  	if in.PlanetId != 0 {
   468  		const prefix string = ",\"planet_id\":"
   469  		if first {
   470  			first = false
   471  			out.RawString(prefix[1:])
   472  		} else {
   473  			out.RawString(prefix)
   474  		}
   475  		out.Int32(int32(in.PlanetId))
   476  	}
   477  	out.RawByte('}')
   478  }