@@ -244,18 +244,24 @@ public class CSharpToCppTransformer : TextTransformer
244244 // using Platform.Numbers;
245245 //
246246 ( new Regex ( @"([\r\n]{2}|^)\s*?using [\.a-zA-Z0-9]+;\s*?$" ) , "" , 0 ) ,
247+ // class SizedBinaryTreeMethodsBase : GenericCollectionMethodsBase
248+ // class SizedBinaryTreeMethodsBase : public GenericCollectionMethodsBase
249+ ( new Regex ( @"(struct|class) ([a-zA-Z0-9]+)(<[a-zA-Z0-9 ,]+>)? : ([a-zA-Z0-9]+)" ) , "$1 $2$3 : public $4" , 0 ) ,
250+ // System.IDisposable
251+ // System::IDisposable
252+ ( new Regex ( @"(?<before>System(::[a-zA-Z_]\w*)*)\.(?<after>[a-zA-Z_]\w*)" ) , "${before}::${after}" , 20 ) ,
253+ // class IProperty : ISetter<TValue, TObject>, IProvider<TValue, TObject>
254+ // class IProperty : public ISetter<TValue, TObject>, public IProvider<TValue, TObject>
255+ ( new Regex ( @"(?<before>(interface|struct|class) [a-zA-Z_]\w* : ((public [a-zA-Z_][\w:]*(<[a-zA-Z0-9 ,]+>)?, )+)?)(?<inheritedType>(?!public)[a-zA-Z_][\w:]*(<[a-zA-Z0-9 ,]+>)?)(?<after>(, [a-zA-Z_][\w:]*(?!>)|[ \r\n]+))" ) , "${before}public ${inheritedType}${after}" , 10 ) ,
256+ // interface IDisposable {
257+ // class IDisposable { public:
258+ ( new Regex ( @"(?<before>\r?\n)(?<indent>[ \t]*)interface (?<interface>[a-zA-Z_]\w*)(?<typeDefinitionEnding>[^{]+){" ) , "${before}${indent}class ${interface}${typeDefinitionEnding}{" + Environment . NewLine + " public:" , 0 ) ,
247259 // struct TreeElement { }
248260 // struct TreeElement { };
249261 ( new Regex ( @"(struct|class) ([a-zA-Z0-9]+)(\s+){([\sa-zA-Z0-9;:_]+?)}([^;])" ) , "$1 $2$3{$4};$5" , 0 ) ,
250262 // class Program { }
251263 // class Program { };
252264 ( new Regex ( @"(?<type>struct|class) (?<name>[a-zA-Z0-9]+[^\r\n]*)(?<beforeBody>[\r\n]+(?<indentLevel>[\t ]*)?)\{(?<body>[\S\s]+?[\r\n]+\k<indentLevel>)\}(?<afterBody>[^;]|$)" ) , "${type} ${name}${beforeBody}{${body}};${afterBody}" , 0 ) ,
253- // class SizedBinaryTreeMethodsBase : GenericCollectionMethodsBase
254- // class SizedBinaryTreeMethodsBase : public GenericCollectionMethodsBase
255- ( new Regex ( @"(struct|class) ([a-zA-Z0-9]+)(<[a-zA-Z0-9 ,]+>)? : ([a-zA-Z0-9]+)" ) , "$1 $2$3 : public $4" , 0 ) ,
256- // class IProperty : ISetter<TValue, TObject>, IProvider<TValue, TObject>
257- // class IProperty : public ISetter<TValue, TObject>, public IProvider<TValue, TObject>
258- ( new Regex ( @"(?<before>(struct|class) [a-zA-Z0-9]+ : ((public [a-zA-Z0-9]+(<[a-zA-Z0-9 ,]+>)?, )+)?)(?<inheritedType>(?!public)[a-zA-Z0-9]+(<[a-zA-Z0-9 ,]+>)?)(?<after>(, [a-zA-Z0-9]+(?!>)|[ \r\n]+))" ) , "${before}public ${inheritedType}${after}" , 10 ) ,
259265 // Insert scope borders.
260266 // ref TElement root
261267 // ~!root!~ref TElement root
@@ -436,9 +442,9 @@ public class CSharpToCppTransformer : TextTransformer
436442 //
437443 ( new Regex ( @"~![a-zA-Z0-9]+!~" ) , "" , 5 ) ,
438444 // Insert scope borders.
439- // auto random = new System. Random(0);
445+ // auto random = new System:: Random(0);
440446 // std::srand(0);
441- ( new Regex ( @"[a-zA-Z0-9\.]+ ([a-zA-Z0-9]+) = new (System\. )?Random\(([a-zA-Z0-9]+)\);" ) , "~!$1!~std::srand($3);" , 0 ) ,
447+ ( new Regex ( @"[a-zA-Z0-9\.]+ ([a-zA-Z0-9]+) = new (System:: )?Random\(([a-zA-Z0-9]+)\);" ) , "~!$1!~std::srand($3);" , 0 ) ,
442448 // Inside the scope of ~!random!~ replace:
443449 // random.Next(1, N)
444450 // (std::rand() % N) + 1
0 commit comments