energy/cef/cef-v8-js-string.go

39 lines
693 B
Go
Raw Normal View History

2022-10-04 13:21:05 +08:00
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
2022-10-04 16:38:43 +08:00
// Licensed under GNU General Public License v3.0
2022-10-04 13:21:05 +08:00
//
//----------------------------------------
package cef
2022-10-04 22:34:57 +08:00
import "github.com/energye/energy/consts"
2022-10-04 13:21:05 +08:00
type JSString struct {
ICEFv8Value
}
func (m *JSString) AsString() (*JSString, error) {
return m, nil
}
func (m *JSString) Value() string {
if val, err := m.StringValue(); err == nil {
return val
} else {
return ""
}
}
func (m *JSString) SetValue(value string) {
2022-10-04 22:34:57 +08:00
m.valueType = consts.V8_VALUE_STRING
2022-10-04 13:21:05 +08:00
m.value = value
}
func (m *JSString) ToString() string {
if val, err := m.StringValue(); err == nil {
return val
}
return ""
}