当前位置: 首页>>代码示例>>C#>>正文


C# Variant.IsVoid方法代码示例

本文整理汇总了C#中Kirikiri.Tjs2.Variant.IsVoid方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.IsVoid方法的具体用法?C# Variant.IsVoid怎么用?C# Variant.IsVoid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kirikiri.Tjs2.Variant的用法示例。


在下文中一共展示了Variant.IsVoid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VariantToExpressionString

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 public static string VariantToExpressionString(Variant val)
 {
     // convert given variant to string which can be interpret as an expression.
     // this function does not convert objects ( returns empty string )
     if (val.IsVoid())
     {
         return "void";
     }
     else
     {
         if (val.IsInteger())
         {
             return val.AsString();
         }
         else
         {
             if (val.IsReal())
             {
                 string s = Variant.RealToHexString(val.AsDouble());
                 return s + " /* " + val.AsString() + " */";
             }
             else
             {
                 if (val.IsString())
                 {
                     string s = LexBase.EscapeC(val.AsString());
                     return "\"" + s + "\"";
                 }
                 else
                 {
                     if (val.IsOctet())
                     {
                         string s = Variant.OctetToListString(val.AsOctet());
                         return "<%" + s + "%>";
                     }
                     else
                     {
                         return string.Empty;
                     }
                 }
             }
         }
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:45,代码来源:Utils.cs

示例2: VariantToReadableString

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 public static string VariantToReadableString(Variant val, int maxlen)
 {
     string ret = null;
     if (val == null || val.IsVoid())
     {
         ret = "(void)";
     }
     else
     {
         if (val.IsInteger())
         {
             ret = "(int)" + val.AsString();
         }
         else
         {
             if (val.IsReal())
             {
                 ret = "(real)" + val.AsString();
             }
             else
             {
                 if (val.IsString())
                 {
                     ret = "(string)\"" + LexBase.EscapeC(val.AsString()) + "\"";
                 }
                 else
                 {
                     if (val.IsOctet())
                     {
                         ret = "(octet)<% " + Variant.OctetToListString(val.AsOctet()) + " %>";
                     }
                     else
                     {
                         if (val.IsObject())
                         {
                             VariantClosure c = (VariantClosure)val.AsObjectClosure();
                             StringBuilder str = new StringBuilder(128);
                             str.Append("(object)");
                             str.Append('(');
                             if (c.mObject != null)
                             {
                                 str.Append('[');
                                 if (c.mObject is NativeClass)
                                 {
                                     str.Append(((NativeClass)c.mObject).GetClassName());
                                 }
                                 else
                                 {
                                     if (c.mObject is InterCodeObject)
                                     {
                                         str.Append(((InterCodeObject)c.mObject).GetName());
                                     }
                                     else
                                     {
                                         if (c.mObject is CustomObject)
                                         {
                                             string name = ((CustomObject)c.mObject).GetClassNames();
                                             if (name != null)
                                             {
                                                 str.Append(name);
                                             }
                                             else
                                             {
                                                 str.Append(c.mObject.GetType().FullName);
                                             }
                                         }
                                         else
                                         {
                                             str.Append(c.mObject.GetType().FullName);
                                         }
                                     }
                                 }
                                 str.Append(']');
                             }
                             else
                             {
                                 str.Append("0x00000000");
                             }
                             if (c.mObjThis != null)
                             {
                                 str.Append('[');
                                 if (c.mObjThis is NativeClass)
                                 {
                                     str.Append(((NativeClass)c.mObjThis).GetClassName());
                                 }
                                 else
                                 {
                                     if (c.mObjThis is InterCodeObject)
                                     {
                                         str.Append(((InterCodeObject)c.mObjThis).GetName());
                                     }
                                     else
                                     {
                                         if (c.mObjThis is CustomObject)
                                         {
                                             string name = ((CustomObject)c.mObjThis).GetClassNames();
                                             if (name != null)
                                             {
                                                 str.Append(name);
//.........这里部分代码省略.........
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:101,代码来源:Utils.cs

示例3: DefaultIsInstanceOf

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public static int DefaultIsInstanceOf(int flag, Variant targ, string name, Dispatch2
     objthis)
 {
     if (targ.IsVoid())
     {
         return Error.S_FALSE;
     }
     if ("Object".Equals(name))
     {
         return Error.S_TRUE;
     }
     if (targ.IsNumber())
     {
         if ("Number".Equals(name))
         {
             return Error.S_TRUE;
         }
         else
         {
             return Error.S_FALSE;
         }
     }
     else
     {
         if (targ.IsString())
         {
             if ("String".Equals(name))
             {
                 return Error.S_TRUE;
             }
             else
             {
                 return Error.S_FALSE;
             }
         }
         else
         {
             if (targ.IsOctet())
             {
                 if ("Octet".Equals(name))
                 {
                     return Error.S_TRUE;
                 }
                 else
                 {
                     return Error.S_FALSE;
                 }
             }
             else
             {
                 if (targ.IsObject())
                 {
                     VariantClosure tvclosure = targ.AsObjectClosure();
                     if (tvclosure.mObject != null)
                     {
                         // bypass
                         Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
                         return tvclosure.mObject.IsInstanceOf(flag, null, name, disp);
                     }
                     return Error.S_FALSE;
                 }
             }
         }
     }
     return Error.S_FALSE;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:68,代码来源:CustomObject.cs


注:本文中的Kirikiri.Tjs2.Variant.IsVoid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。