@@ -196,7 +196,7 @@ public static string MangleMethodClass(AmqpClass c, AmqpMethod m) {
196
196
public static Hashtable m_primitiveTypeFlagMap ;
197
197
static Apigen ( ) {
198
198
m_primitiveTypeMap = new Hashtable ( ) ;
199
- m_primitiveTypeFlagMap = new Hashtable ( ) ;
199
+ m_primitiveTypeFlagMap = new Hashtable ( ) ;
200
200
InitPrimitiveType ( "octet" , "byte" , false ) ;
201
201
InitPrimitiveType ( "shortstr" , "string" , true ) ;
202
202
InitPrimitiveType ( "longstr" , "byte[]" , true ) ;
@@ -209,11 +209,11 @@ static Apigen() {
209
209
InitPrimitiveType ( "content" , "byte[]" , true ) ;
210
210
}
211
211
212
- public static void InitPrimitiveType ( string amqpType , string dotnetType , bool isReference )
213
- {
214
- m_primitiveTypeMap [ amqpType ] = dotnetType ;
215
- m_primitiveTypeFlagMap [ amqpType ] = isReference ;
216
- }
212
+ public static void InitPrimitiveType ( string amqpType , string dotnetType , bool isReference )
213
+ {
214
+ m_primitiveTypeMap [ amqpType ] = dotnetType ;
215
+ m_primitiveTypeFlagMap [ amqpType ] = isReference ;
216
+ }
217
217
218
218
public void HandleOption ( string opt ) {
219
219
if ( opt . StartsWith ( "/n:" ) ) {
@@ -284,7 +284,7 @@ public string ImplNamespaceBase {
284
284
public void Generate ( ) {
285
285
LoadSpec ( ) ;
286
286
ParseSpec ( ) ;
287
- ReflectModel ( ) ;
287
+ ReflectModel ( ) ;
288
288
GenerateOutput ( ) ;
289
289
}
290
290
@@ -360,7 +360,7 @@ public void Emit(object o) {
360
360
public void EmitLine ( object o ) {
361
361
m_outputFile . WriteLine ( o ) ;
362
362
}
363
-
363
+
364
364
public void EmitSpecComment ( object o ) {
365
365
if ( m_emitComments )
366
366
EmitLine ( o ) ;
@@ -498,13 +498,13 @@ public bool HasFactoryMethod(AmqpClass c) {
498
498
return false ;
499
499
}
500
500
501
- public bool IsBoolean ( AmqpField f ) {
502
- return ResolveDomain ( f . Domain ) == "bit" ;
503
- }
501
+ public bool IsBoolean ( AmqpField f ) {
502
+ return ResolveDomain ( f . Domain ) == "bit" ;
503
+ }
504
504
505
- public bool IsReferenceType ( AmqpField f ) {
506
- return ( bool ) m_primitiveTypeFlagMap [ ResolveDomain ( f . Domain ) ] ;
507
- }
505
+ public bool IsReferenceType ( AmqpField f ) {
506
+ return ( bool ) m_primitiveTypeFlagMap [ ResolveDomain ( f . Domain ) ] ;
507
+ }
508
508
509
509
public bool IsAmqpClass ( Type t )
510
510
{
@@ -517,12 +517,12 @@ public bool IsAmqpClass(Type t)
517
517
}
518
518
519
519
public void EmitClassProperties ( AmqpClass c ) {
520
- bool hasCommonApi = HasFactoryMethod ( c ) ;
521
- string propertiesBaseClass =
522
- hasCommonApi
523
- ? "RabbitMQ.Client.Impl." + MangleClass ( c . Name ) + "Properties"
524
- : "RabbitMQ.Client.Impl.ContentHeaderBase" ;
525
- string maybeOverride = hasCommonApi ? "override " : "" ;
520
+ bool hasCommonApi = HasFactoryMethod ( c ) ;
521
+ string propertiesBaseClass =
522
+ hasCommonApi
523
+ ? "RabbitMQ.Client.Impl." + MangleClass ( c . Name ) + "Properties"
524
+ : "RabbitMQ.Client.Impl.ContentHeaderBase" ;
525
+ string maybeOverride = hasCommonApi ? "override " : "" ;
526
526
527
527
EmitAutogeneratedSummary ( " " ,
528
528
"AMQP specification content header properties for " +
@@ -536,9 +536,9 @@ public void EmitClassProperties(AmqpClass c) {
536
536
EmitLine ( "" ) ;
537
537
foreach ( AmqpField f in c . m_Fields )
538
538
{
539
- if ( ! IsBoolean ( f ) ) {
540
- EmitLine ( " private bool m_" + MangleMethod ( f . Name ) + "_present = false;" ) ;
541
- }
539
+ if ( ! IsBoolean ( f ) ) {
540
+ EmitLine ( " private bool m_" + MangleMethod ( f . Name ) + "_present = false;" ) ;
541
+ }
542
542
}
543
543
EmitLine ( "" ) ;
544
544
foreach ( AmqpField f in c . m_Fields )
@@ -549,19 +549,19 @@ public void EmitClassProperties(AmqpClass c) {
549
549
EmitLine ( " return m_" + MangleMethod ( f . Name ) + ";" ) ;
550
550
EmitLine ( " }" ) ;
551
551
EmitLine ( " set {" ) ;
552
- if ( ! IsBoolean ( f ) ) {
553
- EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = true;" ) ;
554
- }
552
+ if ( ! IsBoolean ( f ) ) {
553
+ EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = true;" ) ;
554
+ }
555
555
EmitLine ( " m_" + MangleMethod ( f . Name ) + " = value;" ) ;
556
556
EmitLine ( " }" ) ;
557
557
EmitLine ( " }" ) ;
558
558
}
559
559
EmitLine ( "" ) ;
560
560
foreach ( AmqpField f in c . m_Fields )
561
561
{
562
- if ( ! IsBoolean ( f ) ) {
563
- EmitLine ( " public " + maybeOverride + "void Clear" + MangleClass ( f . Name ) + "() { m_" + MangleMethod ( f . Name ) + "_present = false; }" ) ;
564
- }
562
+ if ( ! IsBoolean ( f ) ) {
563
+ EmitLine ( " public " + maybeOverride + "void Clear" + MangleClass ( f . Name ) + "() { m_" + MangleMethod ( f . Name ) + "_present = false; }" ) ;
564
+ }
565
565
}
566
566
567
567
EmitLine ( "" ) ;
@@ -579,36 +579,36 @@ public void EmitClassProperties(AmqpClass c) {
579
579
EmitLine ( " public override void ReadPropertiesFrom(RabbitMQ.Client.Impl.ContentHeaderPropertyReader reader) {" ) ;
580
580
foreach ( AmqpField f in c . m_Fields )
581
581
{
582
- if ( IsBoolean ( f ) ) {
583
- EmitLine ( " m_" + MangleMethod ( f . Name ) + " = reader.ReadBit();" ) ;
584
- } else {
585
- EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = reader.ReadPresence();" ) ;
586
- }
582
+ if ( IsBoolean ( f ) ) {
583
+ EmitLine ( " m_" + MangleMethod ( f . Name ) + " = reader.ReadBit();" ) ;
584
+ } else {
585
+ EmitLine ( " m_" + MangleMethod ( f . Name ) + "_present = reader.ReadPresence();" ) ;
586
+ }
587
587
}
588
- EmitLine ( " reader.FinishPresence();" ) ;
588
+ EmitLine ( " reader.FinishPresence();" ) ;
589
589
foreach ( AmqpField f in c . m_Fields )
590
590
{
591
- if ( ! IsBoolean ( f ) ) {
592
- EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { m_" + MangleMethod ( f . Name ) + " = reader.Read" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(); }" ) ;
593
- }
591
+ if ( ! IsBoolean ( f ) ) {
592
+ EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { m_" + MangleMethod ( f . Name ) + " = reader.Read" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(); }" ) ;
593
+ }
594
594
}
595
595
EmitLine ( " }" ) ;
596
596
EmitLine ( "" ) ;
597
597
EmitLine ( " public override void WritePropertiesTo(RabbitMQ.Client.Impl.ContentHeaderPropertyWriter writer) {" ) ;
598
598
foreach ( AmqpField f in c . m_Fields )
599
599
{
600
- if ( IsBoolean ( f ) ) {
601
- EmitLine ( " writer.WriteBit(m_" + MangleMethod ( f . Name ) + ");" ) ;
602
- } else {
603
- EmitLine ( " writer.WritePresence(m_" + MangleMethod ( f . Name ) + "_present);" ) ;
604
- }
600
+ if ( IsBoolean ( f ) ) {
601
+ EmitLine ( " writer.WriteBit(m_" + MangleMethod ( f . Name ) + ");" ) ;
602
+ } else {
603
+ EmitLine ( " writer.WritePresence(m_" + MangleMethod ( f . Name ) + "_present);" ) ;
604
+ }
605
605
}
606
- EmitLine ( " writer.FinishPresence();" ) ;
606
+ EmitLine ( " writer.FinishPresence();" ) ;
607
607
foreach ( AmqpField f in c . m_Fields )
608
608
{
609
- if ( ! IsBoolean ( f ) ) {
610
- EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { writer.Write" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(m_" + MangleMethod ( f . Name ) + "); }" ) ;
611
- }
609
+ if ( ! IsBoolean ( f ) ) {
610
+ EmitLine ( " if (m_" + MangleMethod ( f . Name ) + "_present) { writer.Write" + MangleClass ( ResolveDomain ( f . Domain ) ) + "(m_" + MangleMethod ( f . Name ) + "); }" ) ;
611
+ }
612
612
}
613
613
EmitLine ( " }" ) ;
614
614
EmitLine ( "" ) ;
@@ -619,16 +619,16 @@ public void EmitClassProperties(AmqpClass c) {
619
619
foreach ( AmqpField f in c . m_Fields )
620
620
{
621
621
Emit ( " sb.Append(\" " + f . Name + "=\" );" ) ;
622
- if ( IsBoolean ( f ) ) {
623
- Emit ( " sb.Append(m_" + MangleMethod ( f . Name ) + ");" ) ;
624
- } else {
625
- string x = MangleMethod ( f . Name ) ;
626
- if ( IsReferenceType ( f ) ) {
627
- Emit ( " sb.Append(m_" + x + "_present ? (m_" + x + " == null ? \" (null)\" : m_" + x + ".ToString()) : \" _\" );" ) ;
628
- } else {
629
- Emit ( " sb.Append(m_" + x + "_present ? m_" + x + ".ToString() : \" _\" );" ) ;
630
- }
631
- }
622
+ if ( IsBoolean ( f ) ) {
623
+ Emit ( " sb.Append(m_" + MangleMethod ( f . Name ) + ");" ) ;
624
+ } else {
625
+ string x = MangleMethod ( f . Name ) ;
626
+ if ( IsReferenceType ( f ) ) {
627
+ Emit ( " sb.Append(m_" + x + "_present ? (m_" + x + " == null ? \" (null)\" : m_" + x + ".ToString()) : \" _\" );" ) ;
628
+ } else {
629
+ Emit ( " sb.Append(m_" + x + "_present ? m_" + x + ".ToString() : \" _\" );" ) ;
630
+ }
631
+ }
632
632
remaining -- ;
633
633
if ( remaining > 0 ) {
634
634
EmitLine ( " sb.Append(\" , \" );" ) ;
@@ -849,12 +849,12 @@ public void EmitModelImplementation() {
849
849
EmitLine ( " }" ) ;
850
850
}
851
851
852
- public void EmitContentHeaderFactory ( MethodInfo method ) {
853
- AmqpContentHeaderFactoryAttribute factoryAnnotation = ( AmqpContentHeaderFactoryAttribute )
854
- Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) ;
855
- string contentClass = factoryAnnotation . m_contentClass ;
856
- EmitModelMethodPreamble ( method ) ;
857
- EmitLine ( " {" ) ;
852
+ public void EmitContentHeaderFactory ( MethodInfo method ) {
853
+ AmqpContentHeaderFactoryAttribute factoryAnnotation = ( AmqpContentHeaderFactoryAttribute )
854
+ Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) ;
855
+ string contentClass = factoryAnnotation . m_contentClass ;
856
+ EmitModelMethodPreamble ( method ) ;
857
+ EmitLine ( " {" ) ;
858
858
if ( Attribute ( method , typeof ( AmqpUnsupportedAttribute ) ) != null )
859
859
{
860
860
EmitLine ( String . Format ( " throw new UnsupportedMethodException(\" " + method . Name + "\" );" ) ) ;
@@ -863,17 +863,17 @@ public void EmitContentHeaderFactory(MethodInfo method) {
863
863
{
864
864
EmitLine ( " return new " + MangleClass ( contentClass ) + "Properties();" ) ;
865
865
}
866
- EmitLine ( " }" ) ;
867
- }
866
+ EmitLine ( " }" ) ;
867
+ }
868
868
869
869
public void MaybeEmitModelMethod ( MethodInfo method ) {
870
870
if ( method . IsSpecialName ) {
871
871
// It's some kind of event- or property-related method.
872
872
// It shouldn't be autogenerated.
873
873
} else if ( Attribute ( method , typeof ( AmqpMethodDoNotImplementAttribute ) ) != null ) {
874
874
// Skip this method, by request (AmqpMethodDoNotImplement)
875
- } else if ( Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) != null ) {
876
- EmitContentHeaderFactory ( method ) ;
875
+ } else if ( Attribute ( method , typeof ( AmqpContentHeaderFactoryAttribute ) ) != null ) {
876
+ EmitContentHeaderFactory ( method ) ;
877
877
} else if ( Attribute ( method , typeof ( AmqpUnsupportedAttribute ) ) != null ) {
878
878
EmitModelMethodPreamble ( method ) ;
879
879
EmitLine ( " {" ) ;
@@ -919,7 +919,7 @@ public void LookupAmqpMethod(MethodInfo method,
919
919
{
920
920
amqpClass = null ;
921
921
amqpMethod = null ;
922
-
922
+
923
923
// First, try autodetecting the class/method via the
924
924
// IModel method name.
925
925
@@ -1136,7 +1136,7 @@ public void EmitAsynchronousHandlers(ArrayList asynchronousHandlers) {
1136
1136
EmitLine ( " case " + ( ( amqpClass . Index << 16 ) | amqpMethod . Index ) + ": {" ) ;
1137
1137
ParameterInfo [ ] parameters = method . GetParameters ( ) ;
1138
1138
if ( parameters . Length > 0 ) {
1139
- EmitLine ( " " + implClass + " __impl = (" + implClass + ") __method;" ) ;
1139
+ EmitLine ( " " + implClass + " __impl = (" + implClass + ") __method;" ) ;
1140
1140
EmitLine ( " " + method . Name + "(" ) ;
1141
1141
int remaining = parameters . Length ;
1142
1142
foreach ( ParameterInfo pi in parameters ) {
0 commit comments