* generator/Field.cs (StudlyName): Fall back to using "cname" if

"name" isn't defined (ie, when using the latest generator against
	api files output by an older parser).

svn path=/trunk/gtk-sharp/; revision=37902
This commit is contained in:
Dan Winship 2004-12-17 20:29:54 +00:00
parent 43932ea8ae
commit 8457bacdc9
2 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2004-12-17 Dan Winship <danw@novell.com>
* generator/Field.cs (StudlyName): Fall back to using "cname" if
"name" isn't defined (ie, when using the latest generator against
api files output by an older parser).
2004-12-17 Dan Winship <danw@novell.com>
* generator/ClassBase.cs (IgnoreMethod): Don't ignore GetFoo and

View File

@ -129,7 +129,21 @@ namespace GtkSharp.Generation {
public string StudlyName {
get {
return elem.GetAttribute ("name");
string studly = elem.GetAttribute ("name");
if (studly != "")
return studly;
// FIXME: this is backward compatibility for API files
// output by older versions of the parser. It can go
// away at some point.
string name = elem.GetAttribute ("cname");
string[] segs = name.Split('_');
foreach (string s in segs) {
if (s.Trim () == "")
continue;
studly += (s.Substring(0,1).ToUpper() + s.Substring(1));
}
return studly;
}
}