public static string GetType(CsUsingNamespaceDirective pDirective) { if (pDirective.namespace_or_type_name == null) { return(""); } //pDirective.namespace_or_type_entity.name string ret = GetType(pDirective.namespace_or_type_name); if (!string.IsNullOrEmpty(ret)) { ret += "."; } return(ret); //+pDirective.namespace_or_type_entity.name; //pDirective.namespace_or_type_name.identifier.identifier; }
public static string GetType(CsNamespaceOrTypeName pDirective) { string g = ""; //generics if (pDirective.type_argument_list != null && pDirective.type_argument_list.list.Count != 0) { g += "<"; foreach (CsTypeRef typeRef in pDirective.type_argument_list.list) { g += GetType(typeRef); g += ", "; } g = g.TrimEnd(_paramTrim) + ">"; } string ret = ""; if (pDirective.namespace_or_type_name == null) { if (pDirective.parent is CsTypeRef) { CsTypeRef parent = ((CsTypeRef)pDirective.parent); if (parent.entity_typeref.u is CsEntityClass) { if (IsClassDefinedAsObject(((CsEntityClass)parent.entity_typeref.u).attributes)) { return("object"); } return(((CsEntityClass)parent.entity_typeref.u).name); } if (parent.entity_typeref.type == cs_entity_type.et_generic_param) { return("<" + pDirective.identifier.identifier + ">"); //return "*"; } if (parent.entity_typeref.u is CsEntityInstanceSpecifier) { //if (IsClassDefinedAsObject(((CsEntityInstanceSpecifier)parent.entity_typeref.u))) //return "Object"; } } else if (pDirective.parent is CsUsingNamespaceDirective) { CsUsingNamespaceDirective parent = (CsUsingNamespaceDirective)pDirective.parent; if (parent.namespace_or_type_entity != null) { ret = "." + parent.namespace_or_type_entity.name; CsEntityNamespace p = parent.namespace_or_type_entity.parent as CsEntityNamespace; while (p != null) { ret = "." + p.name + ret; p = p.parent as CsEntityNamespace; } ret = ret.TrimStart('.'); return(ret + g); } } } ret = GetType(pDirective.namespace_or_type_name); if (!string.IsNullOrEmpty(ret)) { ret += "."; } return(ret + pDirective.identifier.identifier + g); }
public static string GetType(CsUsingNamespaceDirective pDirective) { if (pDirective.namespace_or_type_name == null) { return ""; } //pDirective.namespace_or_type_entity.name string ret = GetType(pDirective.namespace_or_type_name); if (!string.IsNullOrEmpty(ret)) { ret += "."; } return ret; //+pDirective.namespace_or_type_entity.name; //pDirective.namespace_or_type_name.identifier.identifier; }