diff options
author | 2025-03-12 12:11:48 -0700 | |
---|---|---|
committer | 2025-03-12 12:11:48 -0700 | |
commit | 7c18e7f15b997e0e3199111446e0511ffd96b811 (patch) | |
tree | bc12f661228775bb1b5469b38aeb68605ee48f2a /android/api_levels.go | |
parent | 18548fd4d847dea2090e8763d00f4d0ee22f21d0 (diff) | |
parent | 619b6ef5c5a06fe3eaaa3fd0bdbd44e6795b29e4 (diff) |
Merge "Add Gob support of ApiLevel and applicableLicensesPropertyImpl." into main
Diffstat (limited to 'android/api_levels.go')
-rw-r--r-- | android/api_levels.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/android/api_levels.go b/android/api_levels.go index c042eebee..c83fae878 100644 --- a/android/api_levels.go +++ b/android/api_levels.go @@ -19,6 +19,8 @@ import ( "fmt" "strconv" "strings" + + "github.com/google/blueprint/gobtools" ) func init() { @@ -52,6 +54,34 @@ type ApiLevel struct { isPreview bool } +type apiLevelGob struct { + Value string + Number int + IsPreview bool +} + +func (a *ApiLevel) ToGob() *apiLevelGob { + return &apiLevelGob{ + Value: a.value, + Number: a.number, + IsPreview: a.isPreview, + } +} + +func (a *ApiLevel) FromGob(data *apiLevelGob) { + a.value = data.Value + a.number = data.Number + a.isPreview = data.IsPreview +} + +func (a ApiLevel) GobEncode() ([]byte, error) { + return gobtools.CustomGobEncode[apiLevelGob](&a) +} + +func (a *ApiLevel) GobDecode(data []byte) error { + return gobtools.CustomGobDecode[apiLevelGob](data, a) +} + func (this ApiLevel) FinalInt() int { if this.IsInvalid() { panic(fmt.Errorf("%v is not a recognized api_level\n", this)) |