/// <summary> /// Prepares C++ struct for mapping. This method is creating the associated C# struct. /// </summary> /// <param name="cppStruct">The c++ struct.</param> /// <returns></returns> public override CsStruct Prepare(CppStruct cppStruct) { // Create a new C# struct var nameSpace = namespaceRegistry.ResolveNamespace(cppStruct); var csStruct = new CsStruct(cppStruct) { Name = NamingRules.Rename(cppStruct), // IsFullyMapped to false => The structure is being mapped IsFullyMapped = false }; // Add the C# struct to its namespace nameSpace.Add(csStruct); // Map the C++ name to the C# struct typeRegistry.BindType(cppStruct.Name, csStruct); return(csStruct); }
/// <summary> /// Prepares the specified C++ element to a C# element. /// </summary> /// <param name="cppEnum">The C++ element.</param> /// <returns>The C# element created and registered to the <see cref="TransformManager"/></returns> public override CsEnum Prepare(CppEnum cppEnum) { // Create C# enum var newEnum = new CsEnum { Name = NamingRules.Rename(cppEnum), CppElement = cppEnum, UnderlyingType = typeRegistry.ImportType(typeof(int)) }; // Get the namespace for this particular include and enum var nameSpace = namespaceRegistry.ResolveNamespace(cppEnum); nameSpace.Add(newEnum); // Bind C++ enum to C# enum typeRegistry.BindType(cppEnum.Name, newEnum); return(newEnum); }