예제 #1
0
파일: Utilities.cs 프로젝트: noggs/opentk
        public static List <string> Keywords(GeneratorLanguage language)
        {
            switch (language)
            {
            case GeneratorLanguage.CSharp: return(CSharpKeywords);

            case GeneratorLanguage.Cpp: return(CppKeywords);

            case GeneratorLanguage.Java: return(JavaKeywords);

            default: throw new NotImplementedException();
            }
        }
예제 #2
0
 public static List<string> Keywords(GeneratorLanguage language)
 {
     switch (language)
     {
         case GeneratorLanguage.CSharp: return CSharpKeywords;
         case GeneratorLanguage.Cpp: return CppKeywords;
         case GeneratorLanguage.Java: return JavaKeywords;
         default: throw new NotImplementedException();
     }
 }
예제 #3
0
        public static String GenerateParsingCode(HmdType hmdType, String enumTypeReferenceName, GeneratorLanguage language, String variable)
        {
            if (language == GeneratorLanguage.CSharp)
            {
                switch (hmdType)
                {
                case HmdType.String:
                    return(variable);

                case HmdType.Boolean:
                    return(String.Format("Boolean.Parse({0})", variable));

                    /*
                     * case HmdType.Integer:
                     *  IntegerDumType integerDumType = (IntegerDumType)dumType;
                     *  if (integerHmdType.byteSize == 1)
                     *  {
                     *      return String.Format(integerHmdType.isUnsigned ? "Byte" : "SByte" + ".Parse({0})", variable);
                     *  }
                     *  if (integerHmdType.byteSize == 2)
                     *  {
                     *      return String.Format(integerHmdType.isUnsigned ? "UInt16" : "Int16" + ".Parse({0})", variable);
                     *  }
                     *  if (integerHmdType.byteSize == 4)
                     *  {
                     *      return String.Format(integerHmdType.isUnsigned ? "UInt32" : "Int32" + ".Parse({0})", variable);
                     *  }
                     *  if (integerHmdType.byteSize == 8)
                     *  {
                     *      return String.Format(integerHmdType.isUnsigned ? "UInt64" : "Int64" + ".Parse({0})", variable);
                     *  }
                     *  throw new FormatException(String.Format("The Integer byte size {0}, is not supported by C#", integerHmdType.byteSize));
                     * case HmdType.Decimal:
                     *  throw new NotImplementedException();
                     * case HmdType.Enumeration:
                     *  EnumDumType enumDumType = (EnumDumType)dumType;
                     *  return String.Format("({0})Enum.Parse(typeof({0}), {1})",enumHmdType.name, variable);
                     */
                }
                throw new FormatException(String.Format("Unhandled Dum Type Enum \"{0}\" ({1})", hmdType, (Int32)hmdType));
            }
            else
            {
                throw new ArgumentException(String.Format("Unrecognized GeneratorLanguage type \"{0}\"", language));
            }
        }