@@ -30,8 +30,8 @@ public class CSharpToCppTransformer : Transformer
3030 // public: ...
3131 ( new Regex ( @"(?<newLineAndIndent>\r?\n?[ \t]*)(?<before>[^\{\(\r\n]*)(?<access>private|protected|public)[ \t]+(?![^\{\(\r\n]*(interface|class|struct)[^\{\(\r\n]*[\{\(\r\n])" ) , "${newLineAndIndent}${access}: ${before}" , null , 0 ) ,
3232 // public: static bool CollectExceptions { get; set; }
33- // public: static bool CollectExceptions;
34- ( new Regex ( @"(?<before >(private|protected|public): ( static )?[^\r\n]+ )(?<name>[a-zA-Z0-9]+) {[^;}]*(?<=\W)get;[^;}]*(?<=\W)set;[^;}]*}" ) , "${before}${name};" , null , 0 ) ,
33+ // public: inline static bool CollectExceptions;
34+ ( new Regex ( @"(?<access >(private|protected|public): )(?<before>( static )?[^\r\n]+ )(?<name>[a-zA-Z0-9]+) {[^;}]*(?<=\W)get;[^;}]*(?<=\W)set;[^;}]*}" ) , "${access}inline ${before}${name};" , null , 0 ) ,
3535 // public abstract class
3636 // class
3737 ( new Regex ( @"((public|protected|private|internal|abstract|static) )*(?<category>interface|class|struct)" ) , "${category}" , null , 0 ) ,
@@ -229,8 +229,8 @@ public class CSharpToCppTransformer : Transformer
229229 // TElement path[MaxPath] = { {0} };
230230 ( new Regex ( @"(\r?\n[\t ]+)[a-zA-Z0-9]+ ([a-zA-Z0-9]+) = new ([a-zA-Z0-9]+)\[([_a-zA-Z0-9]+)\];" ) , "$1$3 $2[$4] = { {0} };" , null , 0 ) ,
231231 // private: static readonly ConcurrentBag<std::exception> _exceptionsBag = new ConcurrentBag<std::exception>();
232- // private: static std::mutex _exceptionsBag_mutex; \n\n private: static std::vector<std::exception> _exceptionsBag;
233- ( new Regex ( @"(?<begin>\r?\n?(?<indent>[ \t]+))(?<access>(private|protected|public): )?static readonly ConcurrentBag<(?<argumentType>[^;\r\n]+)> (?<name>[_a-zA-Z0-9]+) = new ConcurrentBag<\k<argumentType>>\(\);" ) , "${begin}private: static std::mutex ${name}_mutex;" + Environment . NewLine + Environment . NewLine + "${indent}${access}static std::vector<${argumentType}> ${name};" , null , 0 ) ,
232+ // private: inline static std::mutex _exceptionsBag_mutex; \n\n private: inline static std::vector<std::exception> _exceptionsBag;
233+ ( new Regex ( @"(?<begin>\r?\n?(?<indent>[ \t]+))(?<access>(private|protected|public): )?static readonly ConcurrentBag<(?<argumentType>[^;\r\n]+)> (?<name>[_a-zA-Z0-9]+) = new ConcurrentBag<\k<argumentType>>\(\);" ) , "${begin}private: inline static std::mutex ${name}_mutex;" + Environment . NewLine + Environment . NewLine + "${indent}${access}inline static std::vector<${argumentType}> ${name};" , null , 0 ) ,
234234 // public: static IReadOnlyCollection<std::exception> GetCollectedExceptions() { return _exceptionsBag; }
235235 // public: static std::vector<std::exception> GetCollectedExceptions() { return std::vector<std::exception>(_exceptionsBag); }
236236 ( new Regex ( @"(?<access>(private|protected|public): )?static IReadOnlyCollection<(?<argumentType>[^;\r\n]+)> (?<methodName>[_a-zA-Z0-9]+)\(\) { return (?<fieldName>[_a-zA-Z0-9]+); }" ) , "${access}static std::vector<${argumentType}> ${methodName}() { return std::vector<${argumentType}>(${fieldName}); }" , null , 0 ) ,
@@ -252,7 +252,7 @@ public class CSharpToCppTransformer : Transformer
252252 // Insert scope borders.
253253 // class IgnoredExceptions { ... private: static std::mutex _exceptionsBag_mutex;
254254 // class IgnoredExceptions {/*~_exceptionsBag~*/ ... private: static std::mutex _exceptionsBag_mutex;
255- ( new Regex ( @"(?<classDeclarationBegin>\r?\n(?<indent>[\t ]*)class [^{\r\n]+\r\n[\t ]*{)(?<middle>((?!class).|\n)+?)(?<mutexDeclaration>private: static std::mutex (?<fieldName>[_a-zA-Z0-9]+)_mutex;)" ) , "${classDeclarationBegin}/*~${fieldName}~*/${middle}${mutexDeclaration}" , null , 0 ) ,
255+ ( new Regex ( @"(?<classDeclarationBegin>\r?\n(?<indent>[\t ]*)class [^{\r\n]+\r\n[\t ]*{)(?<middle>((?!class).|\n)+?)(?<mutexDeclaration>private: inline static std::mutex (?<fieldName>[_a-zA-Z0-9]+)_mutex;)" ) , "${classDeclarationBegin}/*~${fieldName}~*/${middle}${mutexDeclaration}" , null , 0 ) ,
256256 // Inside the scope of ~!_exceptionsBag!~ replace:
257257 // return std::vector<std::exception>(_exceptionsBag);
258258 // std::lock_guard<std::mutex> guard(_exceptionsBag_mutex); return std::vector<std::exception>(_exceptionsBag);
0 commit comments