summaryrefslogtreecommitdiffstats
path: root/src/Lang/Cpp/CppDocGen.ts
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2018-03-02 22:21:22 +0100
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2018-03-02 23:27:10 +0100
commit16452c8e0c644fa979270e99906eb9c34a13ca5f (patch)
tree25173bf8f8b79167193ce36094bf80399b1ea724 /src/Lang/Cpp/CppDocGen.ts
parentb837545df65a31ba5dac154644c359c2a55d1531 (diff)
downloaddoxdocgen-16452c8e0c644fa979270e99906eb9c34a13ca5f.tar.gz
Make order of comment tags customizable
Fix #55
Diffstat (limited to 'src/Lang/Cpp/CppDocGen.ts')
-rw-r--r--src/Lang/Cpp/CppDocGen.ts74
1 files changed, 45 insertions, 29 deletions
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts
index 1a03430..56ce922 100644
--- a/src/Lang/Cpp/CppDocGen.ts
+++ b/src/Lang/Cpp/CppDocGen.ts
@@ -247,9 +247,6 @@ export class CppDocGen implements IDocGen {
protected insertBrief(lines: string[]) {
if (this.cfg.Generic.briefTemplate.trim().length !== 0) {
this.generateBrief(lines);
- if (this.cfg.Generic.newLineAfterBrief === true) {
- lines.push(this.cfg.C.commentPrefix);
- }
}
}
@@ -270,6 +267,10 @@ export class CppDocGen implements IDocGen {
this.insertBrief(lines);
break;
}
+ case "empty": {
+ lines.push(this.cfg.C.commentPrefix);
+ break;
+ }
case "file": {
this.generateFilenameFromTemplate(lines);
break;
@@ -298,33 +299,48 @@ export class CppDocGen implements IDocGen {
this.insertFirstLine(lines);
- this.insertBrief(lines);
-
- if (this.cfg.Cpp.tparamTemplate.trim().length !== 0 && this.templateParams.length > 0) {
- this.generateFromTemplate(
- lines,
- this.cfg.paramTemplateReplace,
- this.cfg.Cpp.tparamTemplate,
- this.templateParams,
- );
- if (this.cfg.Cpp.newLineAfterTParams === true) {
- lines.push(this.cfg.C.commentPrefix);
- }
- }
-
- if (this.cfg.Generic.paramTemplate.trim().length !== 0 && this.params.length > 0) {
- const paramNames: string[] = this.params.map((p) => p.name);
- this.generateFromTemplate(lines, this.cfg.paramTemplateReplace, this.cfg.Generic.paramTemplate, paramNames);
- if (this.cfg.Generic.newLineAfterParams === true) {
- lines.push(this.cfg.C.commentPrefix);
+ this.cfg.Generic.order.forEach((element) => {
+ switch (element) {
+ case "brief": {
+ this.insertBrief(lines);
+ break;
+ }
+ case "empty": {
+ lines.push(this.cfg.C.commentPrefix);
+ break;
+ }
+ case "tparam": {
+ if (this.cfg.Cpp.tparamTemplate.trim().length !== 0 && this.templateParams.length > 0) {
+ this.generateFromTemplate(
+ lines,
+ this.cfg.paramTemplateReplace,
+ this.cfg.Cpp.tparamTemplate,
+ this.templateParams,
+ );
+ }
+ break;
+ }
+ case "param": {
+ if (this.cfg.Generic.paramTemplate.trim().length !== 0 && this.params.length > 0) {
+ const paramNames: string[] = this.params.map((p) => p.name);
+ // tslint:disable-next-line:max-line-length
+ this.generateFromTemplate(lines, this.cfg.paramTemplateReplace, this.cfg.Generic.paramTemplate, paramNames);
+ }
+ break;
+ }
+ case "return": {
+ if (this.cfg.Generic.returnTemplate.trim().length !== 0 && this.func.type !== null) {
+ const returnParams = this.generateReturnParams();
+ // tslint:disable-next-line:max-line-length
+ this.generateFromTemplate(lines, this.cfg.typeTemplateReplace, this.cfg.Generic.returnTemplate, returnParams);
+ }
+ break;
+ }
+ default: {
+ break;
+ }
}
- }
-
- if (this.cfg.Generic.returnTemplate.trim().length !== 0 && this.func.type !== null) {
- const returnParams = this.generateReturnParams();
- // tslint:disable-next-line:max-line-length
- this.generateFromTemplate(lines, this.cfg.typeTemplateReplace, this.cfg.Generic.returnTemplate, returnParams);
- }
+ });
this.insertLastLine(lines);