Example #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((StringProp != null ? StringProp.GetHashCode() : 0) * 397) ^ IntProp);
     }
 }
Example #2
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = (StringProp != null ? StringProp.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ LongProp.GetHashCode();
         hashCode = (hashCode * 397) ^ (RefProp != null ? RefProp.GetHashCode() : 0);
         return(hashCode);
     }
 }
Example #3
0
        public string AddString(string str)
        {
            if (!StringMap.TryGetValue(str, out var prop))
            {
                prop            = new StringProp();
                prop.ConstIndex = ++CurrConstIndex;

                StringMap.Add(str, prop);
            }
            return(GetConstName(prop.ConstIndex));
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (StringProp != null ? StringProp.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Int32Prop;
         hashCode = (hashCode * 397) ^ BoolProp.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableInt32PropNoValue.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableInt32PropHasValue.GetHashCode();
         hashCode = (hashCode * 397) ^ (Else != null ? Else.GetHashCode() : 0);
         return(hashCode);
     }
 }
Example #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (StringProp != null ? StringProp.GetHashCode() : 0);
         result = (result * 397) ^ IntProp;
         result = (result * 397) ^ DoubleProp.GetHashCode();
         result = (result * 397) ^ BoolProp.GetHashCode();
         result = (result * 397) ^ (ReadOnlyProp != null ? ReadOnlyProp.GetHashCode() : 0);
         result = (result * 397) ^ (WriteOnlyProp != null ? WriteOnlyProp.GetHashCode() : 0);
         result = (result * 397) ^ (IgnoreProp != null ? IgnoreProp.GetHashCode() : 0);
         result = (result * 397) ^ EnumProp.GetHashCode();
         result = (result * 397) ^ MappedProp;
         result = (result * 397) ^ Field?.GetHashCode() ?? 0;
         return(result);
     }
 }
Example #6
0
        private string StringToUnitName(string str)
        {
            StringProp prop = StringMap[str];

            if (prop.UnitIndex == 0)
            {
                prop.UnitIndex = CurrUnitIndex;
                CurrAccLength += str.Length;

                if (CurrAccLength > 3000)
                {
                    CurrAccLength = 0;
                    ++CurrUnitIndex;
                }
            }

            return(GetUnitName(prop.UnitIndex));
        }
Example #7
0
        private string GenStringCode(List <string> strList, uint strTypeID)
        {
            CodePrinter prt = new CodePrinter();

            foreach (string str in strList)
            {
                StringProp prop = StringMap[str];

                string strAry = StringToArrayOrRaw(str, out bool isRaw);

                prt.AppendFormatLine("// {0}", EscapeString(str));
                prt.AppendFormatLine("static const struct {{ cls_Object obj; int32_t len; {5} str[{0}]; }} {1} {{ {{{2}}}, {3}, {4} }};",
                                     str.Length + 1,
                                     GetConstName(prop.ConstIndex),
                                     strTypeID,
                                     str.Length,
                                     strAry,
                                     isRaw ? "char16_t" : "uint16_t");
            }
            return(prt.ToString());
        }