@@ -46,7 +46,7 @@ clippy::all
4646
4747use crate :: doc:: * ;
4848use crate :: formatting:: * ;
49- use heck:: { CamelCase , ShoutySnakeCase , SnakeCase } ;
49+ use heck:: { ShoutySnakeCase , SnakeCase } ;
5050use oo_bindgen:: callback:: * ;
5151use oo_bindgen:: class:: * ;
5252use oo_bindgen:: constants:: { ConstantSetHandle , ConstantValue , Representation } ;
@@ -374,9 +374,10 @@ fn write_struct_definition(
374374 StructElementType :: StructRef ( _) => None ,
375375 StructElementType :: Enum ( handle, default) => default. clone ( ) . map ( |x| {
376376 format ! (
377- "@ref {}_{}" ,
378- handle. to_c_type( & lib. c_ffi_prefix) ,
379- x. to_camel_case( )
377+ "@ref {}_{}_{}" ,
378+ lib. c_ffi_prefix. to_shouty_snake_case( ) ,
379+ handle. name. to_shouty_snake_case( ) ,
380+ x. to_shouty_snake_case( )
380381 )
381382 } ) ,
382383 StructElementType :: ClassRef ( _) => None ,
@@ -540,9 +541,9 @@ fn write_struct_initializer(
540541 Some ( value) => match handle. find_variant_by_name ( value) {
541542 Some ( variant) => format ! (
542543 "{}_{}_{}" ,
543- & lib. c_ffi_prefix,
544- handle. name. to_camel_case ( ) ,
545- variant. name. to_camel_case ( )
544+ lib. c_ffi_prefix. to_shouty_snake_case ( ) ,
545+ handle. name. to_shouty_snake_case ( ) ,
546+ variant. name. to_shouty_snake_case ( )
546547 ) ,
547548 None => panic ! ( "Variant {} not found in {}" , value, handle. name) ,
548549 } ,
@@ -585,9 +586,9 @@ fn write_enum_definition(
585586 doxygen ( f, |f| doxygen_print ( f, & variant. doc , lib) ) ?;
586587 f. writeln ( & format ! (
587588 "{}_{}_{} = {}," ,
588- & lib. c_ffi_prefix,
589- handle. name. to_camel_case ( ) ,
590- variant. name. to_camel_case ( ) ,
589+ lib. c_ffi_prefix. to_shouty_snake_case ( ) ,
590+ handle. name. to_shouty_snake_case ( ) ,
591+ variant. name. to_shouty_snake_case ( ) ,
591592 variant. value
592593 ) ) ?;
593594 }
@@ -610,7 +611,7 @@ fn write_enum_definition(
610611 f. writeln ( & format ! (
611612 "static const char* {}_{}_to_string({} value)" ,
612613 & lib. c_ffi_prefix,
613- handle. name. to_camel_case ( ) ,
614+ handle. name. to_snake_case ( ) ,
614615 handle. to_c_type( & lib. c_ffi_prefix)
615616 ) ) ?;
616617 blocked ( f, |f| {
@@ -619,13 +620,13 @@ fn write_enum_definition(
619620 for variant in & handle. variants {
620621 f. writeln ( & format ! (
621622 "case {}_{}_{}: return \" {}\" ;" ,
622- & lib. c_ffi_prefix,
623- handle. name. to_camel_case ( ) ,
624- variant. name. to_camel_case ( ) ,
623+ lib. c_ffi_prefix. to_shouty_snake_case ( ) ,
624+ handle. name. to_shouty_snake_case ( ) ,
625+ variant. name. to_shouty_snake_case ( ) ,
625626 variant. name
626627 ) ) ?;
627628 }
628- f. writeln ( "default: return \" \" ;" )
629+ f. writeln ( & format ! ( "default: return \" Unknown{} \" ;" , handle . name ) )
629630 } )
630631 } )
631632}
@@ -641,8 +642,9 @@ fn write_class_declaration(
641642 doxygen_print (
642643 f,
643644 & Doc :: from ( & * format ! (
644- "Iterator of {{struct:{}}}. See @ref {}." ,
645+ "Iterator of {{struct:{}}}. See @ref {}_{} ." ,
645646 handle. item_type. name( ) ,
647+ lib. c_ffi_prefix,
646648 handle. native_func. name
647649 ) ) ,
648650 lib,
@@ -652,9 +654,11 @@ fn write_class_declaration(
652654 doxygen_print (
653655 f,
654656 & Doc :: from ( & * format ! (
655- "Collection of {}. See @ref {} and @ref {}." ,
657+ "Collection of {}. See @ref {}_{} and @ref {}_ {}." ,
656658 handle. item_type. to_c_type( & lib. c_ffi_prefix) ,
659+ lib. c_ffi_prefix,
657660 handle. add_func. name,
661+ lib. c_ffi_prefix,
658662 handle. delete_func. name
659663 ) ) ,
660664 lib,
0 commit comments