2002-05-23 23:43:25 +00:00
|
|
|
// GtkSharp.Generation.GenBase.cs - The Generatable base class.
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
|
|
|
// (c) 2001-2002 Mike Kestner
|
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
public abstract class GenBase {
|
|
|
|
|
2002-06-21 20:25:43 +00:00
|
|
|
private XmlElement ns;
|
2002-05-23 23:43:25 +00:00
|
|
|
private XmlElement elem;
|
|
|
|
|
2002-06-21 20:25:43 +00:00
|
|
|
protected GenBase (XmlElement ns, XmlElement elem)
|
2002-05-23 23:43:25 +00:00
|
|
|
{
|
|
|
|
this.ns = ns;
|
|
|
|
this.elem = elem;
|
|
|
|
}
|
|
|
|
|
|
|
|
public string CName {
|
|
|
|
get {
|
|
|
|
return elem.GetAttribute ("cname");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public XmlElement Elem {
|
|
|
|
get {
|
|
|
|
return elem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-21 20:25:43 +00:00
|
|
|
public string LibraryName {
|
|
|
|
get {
|
|
|
|
return ns.GetAttribute ("library");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public string Name {
|
|
|
|
get {
|
|
|
|
return elem.GetAttribute ("name");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-21 20:25:43 +00:00
|
|
|
public string NS {
|
2002-05-23 23:43:25 +00:00
|
|
|
get {
|
2002-06-21 20:25:43 +00:00
|
|
|
return ns.GetAttribute ("name");
|
2002-05-23 23:43:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-05 00:20:17 +00:00
|
|
|
public XmlElement NSElem {
|
|
|
|
get {
|
|
|
|
return ns;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public string QualifiedName {
|
|
|
|
get {
|
2002-06-21 20:25:43 +00:00
|
|
|
return NS + "." + Name;
|
2002-05-23 23:43:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-05 00:20:17 +00:00
|
|
|
public void AppendCustom (StreamWriter sw, string custom_dir)
|
2002-06-10 12:34:09 +00:00
|
|
|
{
|
|
|
|
char sep = Path.DirectorySeparatorChar;
|
2003-10-05 00:20:17 +00:00
|
|
|
string custom = custom_dir + sep + Name + ".custom";
|
2002-06-10 12:34:09 +00:00
|
|
|
if (File.Exists(custom)) {
|
2003-01-05 23:51:37 +00:00
|
|
|
sw.WriteLine ("#region Customized extensions");
|
2003-07-02 18:13:24 +00:00
|
|
|
sw.WriteLine ("#line 1 \"" + Name + ".custom\"");
|
2002-06-10 12:34:09 +00:00
|
|
|
FileStream custstream = new FileStream(custom, FileMode.Open, FileAccess.Read);
|
|
|
|
StreamReader sr = new StreamReader(custstream);
|
|
|
|
sw.WriteLine (sr.ReadToEnd ());
|
2003-01-05 23:51:37 +00:00
|
|
|
sw.WriteLine ("#endregion");
|
2002-06-10 12:34:09 +00:00
|
|
|
sr.Close ();
|
|
|
|
}
|
|
|
|
}
|
2002-05-23 23:43:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|