2002-05-23 23:43:25 +00:00
|
|
|
// GtkSharp.Generation.GenBase.cs - The Generatable base class.
|
|
|
|
//
|
2004-12-26 19:33:34 +00:00
|
|
|
// Author: Mike Kestner <mkestner@novell.com>
|
2002-05-23 23:43:25 +00:00
|
|
|
//
|
2004-06-25 16:35:15 +00:00
|
|
|
// Copyright (c) 2001-2002 Mike Kestner
|
|
|
|
// Copyright (c) 2004 Novell, Inc.
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the GNU General Public
|
|
|
|
// License as published by the Free Software Foundation.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public
|
|
|
|
// License along with this program; if not, write to the
|
|
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.Xml;
|
|
|
|
|
2004-12-26 19:33:34 +00:00
|
|
|
public abstract class GenBase : IGeneratable {
|
2002-05-23 23:43:25 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-19 18:13:01 +00:00
|
|
|
public int ParserVersion {
|
|
|
|
get {
|
|
|
|
XmlElement root = elem.OwnerDocument.DocumentElement;
|
|
|
|
return root.HasAttribute ("parser_version") ? int.Parse (root.GetAttribute ("parser_version")) : 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-08 18:00:47 +00:00
|
|
|
public bool IsInternal {
|
|
|
|
get {
|
2012-10-21 16:10:34 +00:00
|
|
|
return elem.GetAttributeAsBoolean ("internal");
|
2009-01-08 18:00:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-21 20:25:43 +00:00
|
|
|
public string LibraryName {
|
|
|
|
get {
|
|
|
|
return ns.GetAttribute ("library");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-26 19:33:34 +00:00
|
|
|
public abstract string MarshalType { get; }
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-21 16:37:04 +00:00
|
|
|
public abstract string DefaultValue { get; }
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-26 19:33:34 +00:00
|
|
|
public abstract string CallByName (string var);
|
|
|
|
|
|
|
|
public abstract string FromNative (string var);
|
|
|
|
|
2005-08-05 20:34:45 +00:00
|
|
|
public abstract bool Validate ();
|
|
|
|
|
2004-12-26 19:33:34 +00:00
|
|
|
public void Generate ()
|
|
|
|
{
|
|
|
|
GenerationInfo geninfo = new GenerationInfo (ns);
|
|
|
|
Generate (geninfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract void Generate (GenerationInfo geninfo);
|
2002-05-23 23:43:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|