@@ -178,7 +178,7 @@ public static string MangleMethodClass(AmqpClass c, AmqpMethod m) {
178
178
public static Hashtable m_primitiveTypeFlagMap ;
179
179
static Apigen ( ) {
180
180
m_primitiveTypeMap = new Hashtable ( ) ;
181
- m_primitiveTypeFlagMap = new Hashtable ( ) ;
181
+ m_primitiveTypeFlagMap = new Hashtable ( ) ;
182
182
InitPrimitiveType ( "octet" , "byte" , false ) ;
183
183
InitPrimitiveType ( "shortstr" , "string" , true ) ;
184
184
InitPrimitiveType ( "longstr" , "byte[]" , true ) ;
@@ -191,11 +191,11 @@ static Apigen() {
191
191
InitPrimitiveType ( "content" , "byte[]" , true ) ;
192
192
}
193
193
194
- public static void InitPrimitiveType ( string amqpType , string dotnetType , bool isReference )
195
- {
196
- m_primitiveTypeMap [ amqpType ] = dotnetType ;
197
- m_primitiveTypeFlagMap [ amqpType ] = isReference ;
198
- }
194
+ public static void InitPrimitiveType ( string amqpType , string dotnetType , bool isReference )
195
+ {
196
+ m_primitiveTypeMap [ amqpType ] = dotnetType ;
197
+ m_primitiveTypeFlagMap [ amqpType ] = isReference ;
198
+ }
199
199
200
200
public void HandleOption ( string opt ) {
201
201
if ( opt . StartsWith ( "/n:" ) ) {
@@ -266,7 +266,7 @@ public string ImplNamespaceBase {
266
266
public void Generate ( ) {
267
267
LoadSpec ( ) ;
268
268
ParseSpec ( ) ;
269
- ReflectModel ( ) ;
269
+ ReflectModel ( ) ;
270
270
GenerateOutput ( ) ;
271
271
}
272
272
@@ -474,13 +474,13 @@ public bool HasFactoryMethod(AmqpClass c) {
474
474
return false ;
475
475
}
476
476
477
- public bool IsBoolean ( AmqpField f ) {
478
- return ResolveDomain ( f . Domain ) == "bit" ;
479
- }
477
+ public bool IsBoolean ( AmqpField f ) {
478
+ return ResolveDomain ( f . Domain ) == "bit" ;
479
+ }
480
480
481
- public bool IsReferenceType ( AmqpField f ) {
482
- return ( bool ) m_primitiveTypeFlagMap [ ResolveDomain ( f . Domain ) ] ;
483
- }
481
+ public bool IsReferenceType ( AmqpField f ) {
482
+ return ( bool ) m_primitiveTypeFlagMap [ ResolveDomain ( f . Domain ) ] ;
483
+ }
484
484
485
485
public bool IsAmqpClass ( Type t )
486
486
{
@@ -493,12 +493,12 @@ public bool IsAmqpClass(Type t)
493
493
}
494
494
495
495
public void EmitClassProperties ( AmqpClass c ) {
496
- bool hasCommonApi = HasFactoryMethod ( c ) ;
497
- string propertiesBaseClass =
498
- hasCommonApi
499
- ? "RabbitMQ.Client.Impl." + MangleClass ( c . Name ) + "Properties"
500
- : "RabbitMQ.Client.Impl.ContentHeaderBase" ;
501
- string maybeOverride = hasCommonApi ? "override " : "" ;
496
+ bool hasCommonApi = HasFactoryMethod ( c ) ;
497
+ string propertiesBaseClass =
498
+ hasCommonApi
499
+ ? "RabbitMQ.Client.Impl." + MangleClass ( c . Name ) + "Properties"
500
+ : "RabbitMQ.Client.Impl.ContentHeaderBase" ;
501
+ string maybeOverride = hasCommonApi ? "override " : "" ;
502
502
503
503
EmitAutogeneratedSummary ( " " ,
504
504
"AMQP specification content header properties for " +
@@ -512,9 +512,9 @@ public void EmitClassProperties(AmqpClass c) {
512
512
EmitLine ( "" ) ;
513
513
foreach ( AmqpField f in c . m_Fields )
514
514
{
515
- if ( ! IsBoolean ( f ) ) {
516
- EmitLine ( " private bool m_" + MangleMethod ( f . Name ) + "_present = false;" ) ;
517
- }
515
+ if ( ! IsBoolean ( f ) ) {
516
+ EmitLine ( " private bool m_" + MangleMethod ( f . Name ) + "_present = false;" ) ;
517
+ }
518
518
}
519
519
EmitLine ( "" ) ;
520
520
foreach ( AmqpField f in c . m_Fields )
@@ -525,19 +525,19 @@ public void EmitClassProperties(AmqpClass c) {
525
525
EmitLine ( " return m_" + MangleMethod ( f . Name ) + ";" ) ;
526
526
EmitLine ( " }" ) ;
527
527
EmitLine ( " set {" ) ;
528
- if ( ! IsBoolean ( f ) ) {
529
- EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = true;" ) ;
530
- }
528
+ if ( ! IsBoolean ( f ) ) {
529
+ EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = true;" ) ;
530
+ }
531
531
EmitLine ( " m_" + MangleMethod ( f . Name ) + " = value;" ) ;
532
532
EmitLine ( " }" ) ;
533
533
EmitLine ( " }" ) ;
534
534
}
535
535
EmitLine ( "" ) ;
536
536
foreach ( AmqpField f in c . m_Fields )
537
537
{
538
- if ( ! IsBoolean ( f ) ) {
539
- EmitLine ( " public " + maybeOverride + "void Clear" + MangleClass ( f . Name ) + "() { m_" + MangleMethod ( f . Name ) + "_present = false; }" ) ;
540
- }
538
+ if ( ! IsBoolean ( f ) ) {
539
+ EmitLine ( " public " + maybeOverride + "void Clear" + MangleClass ( f . Name ) + "() { m_" + MangleMethod ( f . Name ) + "_present = false; }" ) ;
540
+ }
541
541
}
542
542
543
543
EmitLine ( "" ) ;
@@ -555,36 +555,36 @@ public void EmitClassProperties(AmqpClass c) {
555
555
EmitLine ( " public override void ReadPropertiesFrom(RabbitMQ.Client.Impl.ContentHeaderPropertyReader reader) {" ) ;
556
556
foreach ( AmqpField f in c . m_Fields )
557
557
{
558
- if ( IsBoolean ( f ) ) {
559
- EmitLine ( " m_" + MangleMethod ( f . Name ) + " = reader.ReadBit();" ) ;
560
- } else {
561
- EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = reader.ReadPresence();" ) ;
562
- }
558
+ if ( IsBoolean ( f ) ) {
559
+ EmitLine ( " m_" + MangleMethod ( f . Name ) + " = reader.ReadBit();" ) ;
560
+ } else {
561
+ EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = reader.ReadPresence();" ) ;
562
+ }
563
563
}
564
- EmitLine ( " reader.FinishPresence();" ) ;
564
+ EmitLine ( " reader.FinishPresence();" ) ;
565
565
foreach ( AmqpField f in c . m_Fields )
566
566
{
567
- if ( ! IsBoolean ( f ) ) {
568
- EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { m_" + MangleMethod ( f . Name ) + " = reader.Read" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(); }" ) ;
569
- }
567
+ if ( ! IsBoolean ( f ) ) {
568
+ EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { m_" + MangleMethod ( f . Name ) + " = reader.Read" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(); }" ) ;
569
+ }
570
570
}
571
571
EmitLine ( " }" ) ;
572
572
EmitLine ( "" ) ;
573
573
EmitLine ( " public override void WritePropertiesTo(RabbitMQ.Client.Impl.ContentHeaderPropertyWriter writer) {" ) ;
574
574
foreach ( AmqpField f in c . m_Fields )
575
575
{
576
- if ( IsBoolean ( f ) ) {
577
- EmitLine ( " writer.WriteBit(m_" + MangleMethod ( f . Name ) + ");" ) ;
578
- } else {
579
- EmitLine ( " writer.WritePresence(m_" + MangleMethod ( f . Name ) + "_present);" ) ;
580
- }
576
+ if ( IsBoolean ( f ) ) {
577
+ EmitLine ( " writer.WriteBit(m_" + MangleMethod ( f . Name ) + ");" ) ;
578
+ } else {
579
+ EmitLine ( " writer.WritePresence(m_" + MangleMethod ( f . Name ) + "_present);" ) ;
580
+ }
581
581
}
582
- EmitLine ( " writer.FinishPresence();" ) ;
582
+ EmitLine ( " writer.FinishPresence();" ) ;
583
583
foreach ( AmqpField f in c . m_Fields )
584
584
{
585
- if ( ! IsBoolean ( f ) ) {
586
- EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { writer.Write" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(m_" + MangleMethod ( f . Name ) + "); }" ) ;
587
- }
585
+ if ( ! IsBoolean ( f ) ) {
586
+ EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { writer.Write" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(m_" + MangleMethod ( f . Name ) + "); }" ) ;
587
+ }
588
588
}
589
589
EmitLine ( " }" ) ;
590
590
EmitLine ( "" ) ;
@@ -595,16 +595,16 @@ public void EmitClassProperties(AmqpClass c) {
595
595
foreach ( AmqpField f in c . m_Fields )
596
596
{
597
597
Emit ( " sb.Append(\" " + f . Name + "=\" );" ) ;
598
- if ( IsBoolean ( f ) ) {
599
- Emit ( " sb.Append(m_" + MangleMethod ( f . Name ) + ");" ) ;
600
- } else {
601
- string x = MangleMethod ( f . Name ) ;
602
- if ( IsReferenceType ( f ) ) {
603
- Emit ( " sb.Append(m_" + x + "_present ? (m_" + x + " == null ? \" (null)\" : m_" + x + ".ToString()) : \" _\" );" ) ;
604
- } else {
605
- Emit ( " sb.Append(m_" + x + "_present ? m_" + x + ".ToString() : \" _\" );" ) ;
606
- }
607
- }
598
+ if ( IsBoolean ( f ) ) {
599
+ Emit ( " sb.Append(m_" + MangleMethod ( f . Name ) + ");" ) ;
600
+ } else {
601
+ string x = MangleMethod ( f . Name ) ;
602
+ if ( IsReferenceType ( f ) ) {
603
+ Emit ( " sb.Append(m_" + x + "_present ? (m_" + x + " == null ? \" (null)\" : m_" + x + ".ToString()) : \" _\" );" ) ;
604
+ } else {
605
+ Emit ( " sb.Append(m_" + x + "_present ? m_" + x + ".ToString() : \" _\" );" ) ;
606
+ }
607
+ }
608
608
remaining -- ;
609
609
if ( remaining > 0 ) {
610
610
EmitLine ( " sb.Append(\" , \" );" ) ;
@@ -822,24 +822,24 @@ public void EmitModelImplementation() {
822
822
EmitLine ( " }" ) ;
823
823
}
824
824
825
- public void EmitContentHeaderFactory ( MethodInfo method ) {
826
- AmqpContentHeaderFactoryAttribute factoryAnnotation = ( AmqpContentHeaderFactoryAttribute )
827
- Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) ;
828
- string contentClass = factoryAnnotation . m_contentClass ;
829
- EmitModelMethodPreamble ( method ) ;
830
- EmitLine ( " {" ) ;
831
- EmitLine ( " return new " + MangleClass ( contentClass ) + "Properties();" ) ;
832
- EmitLine ( " }" ) ;
833
- }
825
+ public void EmitContentHeaderFactory ( MethodInfo method ) {
826
+ AmqpContentHeaderFactoryAttribute factoryAnnotation = ( AmqpContentHeaderFactoryAttribute )
827
+ Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) ;
828
+ string contentClass = factoryAnnotation . m_contentClass ;
829
+ EmitModelMethodPreamble ( method ) ;
830
+ EmitLine ( " {" ) ;
831
+ EmitLine ( " return new " + MangleClass ( contentClass ) + "Properties();" ) ;
832
+ EmitLine ( " }" ) ;
833
+ }
834
834
835
835
public void MaybeEmitModelMethod ( MethodInfo method ) {
836
836
if ( method . IsSpecialName ) {
837
837
// It's some kind of event- or property-related method.
838
838
// It shouldn't be autogenerated.
839
839
} else if ( Attribute ( method , typeof ( AmqpMethodDoNotImplementAttribute ) ) != null ) {
840
840
// Skip this method, by request (AmqpMethodDoNotImplement)
841
- } else if ( Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) != null ) {
842
- EmitContentHeaderFactory ( method ) ;
841
+ } else if ( Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) != null ) {
842
+ EmitContentHeaderFactory ( method ) ;
843
843
} else if ( Attribute ( method , typeof ( AmqpUnsupportedAttribute ) ) != null ) {
844
844
EmitModelMethodPreamble ( method ) ;
845
845
EmitLine ( " {" ) ;
@@ -1102,7 +1102,7 @@ public void EmitAsynchronousHandlers(ArrayList asynchronousHandlers) {
1102
1102
EmitLine ( " case " + ( ( amqpClass . Index << 16 ) | amqpMethod . Index ) + ": {" ) ;
1103
1103
ParameterInfo [ ] parameters = method . GetParameters ( ) ;
1104
1104
if ( parameters . Length > 0 ) {
1105
- EmitLine ( " " + implClass + " __impl = (" + implClass + ") __method;" ) ;
1105
+ EmitLine ( " " + implClass + " __impl = (" + implClass + ") __method;" ) ;
1106
1106
EmitLine ( " " + method . Name + "(" ) ;
1107
1107
int remaining = parameters . Length ;
1108
1108
foreach ( ParameterInfo pi in parameters ) {
0 commit comments