2019-03-01 16:02:21 +00:00
|
|
|
/**
|
|
|
|
* @author d98762625 [d98762625@gmail.com]
|
|
|
|
* @copyright Crown Copyright 2019
|
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-07-09 11:23:59 +00:00
|
|
|
import DishType from "./DishType.mjs";
|
|
|
|
import Utils from "../Utils.mjs";
|
2019-03-01 16:02:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translation methods for string dishes
|
|
|
|
*/
|
2019-07-05 08:44:01 +00:00
|
|
|
class DishString extends DishType {
|
2019-03-01 16:02:21 +00:00
|
|
|
|
|
|
|
/**
|
2019-04-04 14:21:52 +00:00
|
|
|
* convert the given value to a ArrayBuffer
|
2019-03-01 16:02:21 +00:00
|
|
|
*/
|
2019-04-04 14:21:52 +00:00
|
|
|
static toArrayBuffer() {
|
2019-03-01 16:02:21 +00:00
|
|
|
DishString.checkForValue(this.value);
|
2019-04-04 14:21:52 +00:00
|
|
|
this.value = this.value ? Utils.strToArrayBuffer(this.value) : new ArrayBuffer;
|
2019-03-01 16:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-04-04 14:21:52 +00:00
|
|
|
* convert the given value from a ArrayBuffer
|
2019-03-01 16:02:21 +00:00
|
|
|
*/
|
2023-01-13 14:38:50 +00:00
|
|
|
static fromArrayBuffer() {
|
2019-03-01 16:02:21 +00:00
|
|
|
DishString.checkForValue(this.value);
|
2023-01-13 14:38:50 +00:00
|
|
|
this.value = this.value ? Utils.arrayBufferToStr(this.value) : "";
|
2019-03-01 16:02:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default DishString;
|