Exemplo n.º 1
0
        private protected ObjCObjectType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
        {
            _baseType  = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.ObjCObjectBaseType));
            _interface = new Lazy <ObjCInterfaceDecl>(() => TranslationUnit.GetOrCreate <ObjCInterfaceDecl>(Handle.Declaration));

            _protocols = new Lazy <IReadOnlyList <ObjCProtocolDecl> >(() => {
                var numProtocols = unchecked ((int)Handle.NumObjCProtocolRefs);
                var protocols    = new List <ObjCProtocolDecl>(numProtocols);

                for (var i = 0; i < numProtocols; i++)
                {
                    var protocol = TranslationUnit.GetOrCreate <ObjCProtocolDecl>(Handle.GetObjCProtocolDecl(unchecked ((uint)i)));
                    protocols.Add(protocol);
                }

                return(protocols);
            });

            _superClassType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.UnderlyingType));
            _typeArgs       = new Lazy <IReadOnlyList <Type> >(() => {
                var numTypeArgs = unchecked ((int)Handle.NumObjCTypeArgs);
                var typeArgs    = new List <Type>(numTypeArgs);

                for (var i = 0; i < numTypeArgs; i++)
                {
                    var typeArg = TranslationUnit.GetOrCreate <Type>(Handle.GetObjCTypeArg(unchecked ((uint)i)));
                    typeArgs.Add(typeArg);
                }

                return(typeArgs);
            });
        }
Exemplo n.º 2
0
        protected Type(CXType handle, CXTypeKind expectedKind, CX_TypeClass expectedTypeClass)
        {
            if (handle.kind != expectedKind)
            {
                throw new ArgumentException(nameof(handle));
            }

            if ((handle.TypeClass == CX_TypeClass.CX_TypeClass_Invalid) || (handle.TypeClass != expectedTypeClass))
            {
                throw new ArgumentException(nameof(handle));
            }
            Handle = handle;

            _canonicalType   = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.CanonicalType));
            _translationUnit = new Lazy <TranslationUnit>(() => TranslationUnit.GetOrCreate((CXTranslationUnit)Handle.data[1]));
        }
Exemplo n.º 3
0
        protected Type(CXType handle, CXTypeKind expectedKind, CX_TypeClass expectedTypeClass)
        {
            if (handle.kind != expectedKind)
            {
                throw new ArgumentOutOfRangeException(nameof(handle));
            }

            if ((handle.TypeClass == CX_TypeClass.CX_TypeClass_Invalid) || (handle.TypeClass != expectedTypeClass))
            {
                throw new ArgumentOutOfRangeException(nameof(handle));
            }
            Handle = handle;

            _asString        = new Lazy <string>(() => Handle.Spelling.ToString());
            _canonicalType   = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.CanonicalType));
            _desugar         = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.Desugar));
            _kindSpelling    = new Lazy <string>(() => Handle.KindSpelling.ToString());
            _pointeeType     = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.PointeeType));
            _translationUnit = new Lazy <TranslationUnit>(() => TranslationUnit.GetOrCreate((CXTranslationUnit)Handle.data[1]));
        }
Exemplo n.º 4
0
 private protected FunctionType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _returnType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.ResultType));
 }
Exemplo n.º 5
0
 private protected UnaryTransformType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _baseType       = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.BaseType));
     _underlyingType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.UnderlyingType));
 }
Exemplo n.º 6
0
 private protected VectorType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _desugaredType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.Desugar()));
     _elementType   = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.ElementType));
 }
Exemplo n.º 7
0
 private protected TagType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _decl = new Lazy <TagDecl>(() => TranslationUnit.GetOrCreate <TagDecl>(Handle.Declaration));
 }
Exemplo n.º 8
0
 private protected ObjCObjectType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
 }
Exemplo n.º 9
0
 private protected ReferenceType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
 }
Exemplo n.º 10
0
 private protected ReferenceType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _pointeeType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.PointeeType));
 }
Exemplo n.º 11
0
 private protected DeducedType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
 }
Exemplo n.º 12
0
 private protected AdjustedType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _adjustedType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.AdjustedType));
     _originalType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.OriginalType));
 }
Exemplo n.º 13
0
 private protected MatrixType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _elementType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(handle.ElementType));
 }
Exemplo n.º 14
0
 private protected DeducedType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _deducedType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.DeducedType));
 }
Exemplo n.º 15
0
 private protected UnaryTransformType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
 }
Exemplo n.º 16
0
 private protected TypeWithKeyword(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
 }