easyjson.go 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
  2. package pwa
  3. import (
  4. json "encoding/json"
  5. easyjson "github.com/mailru/easyjson"
  6. jlexer "github.com/mailru/easyjson/jlexer"
  7. jwriter "github.com/mailru/easyjson/jwriter"
  8. )
  9. // suppress unused package warning
  10. var (
  11. _ *json.RawMessage
  12. _ *jlexer.Lexer
  13. _ *jwriter.Writer
  14. _ easyjson.Marshaler
  15. )
  16. func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa(in *jlexer.Lexer, out *GetOsAppStateReturns) {
  17. isTopLevel := in.IsStart()
  18. if in.IsNull() {
  19. if isTopLevel {
  20. in.Consumed()
  21. }
  22. in.Skip()
  23. return
  24. }
  25. in.Delim('{')
  26. for !in.IsDelim('}') {
  27. key := in.UnsafeFieldName(false)
  28. in.WantColon()
  29. if in.IsNull() {
  30. in.Skip()
  31. in.WantComma()
  32. continue
  33. }
  34. switch key {
  35. case "badgeCount":
  36. out.BadgeCount = int64(in.Int64())
  37. case "fileHandlers":
  38. if in.IsNull() {
  39. in.Skip()
  40. out.FileHandlers = nil
  41. } else {
  42. in.Delim('[')
  43. if out.FileHandlers == nil {
  44. if !in.IsDelim(']') {
  45. out.FileHandlers = make([]*FileHandler, 0, 8)
  46. } else {
  47. out.FileHandlers = []*FileHandler{}
  48. }
  49. } else {
  50. out.FileHandlers = (out.FileHandlers)[:0]
  51. }
  52. for !in.IsDelim(']') {
  53. var v1 *FileHandler
  54. if in.IsNull() {
  55. in.Skip()
  56. v1 = nil
  57. } else {
  58. if v1 == nil {
  59. v1 = new(FileHandler)
  60. }
  61. (*v1).UnmarshalEasyJSON(in)
  62. }
  63. out.FileHandlers = append(out.FileHandlers, v1)
  64. in.WantComma()
  65. }
  66. in.Delim(']')
  67. }
  68. default:
  69. in.SkipRecursive()
  70. }
  71. in.WantComma()
  72. }
  73. in.Delim('}')
  74. if isTopLevel {
  75. in.Consumed()
  76. }
  77. }
  78. func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa(out *jwriter.Writer, in GetOsAppStateReturns) {
  79. out.RawByte('{')
  80. first := true
  81. _ = first
  82. if in.BadgeCount != 0 {
  83. const prefix string = ",\"badgeCount\":"
  84. first = false
  85. out.RawString(prefix[1:])
  86. out.Int64(int64(in.BadgeCount))
  87. }
  88. if len(in.FileHandlers) != 0 {
  89. const prefix string = ",\"fileHandlers\":"
  90. if first {
  91. first = false
  92. out.RawString(prefix[1:])
  93. } else {
  94. out.RawString(prefix)
  95. }
  96. {
  97. out.RawByte('[')
  98. for v2, v3 := range in.FileHandlers {
  99. if v2 > 0 {
  100. out.RawByte(',')
  101. }
  102. if v3 == nil {
  103. out.RawString("null")
  104. } else {
  105. (*v3).MarshalEasyJSON(out)
  106. }
  107. }
  108. out.RawByte(']')
  109. }
  110. }
  111. out.RawByte('}')
  112. }
  113. // MarshalJSON supports json.Marshaler interface
  114. func (v GetOsAppStateReturns) MarshalJSON() ([]byte, error) {
  115. w := jwriter.Writer{}
  116. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa(&w, v)
  117. return w.Buffer.BuildBytes(), w.Error
  118. }
  119. // MarshalEasyJSON supports easyjson.Marshaler interface
  120. func (v GetOsAppStateReturns) MarshalEasyJSON(w *jwriter.Writer) {
  121. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa(w, v)
  122. }
  123. // UnmarshalJSON supports json.Unmarshaler interface
  124. func (v *GetOsAppStateReturns) UnmarshalJSON(data []byte) error {
  125. r := jlexer.Lexer{Data: data}
  126. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa(&r, v)
  127. return r.Error()
  128. }
  129. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  130. func (v *GetOsAppStateReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
  131. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa(l, v)
  132. }
  133. func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa1(in *jlexer.Lexer, out *GetOsAppStateParams) {
  134. isTopLevel := in.IsStart()
  135. if in.IsNull() {
  136. if isTopLevel {
  137. in.Consumed()
  138. }
  139. in.Skip()
  140. return
  141. }
  142. in.Delim('{')
  143. for !in.IsDelim('}') {
  144. key := in.UnsafeFieldName(false)
  145. in.WantColon()
  146. if in.IsNull() {
  147. in.Skip()
  148. in.WantComma()
  149. continue
  150. }
  151. switch key {
  152. case "manifestId":
  153. out.ManifestID = string(in.String())
  154. default:
  155. in.SkipRecursive()
  156. }
  157. in.WantComma()
  158. }
  159. in.Delim('}')
  160. if isTopLevel {
  161. in.Consumed()
  162. }
  163. }
  164. func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa1(out *jwriter.Writer, in GetOsAppStateParams) {
  165. out.RawByte('{')
  166. first := true
  167. _ = first
  168. {
  169. const prefix string = ",\"manifestId\":"
  170. out.RawString(prefix[1:])
  171. out.String(string(in.ManifestID))
  172. }
  173. out.RawByte('}')
  174. }
  175. // MarshalJSON supports json.Marshaler interface
  176. func (v GetOsAppStateParams) MarshalJSON() ([]byte, error) {
  177. w := jwriter.Writer{}
  178. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa1(&w, v)
  179. return w.Buffer.BuildBytes(), w.Error
  180. }
  181. // MarshalEasyJSON supports easyjson.Marshaler interface
  182. func (v GetOsAppStateParams) MarshalEasyJSON(w *jwriter.Writer) {
  183. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa1(w, v)
  184. }
  185. // UnmarshalJSON supports json.Unmarshaler interface
  186. func (v *GetOsAppStateParams) UnmarshalJSON(data []byte) error {
  187. r := jlexer.Lexer{Data: data}
  188. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa1(&r, v)
  189. return r.Error()
  190. }
  191. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  192. func (v *GetOsAppStateParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
  193. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa1(l, v)
  194. }
  195. func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa2(in *jlexer.Lexer, out *FileHandlerAccept) {
  196. isTopLevel := in.IsStart()
  197. if in.IsNull() {
  198. if isTopLevel {
  199. in.Consumed()
  200. }
  201. in.Skip()
  202. return
  203. }
  204. in.Delim('{')
  205. for !in.IsDelim('}') {
  206. key := in.UnsafeFieldName(false)
  207. in.WantColon()
  208. if in.IsNull() {
  209. in.Skip()
  210. in.WantComma()
  211. continue
  212. }
  213. switch key {
  214. case "mediaType":
  215. out.MediaType = string(in.String())
  216. case "fileExtensions":
  217. if in.IsNull() {
  218. in.Skip()
  219. out.FileExtensions = nil
  220. } else {
  221. in.Delim('[')
  222. if out.FileExtensions == nil {
  223. if !in.IsDelim(']') {
  224. out.FileExtensions = make([]string, 0, 4)
  225. } else {
  226. out.FileExtensions = []string{}
  227. }
  228. } else {
  229. out.FileExtensions = (out.FileExtensions)[:0]
  230. }
  231. for !in.IsDelim(']') {
  232. var v4 string
  233. v4 = string(in.String())
  234. out.FileExtensions = append(out.FileExtensions, v4)
  235. in.WantComma()
  236. }
  237. in.Delim(']')
  238. }
  239. default:
  240. in.SkipRecursive()
  241. }
  242. in.WantComma()
  243. }
  244. in.Delim('}')
  245. if isTopLevel {
  246. in.Consumed()
  247. }
  248. }
  249. func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa2(out *jwriter.Writer, in FileHandlerAccept) {
  250. out.RawByte('{')
  251. first := true
  252. _ = first
  253. {
  254. const prefix string = ",\"mediaType\":"
  255. out.RawString(prefix[1:])
  256. out.String(string(in.MediaType))
  257. }
  258. {
  259. const prefix string = ",\"fileExtensions\":"
  260. out.RawString(prefix)
  261. if in.FileExtensions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
  262. out.RawString("null")
  263. } else {
  264. out.RawByte('[')
  265. for v5, v6 := range in.FileExtensions {
  266. if v5 > 0 {
  267. out.RawByte(',')
  268. }
  269. out.String(string(v6))
  270. }
  271. out.RawByte(']')
  272. }
  273. }
  274. out.RawByte('}')
  275. }
  276. // MarshalJSON supports json.Marshaler interface
  277. func (v FileHandlerAccept) MarshalJSON() ([]byte, error) {
  278. w := jwriter.Writer{}
  279. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa2(&w, v)
  280. return w.Buffer.BuildBytes(), w.Error
  281. }
  282. // MarshalEasyJSON supports easyjson.Marshaler interface
  283. func (v FileHandlerAccept) MarshalEasyJSON(w *jwriter.Writer) {
  284. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa2(w, v)
  285. }
  286. // UnmarshalJSON supports json.Unmarshaler interface
  287. func (v *FileHandlerAccept) UnmarshalJSON(data []byte) error {
  288. r := jlexer.Lexer{Data: data}
  289. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa2(&r, v)
  290. return r.Error()
  291. }
  292. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  293. func (v *FileHandlerAccept) UnmarshalEasyJSON(l *jlexer.Lexer) {
  294. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa2(l, v)
  295. }
  296. func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa3(in *jlexer.Lexer, out *FileHandler) {
  297. isTopLevel := in.IsStart()
  298. if in.IsNull() {
  299. if isTopLevel {
  300. in.Consumed()
  301. }
  302. in.Skip()
  303. return
  304. }
  305. in.Delim('{')
  306. for !in.IsDelim('}') {
  307. key := in.UnsafeFieldName(false)
  308. in.WantColon()
  309. if in.IsNull() {
  310. in.Skip()
  311. in.WantComma()
  312. continue
  313. }
  314. switch key {
  315. case "action":
  316. out.Action = string(in.String())
  317. case "accepts":
  318. if in.IsNull() {
  319. in.Skip()
  320. out.Accepts = nil
  321. } else {
  322. in.Delim('[')
  323. if out.Accepts == nil {
  324. if !in.IsDelim(']') {
  325. out.Accepts = make([]*FileHandlerAccept, 0, 8)
  326. } else {
  327. out.Accepts = []*FileHandlerAccept{}
  328. }
  329. } else {
  330. out.Accepts = (out.Accepts)[:0]
  331. }
  332. for !in.IsDelim(']') {
  333. var v7 *FileHandlerAccept
  334. if in.IsNull() {
  335. in.Skip()
  336. v7 = nil
  337. } else {
  338. if v7 == nil {
  339. v7 = new(FileHandlerAccept)
  340. }
  341. (*v7).UnmarshalEasyJSON(in)
  342. }
  343. out.Accepts = append(out.Accepts, v7)
  344. in.WantComma()
  345. }
  346. in.Delim(']')
  347. }
  348. case "displayName":
  349. out.DisplayName = string(in.String())
  350. default:
  351. in.SkipRecursive()
  352. }
  353. in.WantComma()
  354. }
  355. in.Delim('}')
  356. if isTopLevel {
  357. in.Consumed()
  358. }
  359. }
  360. func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa3(out *jwriter.Writer, in FileHandler) {
  361. out.RawByte('{')
  362. first := true
  363. _ = first
  364. {
  365. const prefix string = ",\"action\":"
  366. out.RawString(prefix[1:])
  367. out.String(string(in.Action))
  368. }
  369. {
  370. const prefix string = ",\"accepts\":"
  371. out.RawString(prefix)
  372. if in.Accepts == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
  373. out.RawString("null")
  374. } else {
  375. out.RawByte('[')
  376. for v8, v9 := range in.Accepts {
  377. if v8 > 0 {
  378. out.RawByte(',')
  379. }
  380. if v9 == nil {
  381. out.RawString("null")
  382. } else {
  383. (*v9).MarshalEasyJSON(out)
  384. }
  385. }
  386. out.RawByte(']')
  387. }
  388. }
  389. {
  390. const prefix string = ",\"displayName\":"
  391. out.RawString(prefix)
  392. out.String(string(in.DisplayName))
  393. }
  394. out.RawByte('}')
  395. }
  396. // MarshalJSON supports json.Marshaler interface
  397. func (v FileHandler) MarshalJSON() ([]byte, error) {
  398. w := jwriter.Writer{}
  399. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa3(&w, v)
  400. return w.Buffer.BuildBytes(), w.Error
  401. }
  402. // MarshalEasyJSON supports easyjson.Marshaler interface
  403. func (v FileHandler) MarshalEasyJSON(w *jwriter.Writer) {
  404. easyjsonC5a4559bEncodeGithubComChromedpCdprotoPwa3(w, v)
  405. }
  406. // UnmarshalJSON supports json.Unmarshaler interface
  407. func (v *FileHandler) UnmarshalJSON(data []byte) error {
  408. r := jlexer.Lexer{Data: data}
  409. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa3(&r, v)
  410. return r.Error()
  411. }
  412. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  413. func (v *FileHandler) UnmarshalEasyJSON(l *jlexer.Lexer) {
  414. easyjsonC5a4559bDecodeGithubComChromedpCdprotoPwa3(l, v)
  415. }