summaryrefslogtreecommitdiff
path: root/android/api_levels.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/api_levels.go')
-rw-r--r--android/api_levels.go30
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))