mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 17:49:09 +00:00
feat(ts-protoc-gen): initial commit, broken
This commit is contained in:
parent
9823670084
commit
291ec9576f
20 changed files with 1887 additions and 0 deletions
26
src/ts-protoc-gen/CodePrinter.ts
Normal file
26
src/ts-protoc-gen/CodePrinter.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import {Printer} from "./Printer";
|
||||
import {generateIndent} from "./util";
|
||||
|
||||
export class CodePrinter {
|
||||
private indentation: string;
|
||||
constructor(private depth: number, private printer: Printer) {
|
||||
this.indentation = generateIndent(1);
|
||||
}
|
||||
indent() {
|
||||
this.depth++;
|
||||
return this;
|
||||
}
|
||||
dedent() {
|
||||
this.depth--;
|
||||
return this;
|
||||
}
|
||||
printLn(line: string) {
|
||||
this.printer.printLn(new Array(this.depth + 1).join(this.indentation) + line);
|
||||
return this;
|
||||
}
|
||||
|
||||
printEmptyLn() {
|
||||
this.printer.printEmptyLn();
|
||||
return this;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue