Swift: add QLdoc for generated Raw and Synth modules

This commit is contained in:
Paolo Tranquilli
2023-04-17 09:35:25 +02:00
parent 4e49df1615
commit edb355b47f
5 changed files with 4106 additions and 2 deletions

View File

@@ -1,5 +1,15 @@
/**
* INTERNAL: Do not use.
* This module holds thin fully generated class definitions around DB entities.
*/
module Raw {
{{#classes}}
/**
* INTERNAL: Do not use.
{{#doc}}
* {{.}}
{{/doc}}
*/
class {{name}} extends {{db_id}}{{#bases}}, {{.}}{{/bases}} {
{{#root}}string toString() { none() }{{/root}}
{{#final}}override string toString() { result = "{{name}}" }{{/final}}

View File

@@ -1,22 +1,42 @@
/**
* INTERNAL: Do not use.
* This module defines the IPA layer on top of raw DB entities, and the conversions between the two
* layers.
*/
private import {{import_prefix}}.SynthConstructors
private import {{import_prefix}}.Raw
cached module Synth {
/**
* INTERNAL: Do not use.
* The synthesized type of all elements.
*/
cached newtype T{{root}} =
{{#final_classes}}
{{^first}}
or
{{/first}}
/**
* INTERNAL: Do not use.
*/
T{{name}}({{#params}}{{^first}}, {{/first}}{{type}} {{param}}{{/params}}){{#has_params}} { construct{{name}}({{#params}}{{^first}}, {{/first}}{{param}}{{/params}}) }{{/has_params}}
{{/final_classes}}
{{#non_final_classes}}
{{^root}}
/**
* INTERNAL: Do not use.
*/
class T{{name}} = {{#derived}}{{^first}} or {{/first}}T{{name}}{{/derived}};
{{/root}}
{{/non_final_classes}}
{{#final_classes}}
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `T{{name}}`, if possible.
*/
cached T{{name}} convert{{name}}FromRaw(Raw::Element e) {
{{^is_fresh_ipa}}
result = T{{name}}(e)
@@ -28,6 +48,10 @@ cached module Synth {
{{/final_classes}}
{{#non_final_classes}}
/**
* INTERNAL: Do not use.
* Converts a raw DB element to a synthesized `T{{name}}`, if possible.
*/
cached T{{name}} convert{{name}}FromRaw(Raw::Element e) {
{{#derived}}
{{^first}}
@@ -39,6 +63,10 @@ cached module Synth {
{{/non_final_classes}}
{{#final_classes}}
/**
* INTERNAL: Do not use.
* Converts a synthesized `T{{name}}` to a raw DB element, if possible.
*/
cached Raw::Element convert{{name}}ToRaw(T{{name}} e) {
{{^is_fresh_ipa}}
e = T{{name}}(result)
@@ -50,6 +78,10 @@ cached module Synth {
{{/final_classes}}
{{#non_final_classes}}
/**
* INTERNAL: Do not use.
* Converts a synthesized `T{{name}}` to a raw DB element, if possible.
*/
cached Raw::Element convert{{name}}ToRaw(T{{name}} e) {
{{#derived}}
{{^first}}