Пример #1
0
        public Operation(XElement operation)
            : base(operation)
        {
            WebIDL          = operation.Element("webidl").Value.Trim();
            Name            = operation.Attribute("name").Value;
            CapitalizedName = char.ToUpper(Name[0]) + Name.Substring(1);
            IsRuntime       = HasExtendedAttribute("Runtime");
            IsPrivate       = HasExtendedAttribute("Private");
            IsUnsafe        = HasExtendedAttribute("Unsafe");
            DisableHooks    = HasExtendedAttribute("DisableHooks");
            RetType         = new IDLType(operation.Element("Type"));
            Args            = from a in Numbered(operation.Element("ArgumentList").Elements("Argument")) select new Argument(a.Item2, a.Item1);

            // Some sanity checks.
            if (IsRuntime && IsPrivate)
            {
                throw new ArgumentException(String.Format("Operation {0} cannot be both Runtime and Private", Name));
            }
            if (IsUnsafe && !IsPrivate)
            {
                throw new ArgumentException(String.Format("Operation {0} cannot be Unsafe unless it is Private", Name));
            }
            if (!IsPrivate && Args.Any(a => a.Type.ByRef || a.Type.IsPrivate))
            {
                throw new ArgumentException(String.Format("Operation {0} cannot have ByRef or Private arguments unless it is Private", Name));
            }
        }
Пример #2
0
 public Constant(XElement constant)
     : base(constant)
 {
     WebIDL          = constant.Element("webidl").Value.Trim();
     Name            = constant.Attribute("name").Value;
     CapitalizedName = char.ToUpper(Name[0]) + Name.Substring(1);
     Type            = new IDLType(constant.Element("Type"));
     Value           = constant.Attribute("value").Value;
 }
Пример #3
0
    public Constant(XElement constant)
      : base(constant)
    {
      WebIDL = constant.Element("webidl").Value.Trim();
      Name = constant.Attribute("name").Value;
			CapitalizedName = char.ToUpper(Name[0]) + Name.Substring(1);
      Type = new IDLType(constant.Element("Type"));
      Value = constant.Attribute("value").Value;
    }
Пример #4
0
 public bool Equals(IDLType other)
 {
     if (object.ReferenceEquals(other, null))
     {
         return(false);
     }
     else
     {
         return(IsPrimitive == other.IsPrimitive && Name == other.Name);
     }
 }
Пример #5
0
    public Operation(XElement operation)
      : base(operation)
    {
      WebIDL = operation.Element("webidl").Value.Trim();
      Name = operation.Attribute("name").Value;
			CapitalizedName = char.ToUpper(Name[0]) + Name.Substring(1);
      IsRuntime = HasExtendedAttribute("Runtime");
      IsPrivate = HasExtendedAttribute("Private");
      IsUnsafe = HasExtendedAttribute("Unsafe");
      DisableHooks = HasExtendedAttribute("DisableHooks");
      RetType = new IDLType(operation.Element("Type"));
      Args = from a in Numbered(operation.Element("ArgumentList").Elements("Argument")) select new Argument(a.Item2, a.Item1);

      // Some sanity checks.
      if (IsRuntime && IsPrivate) throw new ArgumentException(String.Format("Operation {0} cannot be both Runtime and Private", Name));
      if (IsUnsafe && !IsPrivate) throw new ArgumentException(String.Format("Operation {0} cannot be Unsafe unless it is Private", Name));
      if (!IsPrivate && Args.Any(a => a.Type.ByRef || a.Type.IsPrivate))
        throw new ArgumentException(String.Format("Operation {0} cannot have ByRef or Private arguments unless it is Private", Name));
    }
Пример #6
0
        public Attribute(XElement attribute)
            : base(attribute)
        {
            WebIDL          = attribute.Element("webidl").Value.Trim();
            Name            = attribute.Attribute("name").Value;
            CapitalizedName = char.ToUpper(Name[0]) + Name.Substring(1);
            GetterType      = new IDLType(attribute.Element("Type"));

            if (HasExtendedAttribute("Setter"))
            {
                SetterType = new IDLType(GetExtendedAttribute("Setter").Element("ArgumentList").Element("Argument").Element("Type"));
            }
            else
            {
                SetterType = GetterType;
            }

            IsReadOnly     = attribute.Attribute("readonly") != null;
            IsEventHandler = HasExtendedAttribute("EventHandler");
        }
Пример #7
0
 public JSDynamicType(IDLType type) : base(type) { }
Пример #8
0
 public JSArgType(IDLType type) : base(type) { }
Пример #9
0
 public SimpleConvertedType(IDLType type) : base(type) { }
Пример #10
0
 public ConvertedType(IDLType type) { Base = type; }
Пример #11
0
 public CSType(IDLType type) : base(type) { }
Пример #12
0
 public bool Equals(IDLType other)
 {
   if (object.ReferenceEquals(other, null)) return false;
   else                                     return IsPrimitive == other.IsPrimitive && Name == other.Name;
 }
Пример #13
0
 public Argument(XElement arg, int index)
   : base(arg)
 {
   Type = new IDLType(arg.Element("Type"), this);
   Index = index;
 }
Пример #14
0
 public Argument(XElement arg, int index)
     : base(arg)
 {
     Type  = new IDLType(arg.Element("Type"), this);
     Index = index;
 }
Пример #15
0
 public CSInternalArgType(IDLType type) : base(type) { }
Пример #16
0
 public CPPArgType(IDLType type) : base(type) { }
Пример #17
0
 public CPPRetType(IDLType type) : base(type) { }
Пример #18
0
 public MonoArgType(IDLType type) : base(type) { }