/// <summary> /// Finds a type (e.g. class, enum, typedef) as if it was used directly at a certain position in the code /// (i.e. from the type definition's perspective). See base method for more information. /// </summary> /// <param name="name">the name of the type. Can be fully qualified (i.e. with namespace and surrounding /// class).</param> /// <param name="raiseException">indicates whether an exception is to be thrown when the type can't /// be found. If this is <c>false</c>, an instance of <see cref="DefInternal"/> will be returned when /// the type couldn't be found.</param> public override T DetermineType <T>(string name, bool raiseException = true) { if (name.StartsWith(this.MetaDef.NativeNamespace + "::")) { name = name.Substring(name.IndexOf("::") + 2); return(Namespace.DetermineType <T>(name, raiseException)); } List <AbstractTypeDefinition> list = new List <AbstractTypeDefinition>(); foreach (AbstractTypeDefinition t in NestedTypes) { if (t is T && t.Name == name) { list.Add(t); } } if (list.Count == 0) { if (BaseClass != null) { T t = BaseClass.DetermineType <T>(name, false); if (!(t is DefInternal)) { return(t); } } if (SurroundingClass != null) { return(SurroundingClass.DetermineType <T>(name, raiseException)); } else { return(Namespace.DetermineType <T>(name, raiseException)); } } else if (list.Count > 1) { throw new Exception("Found more than one type"); } else { return((T)(object)list[0].ResolveType()); } }