Skip to content

Commit a9b29b4

Browse files
Merge pull request #1773 from arcaneframework/dev/gg-update-axl-generation
Minor improvements in AXL generation
2 parents 4bfbdf6 + 610adcd commit a9b29b4

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

Diff for: axlstar/Arcane.Axl.T4/Arcane.Axl/T4.StrongOptions/CaseOptionsT.cs

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
4-
// Runtime Version:6.0.28
4+
// Runtime Version:6.0.35
55
//
66
// Changes to this file may cause incorrect behavior and will be lost if
77
// the code is regenerated.
@@ -23,8 +23,11 @@ public virtual string TransformText() {
2323
Action<OptionHandler, String, String> getterSection = (OptionHandler _xml, String beginLineSpace, String redirectionPrefix) => {
2424
foreach(var simple in _xml.Simple) {
2525
string return_type = simple.type.QualifiedName();
26-
if (simple.IsSingle == false) {
26+
string call_type = "()";
27+
// Use view() for array type because 'operator()' is deprecated for these types.
28+
if (!simple.IsSingle) {
2729
return_type = return_type.ToArrayType();
30+
call_type = ".view()";
2831
}
2932
this.Write(this.ToStringHelper.ToStringWithCulture(beginLineSpace));
3033
this.Write(this.ToStringHelper.ToStringWithCulture( return_type ));
@@ -37,13 +40,14 @@ public virtual string TransformText() {
3740
this.Write(" return ");
3841
this.Write(this.ToStringHelper.ToStringWithCulture( redirectionPrefix ));
3942
this.Write(this.ToStringHelper.ToStringWithCulture( simple.Name.ToFuncName() ));
40-
this.Write("() ;\n");
43+
this.Write(this.ToStringHelper.ToStringWithCulture( call_type ));
44+
this.Write(";\n");
4145
this.Write(this.ToStringHelper.ToStringWithCulture(beginLineSpace));
4246
this.Write("}\n");
4347
}
4448
foreach(var enumerator in _xml.Enumeration) {
4549
string return_type = enumerator.type;
46-
if (enumerator.IsSingle == true) {
50+
if (enumerator.IsSingle) {
4751
this.Write(this.ToStringHelper.ToStringWithCulture(beginLineSpace));
4852
this.Write(this.ToStringHelper.ToStringWithCulture( return_type ));
4953
this.Write(" ");
@@ -64,7 +68,7 @@ public virtual string TransformText() {
6468
this.Write(this.ToStringHelper.ToStringWithCulture( return_type.ToArrayType() ));
6569
this.Write(" ");
6670
this.Write(this.ToStringHelper.ToStringWithCulture( enumerator.Name.ToFuncName() ));
67-
this.Write("() const\n");
71+
this.Write(" const\n");
6872
this.Write(this.ToStringHelper.ToStringWithCulture(beginLineSpace));
6973
this.Write("{\n");
7074
this.Write(this.ToStringHelper.ToStringWithCulture(beginLineSpace));
@@ -225,10 +229,11 @@ public virtual string TransformText() {
225229
this.Write(" = false;\n\t}\n");
226230
}
227231
};
228-
this.Write("/*---------------------------------------------------------------------------*/\n/" +
229-
"*---------------------------------------------------------------------------*/\n/" +
230-
"/ #WARNING#: This file has been generated automatically. Do not edit.\n// Arcane " +
231-
"version ");
232+
this.Write(@"/*---------------------------------------------------------------------------*/
233+
/*---------------------------------------------------------------------------*/
234+
// #WARNING#: This file has been generated automatically. Do not edit.
235+
// Generated from 'CaseOptionsT.tt' (version 2024.11.17)
236+
// Arcane version ");
232237
this.Write(this.ToStringHelper.ToStringWithCulture( Version ));
233238
this.Write(" : ");
234239
this.Write(this.ToStringHelper.ToStringWithCulture( DateTime.Now ));

Diff for: axlstar/Arcane.Axl.T4/Arcane.Axl/T4.StrongOptions/CaseOptionsT.tt

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,27 @@
77
<# Action<OptionHandler, String, String> getterSection = (OptionHandler _xml, String beginLineSpace, String redirectionPrefix) => { #>
88
<# foreach(var simple in _xml.Simple) {
99
string return_type = simple.type.QualifiedName();
10-
if (simple.IsSingle == false) {
10+
string call_type = "()";
11+
// Use view() for array type because 'operator()' is deprecated for these types.
12+
if (!simple.IsSingle) {
1113
return_type = return_type.ToArrayType();
14+
call_type = ".view()";
1215
}#>
1316
<#=beginLineSpace#><#= return_type #> <#= simple.Name.ToFuncName() #>() const
1417
<#=beginLineSpace#>{
15-
<#=beginLineSpace#> return <#= redirectionPrefix #><#= simple.Name.ToFuncName() #>() ;
18+
<#=beginLineSpace#> return <#= redirectionPrefix #><#= simple.Name.ToFuncName() #><#= call_type #>;
1619
<#=beginLineSpace#>}
1720
<# } #>
1821
<# foreach(var enumerator in _xml.Enumeration) {
1922
string return_type = enumerator.type;
20-
if (enumerator.IsSingle == true) { #>
23+
if (enumerator.IsSingle) { #>
2124
<#=beginLineSpace#><#= return_type #> <#= enumerator.Name.ToFuncName() #>() const
2225
<#=beginLineSpace#>{
2326
<#=beginLineSpace#> return <#= redirectionPrefix #><#= enumerator.Name.ToFuncName() #>();
2427
<#=beginLineSpace#>}
2528
<# }
2629
else{ #>
27-
<#=beginLineSpace#><#= return_type.ToArrayType() #> <#= enumerator.Name.ToFuncName() #>() const
30+
<#=beginLineSpace#><#= return_type.ToArrayType() #> <#= enumerator.Name.ToFuncName() #> const
2831
<#=beginLineSpace#>{
2932
<#=beginLineSpace#> return <#= redirectionPrefix #><#= enumerator.Name.ToFuncName() #>;
3033
<#=beginLineSpace#>}
@@ -88,6 +91,7 @@
8891
/*---------------------------------------------------------------------------*/
8992
/*---------------------------------------------------------------------------*/
9093
// #WARNING#: This file has been generated automatically. Do not edit.
94+
// Generated from 'CaseOptionsT.tt' (version 2024.11.17)
9195
// Arcane version <#= Version #> : <#= DateTime.Now #>
9296
/*---------------------------------------------------------------------------*/
9397
/*---------------------------------------------------------------------------*/

Diff for: axlstar/Arcane.Axl.T4/Arcane.Axl/T4.StrongOptions/StrongOptions_h.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
4-
// Runtime Version:6.0.28
4+
// Runtime Version:6.0.32
55
//
66
// Changes to this file may cause incorrect behavior and will be lost if
77
// the code is regenerated.
@@ -178,7 +178,7 @@ public virtual string TransformText() {
178178
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.ToFuncName() ));
179179
this.Write("_, Args...>(m_");
180180
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.DashToUnderscore() ));
181-
this.Write(", std::move(args)...);\n");
181+
this.Write(", std::forward<Args>(args)...);\n");
182182
}
183183
else {
184184
if(problemStdArray) {
@@ -188,7 +188,8 @@ public virtual string TransformText() {
188188
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.ToFuncName() ));
189189
this.Write("_, Args...>(m_");
190190
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.DashToUnderscore() ));
191-
this.Write(", std::move(args)...);\n // todo replace by static assert\t\n if(!exist_");
191+
this.Write(", std::forward<Args>(args)...);\n // todo replace by static assert\t\n if(!exi" +
192+
"st_");
192193
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.DashToUnderscore() ));
193194
this.Write(")\n throw ");
194195
this.Write(this.ToStringHelper.ToStringWithCulture(SimpleTypeExtensions.Namespace()));
@@ -201,7 +202,7 @@ public virtual string TransformText() {
201202
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.DashToUnderscore() ));
202203
this.Write(" = OptionTools::requiredFixedArray<");
203204
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.ToFuncName() ));
204-
this.Write("_, 1, Args...>(std::move(args)...)[0];\n");
205+
this.Write("_, 1, Args...>(std::forward<Args>(args)...)[0];\n");
205206
}
206207
}
207208
}
@@ -215,7 +216,7 @@ public virtual string TransformText() {
215216
this.Write(this.ToStringHelper.ToStringWithCulture( _option.Name.ToFuncName() ));
216217
this.Write("_, ");
217218
this.Write(this.ToStringHelper.ToStringWithCulture( _option.MinOccurs ));
218-
this.Write(", -1, Args...>(std::move(args)...);\n");
219+
this.Write(", -1, Args...>(std::forward<Args>(args)...);\n");
219220
}
220221
this.Write("\n");
221222
};

Diff for: axlstar/Arcane.Axl.T4/Arcane.Axl/T4.StrongOptions/StrongOptions_h.tt

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,25 @@
4949
<# if (_option.IsSingle == true) { #>
5050
<# if (hasDefault) { #>
5151
m_<#= _option.Name.DashToUnderscore() #> = <#= _option_default #>;
52-
OptionTools::optionalSimple<<#= _option.Name.ToFuncName() #>_, Args...>(m_<#= _option.Name.DashToUnderscore() #>, std::move(args)...);
52+
OptionTools::optionalSimple<<#= _option.Name.ToFuncName() #>_, Args...>(m_<#= _option.Name.DashToUnderscore() #>, std::forward<Args>(args)...);
5353
<# }
5454
else {
5555
if(problemStdArray) { #>
56-
static bool exist_<#= _option.Name.DashToUnderscore() #> = OptionTools::optionalSimple<<#= _option.Name.ToFuncName() #>_, Args...>(m_<#= _option.Name.DashToUnderscore() #>, std::move(args)...);
56+
static bool exist_<#= _option.Name.DashToUnderscore() #> = OptionTools::optionalSimple<<#= _option.Name.ToFuncName() #>_, Args...>(m_<#= _option.Name.DashToUnderscore() #>, std::forward<Args>(args)...);
5757
// todo replace by static assert
5858
if(!exist_<#= _option.Name.DashToUnderscore() #>)
5959
throw <#=SimpleTypeExtensions.Namespace()#>::FatalErrorException(A_FUNCINFO, "missing required option <#= _option.Name.ToFuncName() #>");
6060
<# }
6161
else { #>
62-
m_<#= _option.Name.DashToUnderscore() #> = OptionTools::requiredFixedArray<<#= _option.Name.ToFuncName() #>_, 1, Args...>(std::move(args)...)[0];
62+
m_<#= _option.Name.DashToUnderscore() #> = OptionTools::requiredFixedArray<<#= _option.Name.ToFuncName() #>_, 1, Args...>(std::forward<Args>(args)...)[0];
6363
<# }
6464
}
6565
} #>
6666
<# else { #>
6767
<# if (hasDefault) { #>
6868
//#warning "Default for multi options not used"
6969
<# } #>
70-
m_<#= _option.Name.DashToUnderscore() #> = OptionTools::requiredVariableArray<<#= _option.Name.ToFuncName() #>_, <#= _option.MinOccurs #>, -1, Args...>(std::move(args)...);
70+
m_<#= _option.Name.DashToUnderscore() #> = OptionTools::requiredVariableArray<<#= _option.Name.ToFuncName() #>_, <#= _option.MinOccurs #>, -1, Args...>(std::forward<Args>(args)...);
7171
<# } #>
7272

7373
<# }; #>

0 commit comments

Comments
 (0)