當前位置: 首頁>>代碼示例>>C#>>正文


C# Class.getDeclaringClass方法代碼示例

本文整理匯總了C#中java.lang.Class.getDeclaringClass方法的典型用法代碼示例。如果您正苦於以下問題:C# Class.getDeclaringClass方法的具體用法?C# Class.getDeclaringClass怎麽用?C# Class.getDeclaringClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.lang.Class的用法示例。


在下文中一共展示了Class.getDeclaringClass方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: getCPPTypeName

 public static string getCPPTypeName(Class type)
 {
   if (type == ClassLiteral<Buffer>.Value || type == ClassLiteral<Pointer>.Value)
     return "void*";
   if (type == ClassLiteral<byte[]>.Value || type == ClassLiteral<ByteBuffer>.Value || type == ClassLiteral<BytePointer>.Value)
     return "signed char*";
   if (type == ClassLiteral<short[]>.Value || type == ClassLiteral<ShortBuffer>.Value || type == ClassLiteral<ShortPointer>.Value)
     return "short*";
   if (type == ClassLiteral<int[]>.Value || type == ClassLiteral<IntBuffer>.Value || type == ClassLiteral<IntPointer>.Value)
     return "int*";
   if (type == ClassLiteral<long[]>.Value || type == ClassLiteral<LongBuffer>.Value || type == ClassLiteral<LongPointer>.Value)
     return "jlong*";
   if (type == ClassLiteral<float[]>.Value || type == ClassLiteral<FloatBuffer>.Value || type == ClassLiteral<FloatPointer>.Value)
     return "float*";
   if (type == ClassLiteral<double[]>.Value || type == ClassLiteral<DoubleBuffer>.Value || type == ClassLiteral<DoublePointer>.Value)
     return "double*";
   if (type == ClassLiteral<char[]>.Value || type == ClassLiteral<CharBuffer>.Value || type == ClassLiteral<CharPointer>.Value)
     return "unsigned short*";
   if (type == ClassLiteral<PointerPointer>.Value)
     return "void**";
   if (type == ClassLiteral<String>.Value)
     return "const char*";
   if (type == Byte.TYPE)
     return "signed char";
   if (type == Character.TYPE)
     return "unsigned short";
   if (type == Long.TYPE)
     return "jlong";
   if (type == Boolean.TYPE)
     return "unsigned char";
   if (type.isPrimitive())
     return type.getName();
   else if (((Class) ClassLiteral<FunctionPointer>.Value).isAssignableFrom(type))
   {
     return new StringBuilder().append("JavaCPP_").append(Generator.mangle(type.getName())).append("*").toString();
   }
   else
   {
     string str1 = "";
     for (; type != null; type = type.getDeclaringClass())
     {
       Namespace @namespace = (Namespace) type.getAnnotation((Class) ClassLiteral<Namespace>.Value);
       string str2 = @namespace == null ? "" : @namespace.value();
       if (((Class) ClassLiteral<Pointer>.Value).isAssignableFrom(type))
       {
         Name name1 = (Name) type.getAnnotation((Class) ClassLiteral<Name>.Value);
         string str3;
         if (name1 == null)
         {
           string name2 = type.getName();
           str3 = String.instancehelper_substring(name2, String.instancehelper_lastIndexOf(name2, "$") + 1);
         }
         else
           str3 = name1.value();
         str2 = String.instancehelper_length(str2) != 0 ? new StringBuilder().append(str2).append("::").append(str3).toString() : str3;
       }
       if (String.instancehelper_length(str1) == 0)
         str1 = str2;
       else if (String.instancehelper_length(str2) > 0)
         str1 = new StringBuilder().append(str2).append("::").append(str1).toString();
     }
     return new StringBuilder().append(str1).append("*").toString();
   }
 }
開發者ID:NALSS,項目名稱:SmartDashboard.NET,代碼行數:64,代碼來源:Generator.cs


注:本文中的java.lang.Class.getDeclaringClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。