* Main.cs:

* Settings.cs:
* FuncProcessor.cs:
* Structures/Type.cs:
* Structures/Constant.cs:
* Structures/Delegate.cs: Do not hardcode namespace separator to ".".
This commit is contained in:
the_fiddler 2010-12-05 15:45:23 +00:00
parent 84dcb6395f
commit 95a906647e
6 changed files with 17 additions and 12 deletions

View file

@ -169,7 +169,8 @@ namespace Bind
if (d.ReturnType.CurrentType.Contains("GLenum")) if (d.ReturnType.CurrentType.Contains("GLenum"))
{ {
if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) == Settings.Legacy.None) if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) == Settings.Legacy.None)
d.ReturnType.QualifiedType = String.Format("{0}.{1}", Settings.EnumsOutput, Settings.CompleteEnumName); d.ReturnType.QualifiedType = String.Format("{0}{1}{2}",
Settings.EnumsOutput, Settings.NamespaceSeparator, Settings.CompleteEnumName);
else else
d.ReturnType.QualifiedType = "int"; d.ReturnType.QualifiedType = "int";
} }

View file

@ -86,6 +86,7 @@ namespace Bind
Settings.DefaultOutputPath = "gl"; Settings.DefaultOutputPath = "gl";
Settings.DefaultOutputNamespace = "OpenTK"; Settings.DefaultOutputNamespace = "OpenTK";
Settings.EnumsNamespace = ""; Settings.EnumsNamespace = "";
Settings.NamespaceSeparator = "::";
} }
break; break;
} }

View file

@ -35,6 +35,7 @@ namespace Bind
public static string FunctionPrefix = "gl"; public static string FunctionPrefix = "gl";
public static string ConstantPrefix = "GL_"; public static string ConstantPrefix = "GL_";
public static string EnumPrefix = ""; public static string EnumPrefix = "";
public static string NamespaceSeparator = ".";
public static string ImportsFile = "Core.cs"; public static string ImportsFile = "Core.cs";
public static string DelegatesFile = "Delegates.cs"; public static string DelegatesFile = "Delegates.cs";
@ -51,14 +52,14 @@ namespace Bind
{ {
return return
normalEnumsClassOverride == null ? normalEnumsClassOverride == null ?
String.IsNullOrEmpty(NestedEnumsClass) ? OutputClass : OutputClass + "." + NestedEnumsClass : String.IsNullOrEmpty(NestedEnumsClass) ? OutputClass : OutputClass + NamespaceSeparator + NestedEnumsClass :
normalEnumsClassOverride; normalEnumsClassOverride;
} }
} }
public static string AuxEnumsClass public static string AuxEnumsClass
{ {
get { return GLClass + "." + NestedEnumsClass; } get { return GLClass + NamespaceSeparator + NestedEnumsClass; }
} }
public static string EnumsOutput public static string EnumsOutput
@ -66,9 +67,9 @@ namespace Bind
get get
{ {
if ((Compatibility & Legacy.NestedEnums) != Legacy.None) if ((Compatibility & Legacy.NestedEnums) != Legacy.None)
return OutputNamespace + "." + OutputClass + "." + NestedEnumsClass; return OutputNamespace + NamespaceSeparator + OutputClass + NamespaceSeparator + NestedEnumsClass;
else else
return String.IsNullOrEmpty(EnumsNamespace) ? OutputNamespace : OutputNamespace + "." + EnumsNamespace; return String.IsNullOrEmpty(EnumsNamespace) ? OutputNamespace : OutputNamespace + NamespaceSeparator + EnumsNamespace;
} }
} }
@ -77,9 +78,9 @@ namespace Bind
get get
{ {
if ((Compatibility & Legacy.NestedEnums) != Legacy.None) if ((Compatibility & Legacy.NestedEnums) != Legacy.None)
return OutputNamespace + "." + GLClass + "." + NestedEnumsClass; return OutputNamespace + NamespaceSeparator + GLClass + NamespaceSeparator + NestedEnumsClass;
else else
return OutputNamespace + "." + EnumsNamespace; return OutputNamespace + NamespaceSeparator + EnumsNamespace;
} }
} }

View file

@ -265,7 +265,7 @@ namespace Bind.Structures
return ""; return "";
return String.Format("{0} = {1}((int){2}{3})", return String.Format("{0} = {1}((int){2}{3})",
Name, Unchecked ? "unchecked" : "", Name, Unchecked ? "unchecked" : "",
!String.IsNullOrEmpty(Reference) ? Reference + "." : "", Value); !String.IsNullOrEmpty(Reference) ? Reference + Settings.NamespaceSeparator : "", Value);
//return String.Format("{0} = {1}((int){2})", Name, Unchecked ? "unchecked" : "", Value); //return String.Format("{0} = {1}((int){2})", Name, Unchecked ? "unchecked" : "", Value);
} }

View file

@ -259,7 +259,7 @@ namespace Bind.Structures
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(Settings.DelegatesClass); sb.Append(Settings.DelegatesClass);
sb.Append("."); sb.Append(Settings.NamespaceSeparator);
sb.Append(Settings.FunctionPrefix); sb.Append(Settings.FunctionPrefix);
sb.Append(Name); sb.Append(Name);
sb.Append(Parameters.CallString()); sb.Append(Parameters.CallString());

View file

@ -58,7 +58,7 @@ namespace Bind.Structures
get get
{ {
if (!String.IsNullOrEmpty(CurrentQualifier)) if (!String.IsNullOrEmpty(CurrentQualifier))
return String.Format("{0}.{1}", CurrentQualifier, CurrentType); return String.Format("{0}{1}{2}", CurrentQualifier, Settings.NamespaceSeparator, CurrentType);
else else
return CurrentType; return CurrentType;
} }
@ -367,11 +367,13 @@ namespace Bind.Structures
// Better match: enum.Name == function.Category (e.g. GL_VERSION_1_1 etc) // Better match: enum.Name == function.Category (e.g. GL_VERSION_1_1 etc)
if (enums.ContainsKey(category)) if (enums.ContainsKey(category))
{ {
QualifiedType = String.Format("{0}.{1}", Settings.EnumsOutput, EnumProcessor.TranslateEnumName(category)); QualifiedType = String.Format("{0}{1}{2}", Settings.EnumsOutput,
Settings.NamespaceSeparator, EnumProcessor.TranslateEnumName(category));
} }
else else
{ {
QualifiedType = String.Format("{0}.{1}", Settings.EnumsOutput, Settings.CompleteEnumName); QualifiedType = String.Format("{0}{1}{2}", Settings.EnumsOutput,
Settings.NamespaceSeparator, Settings.CompleteEnumName);
} }
} }
} }