-
Notifications
You must be signed in to change notification settings - Fork 0
/
types_gen.go
1619 lines (1298 loc) · 42.5 KB
/
types_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ***********************************************************
// GENERATED FILE - DO NOT EDIT BY HAND.
// ***********************************************************
package yuppie
import (
"fmt"
"net/url"
"reflect"
"sync"
"time"
r "gitlab.com/go-utilities/reflect"
)
// constructors maps UPnP types to constructor functions
var constructors = map[string]func(string) (StateVar, error){
"ui1": func(v string) (StateVar, error) { return newUpnpUI1(v) },
"ui2": func(v string) (StateVar, error) { return newUpnpUI2(v) },
"ui4": func(v string) (StateVar, error) { return newUpnpUI4(v) },
"ui8": func(v string) (StateVar, error) { return newUpnpUI8(v) },
"i1": func(v string) (StateVar, error) { return newUpnpI1(v) },
"i2": func(v string) (StateVar, error) { return newUpnpI2(v) },
"i4": func(v string) (StateVar, error) { return newUpnpI4(v) },
"int": func(v string) (StateVar, error) { return newUpnpInt(v) },
"r4": func(v string) (StateVar, error) { return newUpnpR4(v) },
"r8": func(v string) (StateVar, error) { return newUpnpR8(v) },
"number": func(v string) (StateVar, error) { return newUpnpNumber(v) },
"fixed.14.4": func(v string) (StateVar, error) { return newUpnpFixed14_4(v) },
"float": func(v string) (StateVar, error) { return newUpnpFloat(v) },
"char": func(v string) (StateVar, error) { return newUpnpChar(v) },
"string": func(v string) (StateVar, error) { return newUpnpString(v) },
"date": func(v string) (StateVar, error) { return newUpnpDate(v) },
"dateTime": func(v string) (StateVar, error) { return newUpnpDateTime(v) },
"dateTime.tz": func(v string) (StateVar, error) { return newUpnpDateTimeTz(v) },
"time": func(v string) (StateVar, error) { return newUpnpTimeOfDay(v) },
"time.tz": func(v string) (StateVar, error) { return newUpnpTimeOfDayTz(v) },
"boolean": func(v string) (StateVar, error) { return newUpnpBoolean(v) },
"bin.base64": func(v string) (StateVar, error) { return newUpnpBinBase64(v) },
"bin.hex": func(v string) (StateVar, error) { return newUpnpBinHex(v) },
"uri": func(v string) (StateVar, error) { return newUpnpURI(v) },
}
// upnpUI1 is the representation of the UPnP type ui1 as Golang type
type upnpUI1 struct {
val uint8
*sync.Mutex
}
// newUpnpUI1 creates a new state variable that represents the UPnP type ui1
func newUpnpUI1(s string) (t *upnpUI1, err error) {
v, err := unmarshalUpnpUI1(s)
if err != nil {
return nil, err
}
t = &upnpUI1{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpUI1) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpUI1) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "uint8" {
err = fmt.Errorf("expected type uint8, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(uint8)
return
}
// Init initializes t with a new value v
func (t *upnpUI1) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpUI1) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpUI1(s)
return
}
// String returns the string representation of the value of t
func (t upnpUI1) String() string {
s, _ := marshalUpnpUI1(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpUI1) Type() string { return "ui1" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpUI1) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpUI1) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpUI1) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpUI2 is the representation of the UPnP type ui2 as Golang type
type upnpUI2 struct {
val uint16
*sync.Mutex
}
// newUpnpUI2 creates a new state variable that represents the UPnP type ui2
func newUpnpUI2(s string) (t *upnpUI2, err error) {
v, err := unmarshalUpnpUI2(s)
if err != nil {
return nil, err
}
t = &upnpUI2{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpUI2) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpUI2) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "uint16" {
err = fmt.Errorf("expected type uint16, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(uint16)
return
}
// Init initializes t with a new value v
func (t *upnpUI2) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpUI2) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpUI2(s)
return
}
// String returns the string representation of the value of t
func (t upnpUI2) String() string {
s, _ := marshalUpnpUI2(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpUI2) Type() string { return "ui2" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpUI2) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpUI2) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpUI2) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpUI4 is the representation of the UPnP type ui4 as Golang type
type upnpUI4 struct {
val uint32
*sync.Mutex
}
// newUpnpUI4 creates a new state variable that represents the UPnP type ui4
func newUpnpUI4(s string) (t *upnpUI4, err error) {
v, err := unmarshalUpnpUI4(s)
if err != nil {
return nil, err
}
t = &upnpUI4{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpUI4) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpUI4) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "uint32" {
err = fmt.Errorf("expected type uint32, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(uint32)
return
}
// Init initializes t with a new value v
func (t *upnpUI4) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpUI4) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpUI4(s)
return
}
// String returns the string representation of the value of t
func (t upnpUI4) String() string {
s, _ := marshalUpnpUI4(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpUI4) Type() string { return "ui4" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpUI4) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpUI4) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpUI4) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpUI8 is the representation of the UPnP type ui8 as Golang type
type upnpUI8 struct {
val uint64
*sync.Mutex
}
// newUpnpUI8 creates a new state variable that represents the UPnP type ui8
func newUpnpUI8(s string) (t *upnpUI8, err error) {
v, err := unmarshalUpnpUI8(s)
if err != nil {
return nil, err
}
t = &upnpUI8{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpUI8) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpUI8) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "uint64" {
err = fmt.Errorf("expected type uint64, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(uint64)
return
}
// Init initializes t with a new value v
func (t *upnpUI8) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpUI8) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpUI8(s)
return
}
// String returns the string representation of the value of t
func (t upnpUI8) String() string {
s, _ := marshalUpnpUI8(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpUI8) Type() string { return "ui8" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpUI8) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpUI8) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpUI8) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpI1 is the representation of the UPnP type i1 as Golang type
type upnpI1 struct {
val int8
*sync.Mutex
}
// newUpnpI1 creates a new state variable that represents the UPnP type i1
func newUpnpI1(s string) (t *upnpI1, err error) {
v, err := unmarshalUpnpI1(s)
if err != nil {
return nil, err
}
t = &upnpI1{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpI1) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpI1) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "int8" {
err = fmt.Errorf("expected type int8, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(int8)
return
}
// Init initializes t with a new value v
func (t *upnpI1) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpI1) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpI1(s)
return
}
// String returns the string representation of the value of t
func (t upnpI1) String() string {
s, _ := marshalUpnpI1(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpI1) Type() string { return "i1" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpI1) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpI1) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpI1) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpI2 is the representation of the UPnP type i2 as Golang type
type upnpI2 struct {
val int16
*sync.Mutex
}
// newUpnpI2 creates a new state variable that represents the UPnP type i2
func newUpnpI2(s string) (t *upnpI2, err error) {
v, err := unmarshalUpnpI2(s)
if err != nil {
return nil, err
}
t = &upnpI2{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpI2) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpI2) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "int16" {
err = fmt.Errorf("expected type int16, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(int16)
return
}
// Init initializes t with a new value v
func (t *upnpI2) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpI2) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpI2(s)
return
}
// String returns the string representation of the value of t
func (t upnpI2) String() string {
s, _ := marshalUpnpI2(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpI2) Type() string { return "i2" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpI2) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpI2) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpI2) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpI4 is the representation of the UPnP type i4 as Golang type
type upnpI4 struct {
val int32
*sync.Mutex
}
// newUpnpI4 creates a new state variable that represents the UPnP type i4
func newUpnpI4(s string) (t *upnpI4, err error) {
v, err := unmarshalUpnpI4(s)
if err != nil {
return nil, err
}
t = &upnpI4{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpI4) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpI4) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "int32" {
err = fmt.Errorf("expected type int32, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(int32)
return
}
// Init initializes t with a new value v
func (t *upnpI4) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpI4) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpI4(s)
return
}
// String returns the string representation of the value of t
func (t upnpI4) String() string {
s, _ := marshalUpnpI4(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpI4) Type() string { return "i4" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpI4) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpI4) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpI4) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpInt is the representation of the UPnP type int as Golang type
type upnpInt struct {
val int64
*sync.Mutex
}
// newUpnpInt creates a new state variable that represents the UPnP type int
func newUpnpInt(s string) (t *upnpInt, err error) {
v, err := unmarshalUpnpInt(s)
if err != nil {
return nil, err
}
t = &upnpInt{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpInt) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpInt) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "int64" {
err = fmt.Errorf("expected type int64, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(int64)
return
}
// Init initializes t with a new value v
func (t *upnpInt) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpInt) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpInt(s)
return
}
// String returns the string representation of the value of t
func (t upnpInt) String() string {
s, _ := marshalUpnpInt(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpInt) Type() string { return "int" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpInt) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpInt) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpInt) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpR4 is the representation of the UPnP type r4 as Golang type
type upnpR4 struct {
val float32
*sync.Mutex
}
// newUpnpR4 creates a new state variable that represents the UPnP type r4
func newUpnpR4(s string) (t *upnpR4, err error) {
v, err := unmarshalUpnpR4(s)
if err != nil {
return nil, err
}
t = &upnpR4{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpR4) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpR4) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "float32" {
err = fmt.Errorf("expected type float32, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(float32)
return
}
// Init initializes t with a new value v
func (t *upnpR4) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpR4) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpR4(s)
return
}
// String returns the string representation of the value of t
func (t upnpR4) String() string {
s, _ := marshalUpnpR4(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpR4) Type() string { return "r4" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpR4) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpR4) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpR4) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpR8 is the representation of the UPnP type r8 as Golang type
type upnpR8 struct {
val float64
*sync.Mutex
}
// newUpnpR8 creates a new state variable that represents the UPnP type r8
func newUpnpR8(s string) (t *upnpR8, err error) {
v, err := unmarshalUpnpR8(s)
if err != nil {
return nil, err
}
t = &upnpR8{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpR8) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpR8) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "float64" {
err = fmt.Errorf("expected type float64, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(float64)
return
}
// Init initializes t with a new value v
func (t *upnpR8) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpR8) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpR8(s)
return
}
// String returns the string representation of the value of t
func (t upnpR8) String() string {
s, _ := marshalUpnpR8(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpR8) Type() string { return "r8" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpR8) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpR8) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpR8) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpNumber is the representation of the UPnP type number as Golang type
type upnpNumber struct {
val float64
*sync.Mutex
}
// newUpnpNumber creates a new state variable that represents the UPnP type number
func newUpnpNumber(s string) (t *upnpNumber, err error) {
v, err := unmarshalUpnpNumber(s)
if err != nil {
return nil, err
}
t = &upnpNumber{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpNumber) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpNumber) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "float64" {
err = fmt.Errorf("expected type float64, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(float64)
return
}
// Init initializes t with a new value v
func (t *upnpNumber) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpNumber) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpNumber(s)
return
}
// String returns the string representation of the value of t
func (t upnpNumber) String() string {
s, _ := marshalUpnpNumber(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpNumber) Type() string { return "number" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpNumber) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpNumber) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpNumber) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpFixed14_4 is the representation of the UPnP type fixed.14.4 as Golang type
type upnpFixed14_4 struct {
val float64
*sync.Mutex
}
// newUpnpFixed14_4 creates a new state variable that represents the UPnP type fixed.14.4
func newUpnpFixed14_4(s string) (t *upnpFixed14_4, err error) {
v, err := unmarshalUpnpFixed14_4(s)
if err != nil {
return nil, err
}
t = &upnpFixed14_4{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpFixed14_4) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpFixed14_4) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "float64" {
err = fmt.Errorf("expected type float64, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(float64)
return
}
// Init initializes t with a new value v
func (t *upnpFixed14_4) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpFixed14_4) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpFixed14_4(s)
return
}
// String returns the string representation of the value of t
func (t upnpFixed14_4) String() string {
s, _ := marshalUpnpFixed14_4(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpFixed14_4) Type() string { return "fixed.14.4" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpFixed14_4) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpFixed14_4) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpFixed14_4) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpFloat is the representation of the UPnP type float as Golang type
type upnpFloat struct {
val float64
*sync.Mutex
}
// newUpnpFloat creates a new state variable that represents the UPnP type float
func newUpnpFloat(s string) (t *upnpFloat, err error) {
v, err := unmarshalUpnpFloat(s)
if err != nil {
return nil, err
}
t = &upnpFloat{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpFloat) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpFloat) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "float64" {
err = fmt.Errorf("expected type float64, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(float64)
return
}
// Init initializes t with a new value v
func (t *upnpFloat) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpFloat) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpFloat(s)
return
}
// String returns the string representation of the value of t
func (t upnpFloat) String() string {
s, _ := marshalUpnpFloat(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpFloat) Type() string { return "float" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpFloat) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpFloat) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpFloat) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpChar is the representation of the UPnP type char as Golang type
type upnpChar struct {
val rune
*sync.Mutex
}
// newUpnpChar creates a new state variable that represents the UPnP type char
func newUpnpChar(s string) (t *upnpChar, err error) {
v, err := unmarshalUpnpChar(s)
if err != nil {
return nil, err
}
t = &upnpChar{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpChar) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpChar) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "rune" {
err = fmt.Errorf("expected type rune, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(rune)
return
}
// Init initializes t with a new value v
func (t *upnpChar) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpChar) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpChar(s)
return
}
// String returns the string representation of the value of t
func (t upnpChar) String() string {
s, _ := marshalUpnpChar(t.val)
return s
}
// Type returns the UPnP type of t
func (t upnpChar) Type() string { return "char" }
// IsNumeric returns true is the value of t is numeric, otherwise false is
// returned
func (t *upnpChar) IsNumeric() bool { return isNumeric(t.val) }
// IsString returns true is the value of t is a string, otherwise false is
// returned
func (t *upnpChar) IsString() bool { return isString(t.val) }
// IsZero returns true is the value of t is the zero value of that type,
// otherwise false is returned
func (t upnpChar) IsZero() bool { return reflect.ValueOf(t.val).IsZero() }
// upnpString is the representation of the UPnP type string as Golang type
type upnpString struct {
val string
*sync.Mutex
}
// newUpnpString creates a new state variable that represents the UPnP type string
func newUpnpString(s string) (t *upnpString, err error) {
v, err := unmarshalUpnpString(s)
if err != nil {
return nil, err
}
t = &upnpString{ v, &sync.Mutex{} }
return
}
// Get returns the value of t
func (t upnpString) Get() interface{} {
return t.val
}
// Set sets t to the new value v
func (t *upnpString) Set(v interface{}) (err error) {
if reflect.TypeOf(v).String() != "string" {
err = fmt.Errorf("expected type string, received: %s", reflect.TypeOf(v))
return
}
t.val = v.(string)
return
}
// Init initializes t with a new value v
func (t *upnpString) Init(v interface{}) (err error) {
return t.Set(v)
}
// SetFromString sets the value of t from s
func (t *upnpString) SetFromString(s string) (err error) {
t.val, err = unmarshalUpnpString(s)
return
}
// String returns the string representation of the value of t