public CodeDomCodeVariable(DTE dte, CodeElement parent, string name, CodeTypeRef type, vsCMAccess access)
     : base(dte, name)
 {
     CodeObject                   = new CodeMemberField(CodeDomCodeTypeRef.ToCodeTypeReference(type), name);
     CodeObject.Attributes        = VSAccessToMemberAccess(access);
     CodeObject.UserData[CodeKey] = this;
     this.parent                  = parent;
 }
Ejemplo n.º 2
0
        public CodeElement AddBase(object Base, object Position)
        {
            string             clsName = ObjectToClassName(Base);
            CodeDomCodeTypeRef ctr     = new CodeDomCodeTypeRef(DTE, clsName);

            CodeObject.BaseTypes.Insert(PositionToBaseIndex(Position), ctr.CodeObject);
            return(ctr);
        }
Ejemplo n.º 3
0
        public CodeDomCodeParameter(DTE dte, CodeElement parent, string name, CodeTypeRef type)
            : base(dte, name)
        {
            this.parent = parent;
            this.type   = type;

            CodeObject = new CodeParameterDeclarationExpression(
                CodeDomCodeTypeRef.ToCodeTypeReference(type),
                name);
            CodeObject.UserData[CodeKey] = this;
        }
        public CodeDomCodeProperty(DTE dte, CodeClass parent, string name, string putName, object type, vsCMAccess access)
            : base(dte, name)
        {
            this.parent = parent;

            CodeMemberProperty prop = new CodeMemberProperty();

            prop.Name = name;
            prop.UserData[CodeKey] = this;
            CodeObject             = prop;

            prop.Type       = CodeDomCodeTypeRef.ToCodeTypeReference(ObjectToTypeRef(type));
            prop.Attributes = VSAccessToMemberAccess(access);
        }
        private CodeTypeRef GetSystemType(string typeName)
        {
            if (systemTypes == null)
            {
                systemTypes = new Dictionary <string, CodeTypeRef>();
            }

            CodeTypeRef res;

            if (systemTypes.TryGetValue(typeName, out res))
            {
                return(res);
            }

            res = new CodeDomCodeTypeRef(dte, typeName);
            systemTypes[typeName] = res;

            return(res);
        }
Ejemplo n.º 6
0
        public static CodeTypeReference ToCodeTypeReference(CodeTypeRef typeRef)
        {
            if (null == typeRef)
            {
                throw new ArgumentNullException("typeRef");
            }
            CodeDomCodeTypeRef cdTypeRef = typeRef as CodeDomCodeTypeRef;

            if (cdTypeRef != null)
            {
                return(cdTypeRef.CodeObject);
            }

            CodeTypeReference ctr = new CodeTypeReference();

            ctr.BaseType = typeRef.AsFullName;
            if (typeRef.Rank != 0)
            {
                ctr.ArrayRank        = typeRef.Rank;
                ctr.ArrayElementType = ToCodeTypeReference(typeRef.ElementType);
            }
            ctr.UserData[CodeKey] = cdTypeRef;
            return(ctr);
        }