Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
    }
Ejemplo n.º 4
0
 public bool Equals(IDLType other)
 {
     if (object.ReferenceEquals(other, null))
     {
         return(false);
     }
     else
     {
         return(IsPrimitive == other.IsPrimitive && Name == other.Name);
     }
 }
Ejemplo n.º 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));
    }
Ejemplo n.º 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");
        }
Ejemplo n.º 7
0
 public JSDynamicType(IDLType type) : base(type) { }
Ejemplo n.º 8
0
 public JSArgType(IDLType type) : base(type) { }
Ejemplo n.º 9
0
 public SimpleConvertedType(IDLType type) : base(type) { }
Ejemplo n.º 10
0
 public ConvertedType(IDLType type) { Base = type; }
Ejemplo n.º 11
0
 public CSType(IDLType type) : base(type) { }
Ejemplo n.º 12
0
 public bool Equals(IDLType other)
 {
   if (object.ReferenceEquals(other, null)) return false;
   else                                     return IsPrimitive == other.IsPrimitive && Name == other.Name;
 }
Ejemplo n.º 13
0
 public Argument(XElement arg, int index)
   : base(arg)
 {
   Type = new IDLType(arg.Element("Type"), this);
   Index = index;
 }
Ejemplo n.º 14
0
 public Argument(XElement arg, int index)
     : base(arg)
 {
     Type  = new IDLType(arg.Element("Type"), this);
     Index = index;
 }
Ejemplo n.º 15
0
 public CSInternalArgType(IDLType type) : base(type) { }
Ejemplo n.º 16
0
 public CPPArgType(IDLType type) : base(type) { }
Ejemplo n.º 17
0
 public CPPRetType(IDLType type) : base(type) { }
Ejemplo n.º 18
0
 public MonoArgType(IDLType type) : base(type) { }