2019-05-14 18:25:46 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
import { Coder, Reader, Writer } from "./abstract-coder";
|
|
|
|
|
|
|
|
// Clones the functionality of an existing Coder, but without a localName
|
|
|
|
export class AnonymousCoder extends Coder {
|
|
|
|
private coder: Coder;
|
|
|
|
|
|
|
|
constructor(coder: Coder) {
|
|
|
|
super(coder.name, coder.type, undefined, coder.dynamic);
|
|
|
|
this.coder = coder;
|
|
|
|
}
|
|
|
|
|
2020-11-23 00:59:44 -05:00
|
|
|
defaultValue(): any {
|
|
|
|
return this.coder.defaultValue();
|
|
|
|
}
|
|
|
|
|
2019-05-14 18:25:46 -04:00
|
|
|
encode(writer: Writer, value: any): number {
|
|
|
|
return this.coder.encode(writer, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
decode(reader: Reader): any {
|
|
|
|
return this.coder.decode(reader);
|
|
|
|
}
|
|
|
|
}
|