void ProcessInterface(string iface) { bool need_close = iface.IndexOf("{") != -1; var cols = iface.Split(); string line; //Console.WriteLine ("**** {0} ", iface); types.Add(cols [1]); if (extraAttribute != null) { gencs.Write("\n\t[{0}]", extraAttribute); } if (cols.Length >= 4) { gencs.WriteLine("\n\t[BaseType (typeof ({0}))]", cols [3]); } gencs.WriteLine("\t{0}interface {1} {{", limit == null ? "" : "public partial ", cols [1]); //while ((line = r.ReadLine ()) != null && (need_close && !line.StartsWith ("}"))){ // if (line == "{") // need_close = true; //} line = r.ReadLine(); if (line == "{") { need_close = true; } while (line != null && (need_close && line != "}")) { line = r.ReadLine(); } var decl = new Declarations(gencs); while ((line = r.ReadLine()) != null && !line.StartsWith("@end")) { string full = ""; while ((line = r.ReadLine()) != null && !line.StartsWith("@end")) { full += line; if (full.IndexOf(';') != -1) { full = full.Replace('\n', ' '); decl.Add(ProcessDeclaration(false, full, false)); full = ""; } } break; } decl.Generate(extraAttribute); gencs.WriteLine("\t}"); }
void ProcessProtocol(string proto) { string [] d = proto.Split(new char [] { ' ', '<', '>' }); string line; types.Add(d [1]); if (extraAttribute != null) { gencs.WriteLine("\n\t[{0}]", extraAttribute); } gencs.WriteLine("\n\t[BaseType (typeof ({0}))]", d.Length > 2 ? d [2] : "NSObject"); gencs.WriteLine("\t[Model]"); gencs.WriteLine("\tinterface {0} {{", d [1]); bool optional = false; var decl = new Declarations(gencs); while ((line = r.ReadLine()) != null && !line.StartsWith("@end")) { if (line.StartsWith("@optional")) { optional = true; } string full = ""; while ((line = r.ReadLine()) != null && !line.StartsWith("@end")) { full += line; if (full.IndexOf(';') != -1) { full = full.Replace('\n', ' '); decl.Add(ProcessDeclaration(true, full, optional)); full = ""; } } if (line.StartsWith("@end")) { break; } } decl.Generate(extraAttribute); gencs.WriteLine("\t}"); }
void ProcessProtocol (string proto) { string [] d = proto.Split (new char [] { ' ', '<', '>'}); string line; types.Add (d [1]); if (extraAttribute != null) gencs.WriteLine ("\n\t[{0}]", extraAttribute); gencs.WriteLine ("\n\t[BaseType (typeof ({0}))]", d.Length > 2 ? d [2] : "NSObject"); gencs.WriteLine ("\t[Model]"); gencs.WriteLine ("\tinterface {0} {{", d [1]); bool optional = false; var decl = new Declarations (gencs); while ((line = r.ReadLine ()) != null && !line.StartsWith ("@end")){ if (line.StartsWith ("@optional")) optional = true; string full = ""; while ((line = r.ReadLine ()) != null && !line.StartsWith ("@end")){ full += line; if (full.IndexOf (';') != -1){ full = full.Replace ('\n', ' '); decl.Add (ProcessDeclaration (true, full, optional)); full = ""; } } if (line.StartsWith ("@end")) break; } decl.Generate (extraAttribute); gencs.WriteLine ("\t}"); }
void ProcessInterface (string iface) { bool need_close = iface.IndexOf ("{") != -1; var cols = iface.Split (); string line; //Console.WriteLine ("**** {0} ", iface); types.Add (cols [1]); if (extraAttribute != null) gencs.Write ("\n\t[{0}]", extraAttribute); if (cols.Length >= 4) gencs.WriteLine ("\n\t[BaseType (typeof ({0}))]", cols [3]); gencs.WriteLine ("\t{0}interface {1} {{", limit == null ? "" : "public partial ", cols [1]); //while ((line = r.ReadLine ()) != null && (need_close && !line.StartsWith ("}"))){ // if (line == "{") // need_close = true; //} line = r.ReadLine (); if (line == "{") need_close = true; while (line != null && (need_close && line != "}")) line = r.ReadLine (); var decl = new Declarations (gencs); while ((line = r.ReadLine ()) != null && !line.StartsWith ("@end")){ string full = ""; while ((line = r.ReadLine ()) != null && !line.StartsWith ("@end")){ full += line; if (full.IndexOf (';') != -1){ full = full.Replace ('\n', ' '); decl.Add (ProcessDeclaration (false, full, false)); full = ""; } } break; } decl.Generate (extraAttribute); gencs.WriteLine ("\t}"); }