/// <summary>
        /// Perform local processing of container class.
        /// </summary>
        protected override void BuildContainerClassLocal(ClassCodeBlocks itemCodeBlocks)
        {
            base.BuildContainerClassLocal(itemCodeBlocks);

            this.sectionCodeMethodName = $"SectionCode";
            FhirConstruct.Construct(itemCodeBlocks.ClassMethods, this.sectionCode, this.sectionCodeMethodName, out String dummy);
        }
Example #2
0
 public BuildMemberElement(DefineBase defineBase,
                           ClassCodeBlocks codeBlocks,
                           ElementTreeNode valueNode) :
     base(defineBase, codeBlocks)
 {
     this.valueNode = valueNode;
 }
Example #3
0
 public BuildMemberReferences(DefineBase defineBase,
                              ClassCodeBlocks codeBlocks,
                              ElementTreeNode memberNode) :
     base(defineBase, codeBlocks)
 {
     this.memberNode = memberNode;
     this.fhirName   = memberNode.ElementDefinition.Path.LastPathPart();
 }
 public BuildMemberComponents(DefineBase defineBase,
                              ClassCodeBlocks codeBlocks,
                              ElementTreeNode componentNode) :
     base(defineBase, codeBlocks)
 {
     this.memberNode = componentNode;
     this.fhirName   = this.memberNode.ElementDefinition.Path.LastPathPart();
 }
Example #5
0
 public BuildMemberExtensionSimple(DefineBase defineBase,
                                   ClassCodeBlocks codeBlocks,
                                   ElementTreeSlice extensionSlice,
                                   String extensionName) :
     base(defineBase, codeBlocks)
 {
     this.extensionSlice = extensionSlice;
     this.extensionName  = extensionName;
 }
 public BuildMemberExtension(DefineBase defineBase,
                             ClassCodeBlocks codeBlocks,
                             ElementTreeSlice extensionSlice,
                             String extensionName)
 {
     this.extensionName  = extensionName;
     this.defineBase     = defineBase;
     this.codeBlocks     = codeBlocks;
     this.extensionSlice = extensionSlice;
 }
Example #7
0
        /// <summary>
        /// Perform local processing of container class.
        /// </summary>
        protected override void BuildContainerClassLocal(ClassCodeBlocks codeBlocks)
        {
            base.BuildContainerClassLocal(codeBlocks);

            ElementTreeNode urlNode      = this.extensionSlice.Nodes["url"];
            String          extensionUrl = ((FhirUri)urlNode.ElementDefinition.Fixed).Value;

            codeBlocks.ClassProperties
            .AppendCode($"public const String ExtensionUrl = \"{extensionUrl}\";")
            ;
        }
        /// <summary>
        /// Perform local processing of container class.
        /// </summary>
        protected override void BuildContainerClassLocal(ClassCodeBlocks itemCodeBlocks)
        {
            base.BuildContainerClassLocal(itemCodeBlocks);

            this.componentCodeMethodName = $"{this.sliceName.ToMachineName()}_ComponentCode";
            FhirConstruct.Construct(itemCodeBlocks.ClassMethods,
                                    this.componentCode,
                                    this.componentCodeMethodName,
                                    out String dummy,
                                    "private static");
        }
Example #9
0
 /// <summary>
 /// Perform local processing of container class.
 /// </summary>
 protected override void BuildContainerClassLocal(ClassCodeBlocks itemCodeBlocks)
 {
     base.BuildContainerClassLocal(itemCodeBlocks);
 }
Example #10
0
        /// <summary>
        /// Perform local processing of container class.
        /// </summary>
        protected override void BuildContainerClassLocal(ClassCodeBlocks itemCodeBlocks)
        {
            base.BuildContainerClassLocal(itemCodeBlocks);

            this.BuildTargeturls(itemCodeBlocks.ClassProperties, this.targetProfiles);
        }
 public BuildMemberBase(DefineBase defineBase,
                        ClassCodeBlocks codeBlocks)
 {
     this.defineBase = defineBase;
     this.codeBlocks = codeBlocks;
 }
 /// <summary>
 /// Child classes can overload this to do local processing of container class.
 /// </summary>
 protected virtual void BuildContainerClassLocal(ClassCodeBlocks itemCodeBlocks)
 {
 }
 /// <summary>
 /// Child classes can overload this to do local processing of item class.
 /// </summary>
 protected virtual void BuildItemClassLocal(ClassCodeBlocks itemCodeBlocks)
 {
 }
        void BuildExtensionItemClass()
        {
            ClassCodeBlocks itemClassBlocks = new ClassCodeBlocks();

            this.itemCode
            .AppendCode($"#region {this.pathName} Member Class")
            .SummaryOpen()
            .Summary($"Extension class for {this.extensionName}.")
            .SummaryClose()
            .AppendCode($"public class {this.ElementGetName}")
            .OpenBrace()
            .AppendCode($"// Definitions")
            .DefineBlock(out itemClassBlocks.LocalClassDefs)
            .AppendCode($"// Properties")
            .DefineBlock(out itemClassBlocks.ClassProperties)
            .BlankLine()
            .SummaryOpen()
            .Summary($"Constructor")
            .SummaryClose()
            .AppendCode($"public {this.ElementGetName}()")
            .OpenBrace()
            .DefineBlock(out itemClassBlocks.ClassConstructor)
            .CloseBrace()

            .BlankLine()
            .AppendCode($"// Methods")
            .DefineBlock(out itemClassBlocks.ClassMethods)

            .BlankLine()
            .SummaryOpen()
            .Summary("Write item as a fhir element.")
            .SummaryClose()
            .AppendCode($"public Extension WriteMember(BreastRadiologyDocument doc)")
            .OpenBrace()
            .AppendCode($"List<Extension> extensionList = new List<Extension>();")
            .DefineBlock(out itemClassBlocks.ClassWriteCode)
            .AppendCode($"return new {this.FhirClassName}")
            .OpenBrace()
            .AppendCode($"Url = ExtensionUrl,")
            .AppendCode($"Extension = extensionList")
            .CloseBrace(";")
            .CloseBrace()

            .BlankLine()
            .SummaryOpen()
            .Summary("Read from fhir element into member item.")
            .SummaryClose()
            .AppendCode($"public void ReadMember(BreastRadiologyDocument doc, Extension extension)")
            .OpenBrace()
            .AppendCode($"if (extension.Url != ExtensionUrl)")
            .AppendCode($"    throw new Exception($\"Invalid extension url '{{extension.Url}}', expected '{{ExtensionUrl}}'\");")
            .AppendCode($"List<Extension> extensionList = extension.Extension;")
            .DefineBlock(out itemClassBlocks.ClassReadCode)
            .CloseBrace()

            .CloseBrace()
            .AppendCode($"#endregion")
            ;

            ElementTreeNode extension = this.extensionSlice.Nodes.GetItem("extension");

            foreach (var extensionSlice in extension.Slices.Skip(1))
            {
                itemClassBlocks.LocalUsings = this.codeBlocks.LocalUsings;
                BuildMemberExtension bm = new BuildMemberExtension(this.defineBase,
                                                                   itemClassBlocks,
                                                                   extensionSlice,
                                                                   extensionSlice.ElementDefinition.SliceName);
                bm.Build();
            }
        }