RawObject.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Tencent is pleased to support the open source community by making xLua available.
  3. * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
  4. * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  5. * http://opensource.org/licenses/MIT
  6. * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  7. */
  8. namespace XLua
  9. {
  10. public interface RawObject
  11. {
  12. object Target { get; }
  13. }
  14. }
  15. namespace XLua.Cast
  16. {
  17. public class Any<T> : RawObject
  18. {
  19. T mTarget;
  20. public Any(T i)
  21. {
  22. mTarget = i;
  23. }
  24. public object Target
  25. {
  26. get
  27. {
  28. return mTarget;
  29. }
  30. }
  31. }
  32. public class Byte : Any<byte>
  33. {
  34. public Byte(byte i) : base(i)
  35. {
  36. }
  37. }
  38. public class SByte : Any<sbyte>
  39. {
  40. public SByte(sbyte i) : base(i)
  41. {
  42. }
  43. }
  44. public class Char : Any<char>
  45. {
  46. public Char(char i) : base(i)
  47. {
  48. }
  49. }
  50. public class Int16 : Any<short>
  51. {
  52. public Int16(short i) : base(i)
  53. {
  54. }
  55. }
  56. public class UInt16 : Any<ushort>
  57. {
  58. public UInt16(ushort i) : base(i)
  59. {
  60. }
  61. }
  62. public class Int32 : Any<int>
  63. {
  64. public Int32(int i) : base(i)
  65. {
  66. }
  67. }
  68. public class UInt32 : Any<uint>
  69. {
  70. public UInt32(uint i) : base(i)
  71. {
  72. }
  73. }
  74. public class Int64 : Any<long>
  75. {
  76. public Int64(long i) : base(i)
  77. {
  78. }
  79. }
  80. public class UInt64 : Any<ulong>
  81. {
  82. public UInt64(ulong i) : base(i)
  83. {
  84. }
  85. }
  86. public class Float : Any<float>
  87. {
  88. public Float(float i) : base(i)
  89. {
  90. }
  91. }
  92. }