/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 6 - 2 0 1 9 ĠHERE ĠEurope ĠB . V . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ċ Ġ* ĠSPDX - License - Identifier : ĠApache - 2 . 0 Ċ Ġ* ĠLicense - Filename : ĠLICENSE Ċ Ġ*/ Ċ Ċ package Ġcom . here . glue co di um . generator . c bridge Ċ Ċ import Ġcom . here . glue co di um . common . L ime Type Refs Visitor Ċ import Ġcom . here . glue co di um . generator . c bridge . CB ridge Name Rules . C BR ID GE _ INTERNAL Ċ import Ġcom . here . glue co di um . generator . c bridge . CB ridge Name Rules . C BR ID GE _ PUBLIC Ċ import Ġcom . here . glue co di um . generator . common . Generated File Ċ import Ġcom . here . glue co di um . generator . common . Generator Ċ import Ġcom . here . glue co di um . generator . common . Generic Imports Collector Ċ import Ġcom . here . glue co di um . generator . common . Include Ċ import Ġcom . here . glue co di um . generator . common . Name Resolver Ċ import Ġcom . here . glue co di um . generator . common . Optim ized Lists Collector Ċ import Ġcom . here . glue co di um . generator . common . templates . Template Engine Ċ import Ġcom . here . glue co di um . generator . cpp . Cpp FullName Resolver Ċ import Ġcom . here . glue co di um . generator . cpp . Cpp Include Resolver Ċ import Ġcom . here . glue co di um . generator . cpp . Cpp Name Cache Ċ import Ġcom . here . glue co di um . generator . cpp . Cpp Name Resolver Ċ import Ġcom . here . glue co di um . generator . cpp . Cpp Name Rules Ċ import Ġcom . here . glue co di um . model . lime . L ime AttributeType Ċ import Ġcom . here . glue co di um . model . lime . L ime Attributes Ċ import Ġcom . here . glue co di um . model . lime . L ime Container Ċ import Ġcom . here . glue co di um . model . lime . L ime Container With Inheritance Ċ import Ġcom . here . glue co di um . model . lime . L ime Direct Type Ref Ċ import Ġcom . here . glue co di um . model . lime . L ime Element Ċ import Ġcom . here . glue co di um . model . lime . L ime Enumeration Ċ import Ġcom . here . glue co di um . model . lime . L ime GenericType Ċ import Ġcom . here . glue co di um . model . lime . L ime Interface Ċ import Ġcom . here . glue co di um . model . lime . L ime Lambda Ċ import Ġcom . here . glue co di um . model . lime . L ime List Ċ import Ġcom . here . glue co di um . model . lime . L ime Map Ċ import Ġcom . here . glue co di um . model . lime . L ime Named Element Ċ import Ġcom . here . glue co di um . model . lime . L ime Set Ċ import Ġcom . here . glue co di um . model . lime . L ime Struct Ċ import Ġcom . here . glue co di um . model . lime . L ime Type Ċ import Ġcom . here . glue co di um . model . lime . L ime Type Helper Ċ import Ġcom . here . glue co di um . model . lime . L ime Type Ref Ċ import Ġjava . nio . file . Paths Ċ Ċ internal Ġclass ĠC Bridge Generator ( ĊĠĠĠ Ġprivate Ġval Ġlime Reference Map : ĠMap < String , ĠL ime Element >, ĊĠĠĠ Ġprivate Ġval Ġroot Namespace : ĠList < String >, ĊĠĠĠ Ġname Cache : ĠCpp Name Cache , ĊĠĠĠ Ġprivate Ġval Ġinternal Namespace : ĠList < String >, ĊĠĠĠ Ġcpp Name Rules : ĠCpp Name Rules , ĊĠĠĠ Ġprivate Ġval Ġname Resolver : ĠC Bridge Name Resolver , ĊĠĠĠ Ġactive Tags : ĠSet < String > Ċ ) Ġ{ ĊĠĠĠ Ġval Ġcpp Name Resolver Ġ= ĠCpp Name Resolver ( lime Reference Map , Ġinternal Namespace , Ġname Cache , Ġforce Follow Through Ġ= Ġtrue ) ĊĠĠĠ Ġprivate Ġval Ġcpp Ref Name Resolver Ġ= ĊĠĠĠĠĠĠĠ ĠC Bridge Cpp Name Resolver ( lime Reference Map , ĠCpp FullName Resolver ( name Cache ), Ġcpp Name Resolver ) ĊĠĠĠ Ġprivate Ġval Ġcpp Include Resolver Ġ= ĠCpp Include Resolver ( lime Reference Map , Ġcpp Name Rules , Ġinternal Namespace ) ĊĠĠĠ Ġprivate Ġval Ġfile Names Ġ= ĠC Bridge File Names ( root Namespace ) ĊĠĠĠ Ġprivate Ġval Ġgenerator Pred icates Ġ= ĠC Bridge Generator Pred icates ( cpp Name Resolver , Ġlime Reference Map , Ġactive Tags ) ĊĠĠĠ Ġprivate Ġval Ġheader Include Collector Ġ= ĊĠĠĠĠĠĠĠ ĠGeneric Imports Collector ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠC Bridge Header Include Resolver ( lime Reference Map , Ġfile Names ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġretain Predicate Ġ= Ġ{ Ġgenerator Pred icates . should Ret ain ( it ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcollect Type Ref Imports Ġ= Ġtrue , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcollect Own Imports Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġprivate Ġval Ġimpl Include Collector Ġ= ĊĠĠĠĠĠĠĠ ĠGeneric Imports Collector ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠC Bridge Impl Include Resolver ( cpp Include Resolver ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġretain Predicate Ġ= Ġ{ Ġgenerator Pred icates . should Ret ain ( it ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcollect Type Ref Imports Ġ= Ġtrue , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcollect Own Imports Ġ= Ġtrue , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġparent Type Filter Ġ= Ġ{ Ġit Ġis ĠL ime Interface Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġval Ġgeneric Types Collector Ġ= ĠGeneric Types Collector ( name Resolver ) ĊĊĠĠĠ Ġfun Ġgenerate ( root Element : ĠL ime Named Element ): ĠList < Generated File > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġoptimized Lists Ġ= Ġwhen Ġ( root Element ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Container Ġ-> ĠOptim ized Lists Collector (). getAll Optim ized Lists ( root Element ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġempty Map () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtemplate Data Ġ= Ġmutable Map Of (" model " Ġto Ġroot Element , Ġ" internal Namespace " Ġto Ġinternal Namespace ) ĊĠĠĠĠĠĠĠ Ġval Ġname Resolvers Ġ= Ġmap Of < String , ĠName Resolver >(" " Ġto Ġname Resolver , Ġ" C ++ " Ġto Ġcpp Ref Name Resolver ) ĊĊĠĠĠĠĠĠĠ Ġval Ġheader FilePath Ġ= Ġfile Names . getHeader FilePath ( root Element ) ĊĠĠĠĠĠĠĠ Ġval Ġself Include Ġ= ĠInclude . create Internal Include ( header FilePath ) ĊĠĠĠĠĠĠĠ Ġtemplate Data [" includes "] Ġ= Ġheader Include Collector . collect Imports ( root Element ). distinct (). sorted () Ġ- Ġself Include ĊĠĠĠĠĠĠĠ Ġtemplate Data [" content Template "] Ġ= Ġ( select Header Template ( root Element ) Ġ?: Ġreturn Ġempty List ()) ĊĠĠĠĠĠĠĠ Ġval Ġheader FileContent Ġ= ĠTemplate Engine . render ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" c bridge / CB ridge Header ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtemplate Data , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname Resolvers , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerator Pred icates . predicates ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġheader File Ġ= ĠGenerated File ( header FileContent , Ġheader FilePath ) ĊĊĠĠĠĠĠĠĠ Ġtemplate Data [" content Template "] Ġ= Ġselect Impl Template ( root Element ) Ġ?: Ġreturn ĠlistOf ( header File ) ĊĠĠĠĠĠĠĠ Ġtemplate Data [" includes "] Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf ( self Include ) Ġ+ Ġimpl Include Collector . collect Imports ( root Element ). distinct (). sorted () ĊĠĠĠĠĠĠĠ Ġval Ġimpl FileContent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTemplate Engine . render ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" c bridge / CB ridge Implementation ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtemplate Data , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname Resolvers , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġgenerator Pred icates . predicates ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġimpl File Ġ= ĠGenerated File ( impl FileContent , Ġfile Names . get Impl FilePath ( root Element )) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠlistOf ( header File , Ġimpl File ) Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoptimized Lists . keys . flatMap Ġ{ Ġgenerate Optim ized List Files ( lime Reference Map [ it ], Ġoptimized Lists [ it ]) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġgenerate Collections ( lime Model : ĠList < L ime Named Element >): ĠList < Generated File > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġall Types Ġ= Ġlime Model . flatMap Ġ{ ĠL ime Type Helper . getAll Types ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġall Parent Types Ġ= ĠgetAll Parent Types ( all Types ) ĊĠĠĠĠĠĠĠ Ġval Ġgeneric Types Ġ= Ġgeneric Types Collector . getAll Generic Types ( all Types Ġ+ Ġall Parent Types ) ĊĠĠĠĠĠĠĠ Ġval Ġtemplate Data Ġ= Ġmutable Map Of < String , ĠAny >( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" lists " Ġto Ġgeneric Types . filter Is Instance < L ime List >(), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" maps " Ġto Ġgeneric Types . filter Is Instance < L ime Map >(), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" sets " Ġto Ġgeneric Types . filter Is Instance < L ime Set >(), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" internal Namespace " Ġto Ġinternal Namespace ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġname Resolvers Ġ= Ġmap Of < String , ĠName Resolver >(" " Ġto Ġname Resolver , Ġ" C ++ " Ġto Ġcpp Ref Name Resolver ) ĊĊĠĠĠĠĠĠĠ Ġval Ġheader Includes Ġ= Ġgeneric Types . flatMap Ġ{ Ġheader Include Collector . collect Imports ( it ) Ġ} Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf NotNull ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠC Bridge Header Include Resolver . INT _ INCLUDE . take If Ġ{ Ġgeneric Types . any Ġ{ Ġit Ġis ĠL ime List Ġ} Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠC Bridge Header Include Resolver . BOOL _ INCLUDE . take If Ġ{ Ġgeneric Types . any Ġ{ Ġit Ġ! is ĠL ime List Ġ} Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġtemplate Data [" includes "] Ġ= Ġheader Includes . distinct (). sorted () ĊĠĠĠĠĠĠĠ Ġval Ġheader FileContent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTemplate Engine . render ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" c bridge / CB ridge Collections Header ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtemplate Data , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname Resolvers , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġgenerator Pred icates . predicates ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġheader File Ġ= ĠGenerated File ( header FileContent , ĠC BR ID GE _ COLLECTION S _ HEADER ) ĊĊĠĠĠĠĠĠĠ Ġval Ġimpl Includes Ġ= Ġgeneric Types . flatMap Ġ{ Ġimpl Include Collector . collect Imports ( it ) Ġ} Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠC Bridge Impl Include Resolver . BASE _ HANDLE _ IMPL _ INCLUDE Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcpp Include Resolver . optional Include ĊĠĠĠĠĠĠĠ Ġtemplate Data [" includes "] Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf ( Include . create Internal Include ( C BR ID GE _ COLLECTION S _ HEADER )) Ġ+ Ġimpl Includes . distinct (). sorted () ĊĠĠĠĠĠĠĠ Ġval Ġimpl FileContent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTemplate Engine . render ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" c bridge / CB ridge Collections Impl ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtemplate Data , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname Resolvers , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġgenerator Pred icates . predicates ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġimpl File Ġ= ĠGenerated File ( impl FileContent , ĠC BR ID GE _ COLLECTION S _ IMPL ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠlistOf ( header File , Ġimpl File ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġgenerate Optim ized List Files ( lime Element : ĠL ime Element ?, Ġlists : ĠList < L ime List >? ): ĠList < Generated File > Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( lime Element Ġ! is ĠL ime Named Element Ġ|| Ġlists . isNull OrEmpty ()) Ġreturn Ġempty List () ĊĊĠĠĠĠĠĠĠ Ġval Ġcontainer Data Ġ= Ġmutable Map Of (" container " Ġto Ġlime Element , Ġ" internal Namespace " Ġto Ġinternal Namespace ) ĊĠĠĠĠĠĠĠ Ġreturn Ġlists . flatMap Ġ{ Ġgenerate Optim ized List File ( it , Ġlime Element , Ġcontainer Data ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġgenerate Optim ized List File ( ĊĠĠĠĠĠĠĠ Ġlime List : ĠL ime List , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠL ime Named Element , ĊĠĠĠĠĠĠĠ Ġcontainer Data : ĠMutable Map < String , ĠAny > ĊĠĠĠ Ġ): ĠList < Generated File > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġelement Type Ġ= Ġlime List . elementType . type . actual Type ĊĠĠĠĠĠĠĠ Ġval Ġin fix Ġ= Ġ"_ ${ elementType . name } Lazy List " ĊĠĠĠĠĠĠĠ Ġval Ġheader FileName Ġ= ĠC Bridge Name Rules . create Path ( container , Ġroot Namespace , Ġ" include ", Ġ". h ", Ġin fix ) ĊĊĠĠĠĠĠĠĠ Ġcontainer Data [" list Type "] Ġ= ĠL ime Direct Type Ref ( lime List , Ġattributes Ġ= Ġoptimized Attributes ) ĊĠĠĠĠĠĠĠ Ġcontainer Data [" elementType "] Ġ= Ġlime List . elementType ĊĠĠĠĠĠĠĠ Ġval Ġname Resolvers Ġ= Ġmap Of < String , ĠName Resolver >(" " Ġto Ġname Resolver , Ġ" C ++ " Ġto Ġcpp Ref Name Resolver ) ĊĊĠĠĠĠĠĠĠ Ġval Ġheader File Ġ= ĠGenerated File ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTemplate Engine . render ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" c bridge / Lazy List Header ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcontainer Data , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname Resolvers , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġgenerator Pred icates . predicates ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġheader FileName ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġimpl Includes Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġimpl Include Collector . collect Imports ( elementType ) Ġ+ ĠInclude . create Internal Include ( header FileName ) ĊĠĠĠĠĠĠĠ Ġcontainer Data [" includes "] Ġ= Ġimpl Includes . distinct (). sorted () ĊĠĠĠĠĠĠĠ Ġval Ġimpl FileName Ġ= ĠC Bridge Name Rules . create Path ( container , Ġroot Namespace , Ġ" src ", Ġ". cpp ", Ġin fix ) ĊĊĠĠĠĠĠĠĠ Ġval Ġimpl File Ġ= ĠGenerated File ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTemplate Engine . render (" c bridge / Lazy List Impl ", Ġcontainer Data , Ġname Resolvers , Ġgenerator Pred icates . predicates ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġimpl FileName ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠlistOf ( header File , Ġimpl File ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġgenerate Helpers () Ġ= ĊĠĠĠĠĠĠĠ ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content (" Base Handle Impl ", ĠBASE _ HANDLE _ IMPL _ FILE ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" String Handle ", ĠPaths . get ( C BR ID GE _ PUBLIC , ĠSRC _ DIR , Ġ" String Handle . cpp "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" ByteArray Handle ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( C BR ID GE _ PUBLIC , ĠSRC _ DIR , Ġ" ByteArray Handle . cpp "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Locale Handle ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( C BR ID GE _ PUBLIC , ĠSRC _ DIR , Ġ" Locale Handle . cpp "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Builtin Handle ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( C BR ID GE _ PUBLIC , ĠSRC _ DIR , Ġ" Builtin Handle . cpp "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Type Init Repository ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( C BR ID GE _ INTERNAL , ĠINCLUDE _ DIR , Ġ" Type Init Repository . h "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Type Init Repository Impl ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( C BR ID GE _ PUBLIC , ĠSRC _ DIR , Ġ" Type Init Repository . cpp "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Wrapper Cache Header ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠC BR ID GE _ INTERNAL , ĠINCLUDE _ DIR , Ġ" Wrapper Cache . h " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate Helper Content ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Wrapper Cache Impl ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( C BR ID GE _ PUBLIC , ĠSRC _ DIR , Ġ" Wrapper Cache . cpp "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġfun Ġgenerate Helper Content ( template : ĠString , Ġpath : ĠString ): ĠGenerated File Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontent Ġ= ĠTemplate Engine . render ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" c bridge / common /$ template ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmap Of (" internal Namespace " Ġto Ġinternal Namespace ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġreturn ĠGenerated File ( content , Ġpath , ĠGenerated File . Source Set . COMMON ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġselect Header Template ( lime Element : ĠL ime Named Element ) Ġ= ĊĠĠĠĠĠĠĠ Ġwhen Ġ( lime Element ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Struct Ġ-> Ġ" c bridge / CB ridge Struct Header " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Container Ġ-> Ġ" c bridge / CB ridge Class Header " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Lambda Ġ-> Ġ" c bridge / CB ridge Lambda Header " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Enumeration Ġ-> Ġ" c bridge / CB ridge Enumeration " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġselect Impl Template ( lime Element : ĠL ime Named Element ) Ġ= ĊĠĠĠĠĠĠĠ Ġwhen Ġ( lime Element ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Struct Ġ-> Ġ" c bridge / CB ridge Struct Impl " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Container Ġ-> Ġ" c bridge / CB ridge Class Impl " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Lambda Ġ-> Ġ" c bridge / CB ridge Lambda Impl " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Enumeration Ġ-> Ġnull ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠGeneric Types Collector ( private Ġval Ġname Resolver : ĠName Resolver ) Ġ: ĊĠĠĠĠĠĠĠ ĠL ime Type Refs Visitor < List < L ime GenericType >>() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġvisit Type Ref ( parentElement : ĠL ime Named Element , Ġlime Type Ref : ĠL ime Type Ref ?): ĠList < L ime GenericType > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlime Type Ġ= Ġlime Type Ref ?. type ?. actual Type Ġas ? ĠL ime GenericType Ġ?: Ġreturn Ġempty List () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠlistOf ( lime Type ) Ġ+ Ġwhen Ġ( lime Type ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime List Ġ-> Ġvisit Type Ref ( parentElement , Ġlime Type . elementType ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Set Ġ-> Ġvisit Type Ref ( parentElement , Ġlime Type . elementType ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠL ime Map Ġ-> Ġvisit Type Ref ( parentElement , Ġlime Type . key Type ) Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġvisit Type Ref ( parentElement , Ġlime Type . valueType ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġempty List () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġfun ĠgetAll Generic Types ( all Types : ĠList < L ime Type >) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtraverse Types ( all Types ). flatten (). associate By Ġ{ Ġname Resolver . resolve Name ( it ) Ġ}. to Sorted Map (). values ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠSRC _ DIR Ġ= Ġ" src " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠINCLUDE _ DIR Ġ= Ġ" include " ĊĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠC BR ID GE _ COLLECTION S _ HEADER Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( C BR ID GE _ PUBLIC , ĠINCLUDE _ DIR , Ġ" Generic Collections . h "). toString () ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠC BR ID GE _ COLLECTION S _ IMPL Ġ= ĠPaths . get ( C BR ID GE _ PUBLIC , ĠSRC _ DIR , Ġ" Generic Collections . cpp "). toString () ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠBASE _ HANDLE _ IMPL _ FILE Ġ= ĠPaths . get ( C BR ID GE _ INTERNAL , ĠINCLUDE _ DIR , Ġ" Base Handle Impl . h "). toString () ĊĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠBASE _ HANDLE _ FILE Ġ= ĠPaths . get ( C BR ID GE _ PUBLIC , ĠINCLUDE _ DIR , Ġ" Base Handle . h "). toString () ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠSTRING _ HANDLE _ FILE Ġ= ĠPaths . get ( C BR ID GE _ PUBLIC , ĠINCLUDE _ DIR , Ġ" String Handle . h "). toString () ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠEX PORT _ FILE Ġ= ĠPaths . get ( C BR ID GE _ PUBLIC , ĠINCLUDE _ DIR , Ġ" Export . h "). toString () ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠPRO XY _ CACHE _ FILENAME Ġ= ĠPaths . get ( C BR ID GE _ INTERNAL , ĠINCLUDE _ DIR , Ġ" Cached Proxy Base . h "). toString () ĊĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġoptimized Attributes Ġ= ĠL ime Attributes . Builder (). addAttribute ( L ime AttributeType . OPTIMI Z ED ). build () ĊĊĠĠĠĠĠĠĠ Ġval ĠSTATIC _ FILES Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠGenerator . copy Common File ( BASE _ HANDLE _ FILE , Ġ""), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠGenerator . copy Common File ( STRING _ HANDLE _ FILE , Ġ""), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠGenerator . copy Common File ( EXPORT _ FILE , Ġ""), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠGenerator . copy Common File ( Paths . get ( C BR ID GE _ PUBLIC , ĠINCLUDE _ DIR , Ġ" Builtin Handle . h "). toString (), Ġ""), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠGenerator . copy Common File ( Paths . get ( C BR ID GE _ PUBLIC , ĠINCLUDE _ DIR , Ġ" ByteArray Handle . h "). toString (), Ġ""), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠGenerator . copy Common File ( Paths . get ( C BR ID GE _ PUBLIC , ĠINCLUDE _ DIR , Ġ" Locale Handle . h "). toString (), Ġ""), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠGenerator . copy Common File ( PROXY _ CACHE _ FILENAME , Ġ"") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġfun ĠgetAll Parent Types ( all Types : ĠList < L ime Type >): ĠList < L ime Type > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( all Types . isEmpty ()) Ġreturn Ġempty List () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġparents Ġ= Ġall Types . filter Is Instance < L ime Container With Inheritance >(). flatMap Ġ{ Ġit . parents Ġ}. map Ġ{ Ġit . type Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġparents Ġ+ ĠgetAll Parent Types ( parents ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ