From 0627b83071578a4cbbf6d5630be0c3a115e29dc5 Mon Sep 17 00:00:00 2001 From: Gilles Grospellier Date: Tue, 9 Nov 2021 12:44:13 +0100 Subject: [PATCH] =?UTF-8?q?[axlstar]=20Converti=20explicitement=20le=20typ?= =?UTF-8?q?e=20de=20retour=20des=20'CaseOptionMultiSimpleT'=20via=20la=20m?= =?UTF-8?q?=C3=A9thode=20'value()'.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Utilise aussi le mot clé 'auto' pour laisser le compilateur détecter le type de retour. Cela permet de faire évoluer Arcane sans avoir à modifier le générateur des 'axl' si on change le type de retour de la méthode 'CaseOptionMultiSimpleT::values()'. --- .../Arcane.Axl/T4.CaseOptions/CaseOptionsT4.cs | 16 ++++------------ .../Arcane.Axl/T4.CaseOptions/CaseOptionsT4.tt | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.cs b/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.cs index c97c96bfbe..1d6ace546d 100644 --- a/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.cs +++ b/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:3.0.0 +// Runtime Version:3.1.8 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -29,13 +29,7 @@ void GenerateInterfaces(OptionHandler opt) { foreach(var e in opt.Simple.Where(p => p.IsMulti)) { - this.Write(" Arcane::ConstArrayView< "); - - - this.Write(this.ToStringHelper.ToStringWithCulture( e.type.QualifiedName () )); - - - this.Write(" > get"); + this.Write(" auto get"); this.Write(this.ToStringHelper.ToStringWithCulture( e.Name.ToClassName () )); @@ -47,7 +41,7 @@ void GenerateInterfaces(OptionHandler opt) { this.Write(this.ToStringHelper.ToStringWithCulture( e.Name.ToFuncName () )); - this.Write("; }\n "); + this.Write(".values(); }\n "); } foreach(var e in opt.Simple.Where(p => p.IsSingle)) { @@ -1213,9 +1207,7 @@ void multiAllocate(const Arcane::XmlNodeList& elist) this.Write(" {\n"); GenerateTranslationCalls(Xml); GenerateTranslationAndDefaultValues(Base,String.Empty); - this.Write(" }\n\n virtual ~CaseOptions"); - this.Write(this.ToStringHelper.ToStringWithCulture( Xml.ClassName )); - this.Write("()\n {\n }\n\npublic:\n // Interfaces for main CaseOptions\n "); + this.Write(" }\n\npublic:\n // Interfaces for main CaseOptions\n "); GenerateInterfaces(Xml); this.Write(@" public: diff --git a/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.tt b/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.tt index 667390faf3..f46e3da2f5 100755 --- a/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.tt +++ b/axlstar/Arcane.Axl.T4/Arcane.Axl/T4.CaseOptions/CaseOptionsT4.tt @@ -342,7 +342,7 @@ ARCANE_END_NAMESPACE #> <#+ foreach(var e in opt.Simple.Where(p => p.IsMulti)) { #> - Arcane::ConstArrayView< <#= e.type.QualifiedName () #> > get<#= e.Name.ToClassName () #>() { return <#= e.Name.ToFuncName () #>; } + auto get<#= e.Name.ToClassName () #>() { return <#= e.Name.ToFuncName () #>.values(); } <#+ } foreach(var e in opt.Simple.Where(p => p.IsSingle)) { #> <#= e.type.QualifiedReturnName (true) #> get<#= e.Name.ToClassName () #>() { return <#= e.Name.ToFuncName () #>(); }