public string ToInterface(CgType cgType, string[] nsImports = null) { var splitFileContent = new StringBuilder(); if (nsImports != null && nsImports.Length > 0) { splitFileContent.AppendLine(string.Join(Environment.NewLine, nsImports)); } var accessMod = Settings.LangStyle.TransposeCgAccessModToString(CgAccessModifier.Public); splitFileContent.AppendLine($" {accessMod} interface {cgType.Name}"); splitFileContent.AppendLine(" " + C_OPEN_CURLY); foreach (var cg in cgType.Properties.Where(p => p.AccessModifier == CgAccessModifier.Public)) { splitFileContent.AppendLine($" {Settings.LangStyle.ToDecl(cg)}"); } foreach (var cg in cgType.Methods.Where(p => p.AccessModifier == CgAccessModifier.Public && !p.IsCtor)) { splitFileContent.AppendLine($" {Settings.LangStyle.ToDecl(cg)};"); } splitFileContent.AppendLine(" " + C_CLOSE_CURLY); return(splitFileContent.ToString()); }
public string ToClass(CgType cgType, CgAccessModifier cgClsAccess = CgAccessModifier.Public, CgClassModifier typeModifier = CgClassModifier.AsIs, string[] nsImports = null) { var splitFileContent = new StringBuilder(); if (nsImports != null && nsImports.Length > 0) { splitFileContent.AppendLine(string.Join(Environment.NewLine, nsImports)); } var otherModifer = typeModifier == CgClassModifier.AsIs ? string.Empty : string.Format(" {0}", Settings.LangStyle.TransposeCgClassModToString(typeModifier)); splitFileContent.AppendLine(" [Serializable]"); splitFileContent.AppendLine(string.Format(" {0}{1} class {2}", Settings.LangStyle.TransposeCgAccessModToString(cgClsAccess), otherModifer, cgType.Name)); splitFileContent.AppendLine(" " + C_OPEN_CURLY); foreach (var cg in cgType.Fields) { splitFileContent.AppendLine(string.Join(Environment.NewLine, cg.GetMyCgLines())); } foreach (var cg in cgType.Properties) { splitFileContent.AppendLine(string.Join(Environment.NewLine, cg.GetMyCgLines())); } foreach (var cg in cgType.Methods) { splitFileContent.AppendLine(string.Join(Environment.NewLine, cg.GetMyCgLines())); } splitFileContent.AppendLine(" " + C_CLOSE_CURLY); return(splitFileContent.ToString()); }
public string ToNamespaceDecl(CgType cgType) { var hasNs = !string.IsNullOrWhiteSpace(cgType.Namespace); var splitFileContent = new StringBuilder(); if (hasNs) { splitFileContent.AppendFormat("namespace {0}{1}", cgType.Namespace, Environment.NewLine); splitFileContent.AppendLine(C_OPEN_CURLY.ToString()); } return(splitFileContent.ToString()); }
private static extern CgAnnotation cgCreateTechniqueAnnotation(CgTechnique technique, [In]string name, CgType type);
private static extern CgType cgGetParentType(CgType type, int index);
public string ToClass(CgType cgType, CgAccessModifier cgClsAccess, CgClassModifier typeModifier, string[] nsImports) { var hasNs = !string.IsNullOrWhiteSpace(cgType.Namespace); var splitFileContent = new StringBuilder(); if (nsImports != null && nsImports.Length > 0) { splitFileContent.AppendLine(string.Join(Environment.NewLine, nsImports)); } if (hasNs) { splitFileContent.AppendFormat("namespace {0}{1}", cgType.Namespace, Environment.NewLine); splitFileContent.AppendLine(C_OPEN_CURLY.ToString()); } var otherModifer = typeModifier == CgClassModifier.AsIs ? string.Empty : string.Format(" {0}", Settings.LangStyle.TransposeCgClassModToString(typeModifier)); splitFileContent.AppendLine(" [Serializable]"); splitFileContent.AppendLine(string.Format(" {0}{1} class {2}", Settings.LangStyle.TransposeCgAccessModToString(cgClsAccess), otherModifer, cgType.Name)); splitFileContent.AppendLine(" " + C_OPEN_CURLY); foreach (var cg in cgType.Fields) splitFileContent.AppendLine(string.Join(Environment.NewLine, cg.GetMyCgLines())); foreach (var cg in cgType.Properties) splitFileContent.AppendLine(string.Join(Environment.NewLine, cg.GetMyCgLines())); foreach (var cg in cgType.Methods) splitFileContent.AppendLine(string.Join(Environment.NewLine, cg.GetMyCgLines())); splitFileContent.AppendLine(" " + C_CLOSE_CURLY); if (hasNs) splitFileContent.AppendLine(C_CLOSE_CURLY.ToString()); return splitFileContent.ToString(); }
/// <summary> /// <para>cgCreateProgramAnnotation adds a new annotation to a program.</para> /// <para>ERROR: CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle. CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this program. CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT, CG_FLOAT, CG_BOOL, or CG_STRING.</para> /// <para>VERSION: cgCreateProgramAnnotation was introduced in Cg 1.5.</para> /// </summary> /// <param name="program">The program to which the new annotation will be added.</param> /// <param name="name">The name of the new annotation.</param> /// <param name="type">The type of the new annotation.</param> /// <returns>Returns the new CGannotation handle on success. Returns NULL if an error occurs.</returns> public static CgAnnotation CreateProgramAnnotation(CgProgram program, [In]string name, CgType type) { return cgCreateProgramAnnotation(program, name, type); }
/// <summary> /// <para>cgCreateTechniqueAnnotation adds a new annotation to the technique.</para> /// <para>ERROR: CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique. CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this technique. CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT, CG_FLOAT, CG_BOOL, or CG_STRING.</para> /// <para>VERSION: cgCreateTechniqueAnnotation was introduced in Cg 1.5.</para> /// </summary> /// <param name="tech">The technique to which the new annotation will be added.</param> /// <param name="name">The name of the new annotation.</param> /// <param name="type">The type of the new annotation.</param> /// <returns>Returns the new CGannotation handle on success. Returns NULL if an error occurs.</returns> public static CgAnnotation CreateTechniqueAnnotation(CgTechnique tech, [In]string name, CgType type) { return cgCreateTechniqueAnnotation(tech, name, type); }
/// <summary> /// <para>cgCreateParameterAnnotation adds a new annotation to the specified param.</para> /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this param. CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT, CG_FLOAT, CG_BOOL, or CG_STRING.</para> /// <para>VERSION: cgCreateParameterAnnotation was introduced in Cg 1.5.</para> /// </summary> /// <param name="parm">The param to which the new annotation will be added.</param> /// <param name="name">The name of the new annotation.</param> /// <param name="type">The type of the new annotation.</param> /// <returns>Returns the new CGannotation handle on success. Returns NULL if an error occurs.</returns> public static CgAnnotation CreateParameterAnnotation(CgParameter param, [In]string name, CgType type) { return cgCreateParameterAnnotation(param, name, type); }
/// <summary> /// <para>cgCreateParameterMultiDimArray creates context level shared multi-dimensional param arrays.</para> /// <para>These parameters are primarily used by connecting them to one or more program param arrays with cgConnectParameter.</para> /// <para>ERROR: CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context. CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.</para> /// <para>VERSION: cgCreateParameterMultiDimArray was introduced in Cg 1.2.</para> /// </summary> /// <param name="context">The context to which the new param will be added.</param> /// <param name="type">The type of the new param.</param> /// <param name="dim">The dimension of the multi-dimensional array.</param> /// <param name="lengths">An array of length values, one for each dimension of the array to be created.</param> /// <returns>Returns the handle to the new param array.</returns> public static CgParameter CreateParameterMultiDimArray(CgContext context, CgType type, int dim, [In]int[] lengths) { return cgCreateParameterMultiDimArray(context, type, dim, lengths); }
/// <summary> /// <para>cgCreateEffectAnnotation adds a new annotation to the effect.</para> /// <para>ERROR: CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect. CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this effect. CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT, CG_FLOAT, CG_BOOL, or CG_STRING.</para> /// <para>VERSION: cgCreateEffectAnnotation was introduced in Cg 1.5.</para> /// </summary> /// <param name="effect">The effect to which the new annotation will be added.</param> /// <param name="name">The name of the new annotation.</param> /// <param name="type">The type of the new annotation.</param> /// <returns>Returns the new CGannotation handle on success. Returns NULL if an error occurs.</returns> public static CgAnnotation CreateEffectAnnotation(CgEffect effect, [In]string name, CgType type) { return cgCreateEffectAnnotation(effect, name, type); }
/// <summary> /// <para>cgCreateEffectParameter adds a new param to the specified effect.</para> /// <para>ERROR: CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect. CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.</para> /// <para>VERSION: cgCreateEffectParameter was introduced in Cg 1.5.</para> /// </summary> /// <param name="effect">The effect to which the new param will be added.</param> /// <param name="name">The name of the new param.</param> /// <param name="type">The type of the new param.</param> /// <returns>Returns the handle to the new param.</returns> public static CgParameter CreateEffectParameter(CgEffect effect, [In]string name, CgType type) { return cgCreateEffectParameter(effect, name, type); }
/// <summary> /// <para>cgCreateArrayState adds a new array-typed state definition to context.</para> /// <para>Before a CgFX file is added to a context, all state assignments in the file must have previously been defined via a call to cgCreateState or cgCreateArrayState.</para> /// <para>ERROR: CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context. CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier, if type is not a simple scalar, vector, or matrix-type, or if nelements is not a positive number.</para> /// <para>VERSION: cgCreateArrayState was introduced in Cg 1.4.</para> /// </summary> /// <param name="context">The context in which to define the state.</param> /// <param name="name">The name of the new state.</param> /// <param name="type">The type of the new state.</param> /// <param name="nelements">The number of elements in the array.</param> /// <returns>Returns a handle to the newly created CGstate. Returns NULL if there is an error.</returns> public static CgState CreateArrayState(CgContext context, [In]string name, CgType type, int nelements) { return cgCreateArrayState(context, name, type, nelements); }
/// <summary> /// <para>cgGetParentType returns a parent type of type.</para> /// <para>ERROR: CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is outside the proper range.</para> /// <para>VERSION: cgGetParentType was introduced in Cg 1.2.</para> /// </summary> /// <param name="type">The child type.</param> /// <param name="index">The index of the parent type. index must be greater than or equal to 0 and less than the value returned by cgGetNumParentTypes.</param> /// <returns>Returns the number of parent types. Returns NULL if there are no parents. Returns CG_UNKNOWN_TYPE if type is a built-in type or an error is thrown.</returns> public static CgType GetParentType(CgType type, int index) { return cgGetParentType(type, index); }
/// <summary> /// <para>cgGetNumParentTypes returns the number of parents from which type inherits.</para> /// <para>VERSION: cgGetNumParentTypes was introduced in Cg 1.2.</para> /// </summary> /// <param name="type">The child type.</param> /// <returns>Returns the number of parent types. Returns 0 if there are no parents.</returns> public static int GetNumParentTypes(CgType type) { return cgGetNumParentTypes(type); }
/// <summary> /// <para>cgGetMatrixSize writes the number of rows and columns contained by the specified matrix type into nrows and ncols locations respectively.</para> /// <para>If type is not a matrix enumerant type, 0 is written as both the rows and columns size.</para> /// <para>VERSION: cgGetMatrixSize was introduced in Cg 1.5.</para> /// </summary> /// <param name="type">The type enumerant.</param> /// <param name="nrows">A pointer to the location where the number of rows that type has will be written.</param> /// <param name="ncols">A pointer to the location where the number of columns that type has will be written.</param> public static void GetMatrixSize(CgType type, out int nrows, out int ncols) { cgGetMatrixSize(type, out nrows, out ncols); }
private static extern CgState cgCreateArrayState(CgContext context, [In] string name, CgType type, int nelems);
/// <summary> /// <para>cgCreateEffectParameterMultiDimArray adds a new multidimensional array param to the specified effect.</para> /// <para>ERROR: CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect. CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.</para> /// <para>VERSION: cgCreateEffectParameterMultiDimArray was introduced in Cg 1.5.</para> /// </summary> /// <param name="effect">The effect to which the new param will be added.</param> /// <param name="name">The name of the new param.</param> /// <param name="type">The type of the new param.</param> /// <param name="dim">The dimension of the array.</param> /// <param name="lengths">The sizes for each dimension of the array.</param> /// <returns>Returns the handle of the new param on success. Returns NULL if an error occurs.</returns> public static CgParameter CreateEffectParameterMultiDimArray(CgEffect effect, [In]string name, CgType type, int dim, [In]int[] lengths) { return cgCreateEffectParameterMultiDimArray(effect, name, type, dim, lengths); }
/// <summary> /// <para>cgGetTypeBase returns the base (scalar) type associated with a type enumerant.</para> /// <para>For example, cgGetTypeBase(CG_FLOAT3x4) returns CG_FLOAT.</para> /// <para>The base type for a non-numeric type such as CG_STRING, CG_STRUCT, CG_SAMPLER2D, or user-defined types is simply the type itself.</para> /// <para>VERSION: cgGetTypeBase was introduced in Cg 1.5.</para> /// </summary> /// <param name="type">The type enumerant.</param> /// <returns>Returns the scalar base type of the enumerant type.</returns> public static CgType GetTypeBase(CgType type) { return cgGetTypeBase(type); }
/// <summary> /// <para>cgCreateParameter creates context level shared parameters.</para> /// <para>These parameters are primarily used by connecting them to one or more program parameters with cgConnectParameter.</para> /// <para>ERROR: CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid. CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.</para> /// <para>VERSION: cgCreateParameter was introduced in Cg 1.2.</para> /// </summary> /// <param name="context">The context to which the new param will be added.</param> /// <param name="type">The type of the new param.</param> /// <returns>Returns the handle to the new param.</returns> public static CgParameter CreateParameter(CgContext context, CgType type) { return cgCreateParameter(context, type); }
/// <summary> /// <para>cgGetTypeClass returns the param class associated with a type enumerant.</para> /// <para>For example, cgGetTypeClass(CG_FLOAT3x4) returns CG_PARAMETERCLASS_MATRIX while cgGetTypeClass(CG_HALF) returns CG_PARAMETERCLASS_SCALAR and cgGetTypeClass(CG_BOOL3) returns CG_PARAMETERCLASS_VECTOR.</para> /// <para>VERSION: cgGetTypeClass was introduced in Cg 1.5.</para> /// </summary> /// <param name="type">The type enumerant.</param> /// <returns>Returns the param class of the enumerant type. Possible return values are: CG_PARAMETERCLASS_UNKNOWN CG_PARAMETERCLASS_SCALAR CG_PARAMETERCLASS_VECTOR CG_PARAMETERCLASS_MATRIX CG_PARAMETERCLASS_STRUCT CG_PARAMETERCLASS_ARRAY CG_PARAMETERCLASS_SAMPLER CG_PARAMETERCLASS_OBJECT</returns> public static CgParameterClass GetTypeClass(CgType type) { return cgGetTypeClass(type); }
/// <summary> /// <para>cgCreateParameterArray creates context level shared param arrays.</para> /// <para>These parameters are primarily used by connecting them to one or more program param arrays with cgConnectParameter.</para> /// <para>ERROR: CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid. CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.</para> /// <para>VERSION: cgCreateParameterArray was introduced in Cg 1.2.</para> /// </summary> /// <param name="context">The context to which the new param will be added.</param> /// <param name="type">The type of the new param.</param> /// <param name="length">The length of the array being created.</param> /// <returns>Returns the handle to the new param array.</returns> public static CgParameter CreateParameterArray(CgContext context, CgType type, int length) { return cgCreateParameterArray(context, type, length); }
private static extern void cgGetMatrixSize(CgType type, out int nrows, out int ncols);
/// <summary> /// <para>cgCreatePassAnnotation adds a new annotation to a pass.</para> /// <para>ERROR: CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass. CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this pass. CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT, CG_FLOAT, CG_BOOL, or CG_STRING.</para> /// <para>VERSION: cgCreatePassAnnotation was introduced in Cg 1.5.</para> /// </summary> /// <param name="pass">The pass to which the new annotation will be added.</param> /// <param name="name">The name of the new annotation.</param> /// <param name="type">The type of the new annotation.</param> /// <returns>Returns the new CGannotation handle on success. Returns NULL if an error occurs.</returns> public static CgAnnotation CreatePassAnnotation(CgPass pass, [In]string name, CgType type) { return cgCreatePassAnnotation(pass, name, type); }
public string ToDecl(CgType cgType, string variableName, CgAccessModifier accessMod) { return(string.Format("{2} {0} {1} = new {0}();", cgType.FullName, variableName, TransposeCgAccessModToString(accessMod))); }
/// <summary> /// <para>cgCreateState adds a new state definition to the context.</para> /// <para>When a CgFX file is added to the context, all state assignments in the file must have already been defined via a call to cgCreateState or cgCreateArrayState.</para> /// <para>ERROR: CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context. CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier, or if type is not a simple scalar, vector, or matrix-type. Array-typed state should be created with cgCreateArrayState.</para> /// <para>VERSION: cgCreateState was introduced in Cg 1.4.</para> /// </summary> /// <param name="context">The context in which to define the new state.</param> /// <param name="name">The name of the new state.</param> /// <param name="type">The type of the new state.</param> /// <returns>Returns a handle to the newly created CGstate. Returns NULL if there is an error.</returns> public static CgState CreateState(CgContext context, [In]string name, CgType type) { return cgCreateState(context, name, type); }
public void TestContainsThisMember() { var args1 = new List <CgArg> { new CgArg { ArgName = "NameOne", ArgType = "TypeOne" }, new CgArg { ArgName = "NameTwo", ArgType = "TypeTwo" }, new CgArg { ArgName = "NameThree", ArgType = "TypeThree" } }; var args2 = new List <CgArg> { new CgArg { ArgName = "NameThree", ArgType = "TypeThree" }, new CgArg { ArgName = "NameTwo", ArgType = "TypeTwo" }, new CgArg { ArgName = "NameOne", ArgType = "TypeOne" } }; var cgOne = new CgMember() { Args = args1, HasGetter = true, HasSetter = true, TypeName = "MyCgMember", Name = "MyCgType" }; var cgTwo = new CgMember() { Args = args2, HasGetter = true, HasSetter = true, TypeName = "MyCgMember", Name = "MyCgType" }; var testSubject = new CgType(); testSubject.Methods.Add(cgOne); Assert.IsTrue(testSubject.ContainsThisMember(cgTwo)); testSubject = new CgType(); testSubject.Fields.Add(cgOne); Assert.IsTrue(testSubject.ContainsThisMember(cgTwo)); testSubject = new CgType(); testSubject.Events.Add(cgOne); Assert.IsTrue(testSubject.ContainsThisMember(cgTwo)); testSubject = new CgType(); testSubject.Properties.Add(cgOne); Assert.IsTrue(testSubject.ContainsThisMember(cgTwo)); }
/// <summary> /// <para>cgGetTypeSizes returns the number of rows and columns for enumerant type in the locations specified by nrows and ncols respectively.</para> /// <para>VERSION: cgGetTypeSizes was introduced in Cg 1.5.</para> /// </summary> /// <param name="type">The type enumerant.</param> /// <param name="nrows">The location where the number of rows will be written.</param> /// <param name="ncols">The location where the number of columns will be written.</param> /// <returns>Returns CG_TRUE if the type enumerant is for a matrix. Returns CG_FALSE otherwise.</returns> public static CgBool GetTypeSizes(CgType type, out int nrows, out int ncols) { return cgGetTypeSizes(type, out nrows, out ncols); }
private static extern int cgGetNumParentTypes(CgType type);
/// <summary> /// <para>cgGetTypeString returns the type name associated with a type enumerant.</para> /// <para>VERSION: cgGetTypeString was introduced in Cg 1.1.</para> /// </summary> /// <param name="type">The type enumerant.</param> /// <returns>Returns the type string of the enumerant type.</returns> public static string GetTypeString(CgType type) { return Marshal.PtrToStringAnsi(cgGetTypeString(type)); }
/// <summary> /// <para>cgCreateEffectParameterArray adds a new array param to the specificed effect.</para> /// <para>ERROR: CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect. CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.</para> /// <para>VERSION: cgCreateEffectParameterArray was introduced in Cg 1.5.</para> /// </summary> /// <param name="effect">The effect to which the new param will be added.</param> /// <param name="name">The name of the new param.</param> /// <param name="type">The type of the new param.</param> /// <param name="length">The size of the array.</param> /// <returns>Returns the handle to the new array param on success. Returns NULL if an error occurs.</returns> public static CgParameter CreateEffectParameterArray(CgEffect effect, [In]string name, CgType type, int length) { return cgCreateEffectParameterArray(effect, name, type, length); }
public void TestCgMemberCompare() { var testSubject = new CgMemberCompare(); Assert.AreEqual(0, testSubject.Compare(null, null)); var less = new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "ddl", ArgType = "System.Web.UI.WebControls.DropDownList" }, new CgArg { ArgName = "lookupMstrDescription", ArgType = "string" } }, Name = "less", TypeName = "void" }; var middle = new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "ddl", ArgType = "System.Web.UI.WebControls.DropDownList" }, new CgArg { ArgName = "lookupMstrDescription", ArgType = "string" }, new CgArg { ArgName = "Id", ArgType = "bool" } }, Name = "middle", TypeName = "void" }; var most = new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "ddl", ArgType = "System.Web.UI.WebControls.DropDownList" }, new CgArg { ArgName = "lookupMstrDescription", ArgType = "string" }, new CgArg { ArgName = "defaultValue", ArgType = "string" } }, Name = "most", TypeName = "void" }; var deadLast = new CgMember { Name = "deadLast", TypeName = "void" }; var myCgType = new CgType(); myCgType.Methods.AddRange(new List <CgMember>() { deadLast, middle, less, most }); foreach (var obj in myCgType.SortedMethods) { var cg = obj as CgMember; Console.WriteLine(string.Format("----{0}", cg.Name)); foreach (var arg in cg.Args) { Console.WriteLine(arg.ToString()); } } }
/// <summary> /// <para>cgIsInterfaceType returns CG_TRUE if type is an interface (not just a struct), CG_FALSE otherwise.</para> /// <para>VERSION: cgIsInterfaceType was introduced in Cg 1.2.</para> /// </summary> /// <param name="type">The type being evaluated.</param> /// <returns>Returns CG_TRUE if type is an interface (not just a struct). Returns CG_FALSE otherwise.</returns> public static CgBool IsInterfaceType(CgType type) { return cgIsInterfaceType(type); }
public void TestCgMemberCompareMany() { var myCgType = new CgType(); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "Page_Load", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "Sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "Page_PreRender", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "ddlEquipmentName_SelectedIndexChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "ddlEquipmentLocation_SelectedIndexChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "ddlLocationname_SelectedIndexChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "ddlTransferTo_SelectedIndexChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "ddlClinicId_SelectedIndexChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "ddlVendorName_SelectedIndexChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.Web.UI.WebControls.GridViewPageEventArgs" }, }, Name = "grdvAgencySearch_PageIndexChanging", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "grdvAgencySearch_PreRender", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.Web.UI.WebControls.GridViewCommandEventArgs" }, }, Name = "grdvAgencySearch_RowCommand", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.Web.UI.WebControls.GridViewSortEventArgs" }, }, Name = "grdvAgencySearch_Sorting", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnAgencySearch_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnAgencyReset_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnAgencyClose_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.Web.UI.WebControls.GridViewPageEventArgs" }, }, Name = "grdvSubConSearch_PageIndexChanging", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "grdvSubConSearch_PreRender", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.Web.UI.WebControls.GridViewCommandEventArgs" }, }, Name = "grdvSubConSearch_RowCommand", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.Web.UI.WebControls.GridViewSortEventArgs" }, }, Name = "grdvSubConSearch_Sorting", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnSubSearch_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnSubReset_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnSubClose_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnAdd_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "btnReset_Click", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "strClinicDetails", ArgType = "string" }, new CgArg { ArgName = "intSize", ArgType = "int" }, }, Name = "FormatTheTextIntoGridCell", TypeName = "string" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { }, Name = "LoadDropdownValues", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { }, Name = "getFilter", TypeName = "string" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sortExpr", ArgType = "string" }, }, Name = "MyAgencySortBind", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sortExpr", ArgType = "string" }, }, Name = "MySubConSortBind", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { }, Name = "PopulateAgencyList", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { }, Name = "PopulateSubConList", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { }, Name = "SetControlToolTip", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "rdoBilling_CheckedChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "rdoShipping_CheckedChanged", TypeName = "void" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "strSerialNumber", ArgType = "string" }, }, Name = "IsValidSerialNumbers", TypeName = "int" }); myCgType.Methods.Add(new CgMember { Args = new List <CgArg>() { new CgArg { ArgName = "sender", ArgType = "System.Object" }, new CgArg { ArgName = "e", ArgType = "System.EventArgs" }, }, Name = "txtSerialNo_TextChanged", TypeName = "void" }); var testResult = myCgType.SortedMethods; Assert.AreEqual(testResult.Count, myCgType.Methods.Count); foreach (var d in testResult) { Console.WriteLine(NoFuture.Gen.Settings.LangStyle.ToDecl(d)); } }
/// <summary> /// <para>cgIsParentType returns CG_TRUE if parent is a parent type of child.</para> /// <para>Otherwise CG_FALSE is returned.</para> /// <para>VERSION: cgIsParentType was introduced in Cg 1.2.</para> /// </summary> /// <param name="parent">The parent type.</param> /// <param name="child">The child type.</param> /// <returns>Returns CG_TRUE if parent is a parent type of child. Returns CG_FALSE otherwise.</returns> public static CgBool IsParentType(CgType parent, CgType child) { return cgIsParentType(parent, child); }
public string ToDecl(CgType cgType, string variableName, CgAccessModifier accessMod) { return string.Format("{2} {0} {1} = new {0}();", cgType.FullName, variableName, TransposeCgAccessModToString(accessMod)); }
private static extern CgState cgCreateState(CgContext context, [In] string name, CgType type);