Example #1
0
 public ShellCodeEvent AddEvent(string Name, string FullDelegateName, bool CreatePropertyStyleEvent,
                                object Location, vsCMAccess Access)
 {
     return
         (new ShellCodeEvent(_codeClass.AddEvent(Name, FullDelegateName, CreatePropertyStyleEvent, Location,
                                                 Access)));
 }
        /// <include file='doc\VsCodeDomParser.uex' path='docs/doc[@for="VsCodeDomParser.GetMemberAttributesFromVsAccess"]/*' />
        /// <devdoc>
        ///     Convert a vsCMAccess enum value into Attributes
        /// </devdoc>
        private MemberAttributes GetMemberAttributesFromVsAccess(vsCMAccess vsAccess)
        {
            // strip off with events.
            //
            if (provider.IsVB)
            {
                vsAccess &= (vsCMAccess)(~VsCodeDomParser.vsCMWithEvents);
            }

            switch (vsAccess)
            {
            case vsCMAccess.vsCMAccessPublic:
                return(MemberAttributes.Public);

            case vsCMAccess.vsCMAccessProtected:
                return(MemberAttributes.Family);

            case vsCMAccess.vsCMAccessPrivate:
                return(MemberAttributes.Private);

            case vsCMAccess.vsCMAccessProject:
                return(MemberAttributes.Assembly);

            case vsCMAccess.vsCMAccessProjectOrProtected:
                return(MemberAttributes.FamilyOrAssembly);

            default:
                Debug.Fail("Don't know how to convert vsCMAccess." + vsAccess.ToString());
                break;
            }
            return(MemberAttributes.Private);
        }
Example #3
0
        protected void Initialize(object bases, object interfaces, vsCMAccess access)
        {
            if (bases == System.Reflection.Missing.Value)
            {
                CodeObject.BaseTypes.Add(new CodeTypeReference("System.Object"));
            }
            else
            {
                object[] baseClasses = bases as object[];
                foreach (object baseCls in baseClasses)
                {
                    CodeObject.BaseTypes.Add(new CodeTypeReference(ObjectToClassName(baseCls)));
                }
            }

            if (interfaces != System.Reflection.Missing.Value)
            {
                object[] interfaceClasses = interfaces as object[];
                foreach (object baseCls in interfaceClasses)
                {
                    CodeObject.BaseTypes.Add(new CodeTypeReference(ObjectToClassName(baseCls)));
                }
            }

            CodeObject.Attributes = VSAccessToMemberAccess(access);
        }
Example #4
0
        /// <summary>
        /// Adds missing access modifiers
        /// </summary>
        /// <param name="codeElement">The CodeElement to add missing access modifiers too. Includes children.</param>
        private void AddMissingAccessModifiers(CodeElement codeElement)
        {
            if (codeElement.Kind != vsCMElement.vsCMElementInterface && CodeElementBlockTypes.ContainsKey(codeElement.Kind))
            {
                for (int i = 1; i <= codeElement.Children.Count; i++)
                {
                    CodeElement element = codeElement.Children.Item(i) as CodeElement;

                    if (element.Kind != vsCMElement.vsCMElementImportStmt && element.Kind != vsCMElement.vsCMElementInterface && CodeElementBlockTypes.ContainsKey(codeElement.Kind))
                    {
                        // Get the element's access through reflection rather than a massive switch.
                        vsCMAccess access = (vsCMAccess)CodeElementTypes[element.Kind].InvokeMember("Access", BindingFlags.GetProperty, null, element, null);

                        if (element.Kind == vsCMElement.vsCMElementClass || element.Kind == vsCMElement.vsCMElementStruct)
                        {
                            AddMissingAccessModifiers(element);
                        }

                        EditPoint start;
                        EditPoint end;
                        string    declaration;

                        if (element.Kind == vsCMElement.vsCMElementFunction)
                        {
                            // method, constructor, or finalizer
                            CodeFunction2 function = element as CodeFunction2;

                            // Finalizers don't have access modifiers, neither do static constructors
                            if (function.FunctionKind == vsCMFunction.vsCMFunctionDestructor || (function.FunctionKind == vsCMFunction.vsCMFunctionConstructor && function.IsShared))
                            {
                                continue;
                            }
                        }

                        if (element.Kind == vsCMElement.vsCMElementProperty || element.Kind == vsCMElement.vsCMElementVariable || element.Kind == vsCMElement.vsCMElementEvent)
                        {
                            CodeElements attributes = (CodeElements)CodeElementTypes[element.Kind].InvokeMember("Attributes", BindingFlags.GetProperty, null, element, null);

                            start = attributes.Count > 0 ? element.GetEndPoint(vsCMPart.vsCMPartAttributesWithDelimiter).CreateEditPoint() : element.StartPoint.CreateEditPoint();
                        }
                        else
                        {
                            start = element.GetStartPoint(vsCMPart.vsCMPartHeader).CreateEditPoint();
                        }

                        end = start.CreateEditPoint();
                        end.EndOfLine();
                        declaration = start.GetText(end);
                        if (!declaration.StartsWith(CodeAccessKeywords[access]) && !declaration.StartsWith("partial"))
                        {
                            object[] args = new object[1];
                            args.SetValue(access, 0);
                            CodeElementTypes[element.Kind].InvokeMember("Access", BindingFlags.SetProperty, null, element, args);
                        }

                        declaration = start.GetText(end);
                    }
                }
            }
        }
Example #5
0
 /// <summary>
 /// Creates the lua code function.
 /// </summary>
 /// <param name="dte">The DTE.</param>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="returnType">Type of the return.</param>
 /// <param name="access">The access.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static LuaCodeFunction CreateLuaCodeFunction(
     DTE dte, CodeElement parent, string name, LuaType returnType, vsCMAccess access,
     FunctionDeclaration function)
 {
     return(CreateLuaCodeFunction(dte, parent, name, returnType, access, vsCMFunction.vsCMFunctionFunction,
                                  function));
 }
 public ShellCodeStruct AddStruct(string Name, object Position, object Bases, object ImplementedInterfaces,
                                  vsCMAccess Access)
 {
     return
         (new ShellCodeStruct(
              _namespace.AddStruct(Name, Position, Bases, ImplementedInterfaces, Access) as CodeStruct2));
 }
 public ShellCodeClass AddClass(string Name, object Position, object Bases, object ImplementedInterfaces,
                                vsCMAccess Access)
 {
     return
         (new ShellCodeClass(
              _namespace.AddClass(Name, Position, Bases, ImplementedInterfaces, Access) as CodeClass2));
 }
Example #8
0
 public ShellCodeEvent AddEvent(string Name, string FullDelegateName, bool CreatePropertyStyleEvent,
                                object Position, vsCMAccess Access)
 {
     return
         (new ShellCodeEvent(_codeInterface.AddEvent(Name, FullDelegateName, CreatePropertyStyleEvent, Position,
                                                     Access)));
 }
Example #9
0
 public IShellCodeModelElement2 AddProperty(string GetterName, string PutterName, object Type, object Position,
                                            vsCMAccess Access, object Location)
 {
     return
         (ShellObjectFactory.CreateFromCodeElement(
              _codeInterface.AddProperty(GetterName, PutterName, Type, Position, Access, Location) as CodeElement));
 }
Example #10
0
 public ShellCodeMethod AddFunction(string Name, vsCMFunction Kind, object Type, object Position,
                                    vsCMAccess Access, object Location)
 {
     return
         (new ShellCodeMethod(
              _codeClass.AddFunction(Name, Kind, Type, Position, Access, Location) as CodeFunction2));
 }
Example #11
0
 protected string getMappedAccessString(vsCMAccess access)
 {
     if (accessMapping.ContainsKey(access))
     {
         return(accessMapping[access]);
     }
     return(string.Empty);
 }
        public void Access_PrivateFunction_ReturnsPrivate()
        {
            CreatePrivateFunction("Class1.MyFunction");

            vsCMAccess access = codeFunction.Access;

            Assert.AreEqual(vsCMAccess.vsCMAccessPrivate, access);
        }
        public void Access_PrivateVariable_ReturnsPrivate()
        {
            CreatePrivateVariable("MyVariable");

            vsCMAccess access = codeVariable.Access;

            Assert.AreEqual(vsCMAccess.vsCMAccessPrivate, access);
        }
Example #14
0
        public CodeDelegate AddDelegate(string Name, object Type, object Position, vsCMAccess Access)
        {
            CodeDomCodeDelegate res = new CodeDomCodeDelegate(DTE, this, Name, Type);

            AddItem <CodeTypeDelegate>(res.CodeObject, Position);

            return(res);
        }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuaCodeVariable"/> class.
 /// </summary>
 /// <param name="dte"></param>
 /// <param name="parentElement"></param>
 /// <param name="name"></param>
 /// <param name="type"></param>
 /// <param name="access"></param>
 /// <param name="variable"></param>
 public LuaCodeVariable(DTE dte, CodeElement parentElement, string name,
                        CodeTypeRef type, vsCMAccess access, Variable variable)
     : base(dte, name, variable)
 {
     parent = parentElement;
     Type   = ObjectToTypeRef(type);
     Access = access;
 }
Example #16
0
        public CodeEnum AddEnum(string Name, object Position, object Bases, vsCMAccess Access)
        {
            CodeDomCodeEnum ce = new CodeDomCodeEnum(DTE, this, Name, Bases, Access);

            AddItem <CodeTypeDeclaration>(ce.CodeObject, Position);

            return(ce);
        }
Example #17
0
        public CodeEnum AddEnum(string Name, object Position, object Bases, vsCMAccess Access)
        {
            CodeDomCodeEnum codeEnum = new CodeDomCodeEnum(DTE, this, Name, Bases, Access);

            CodeObject.Members.Insert(PositionToIndex(Position), codeEnum.CodeObject);
            CommitChanges();
            return(codeEnum);
        }
Example #18
0
        public void Access_PrivateDelegate_ReturnsPrivate()
        {
            CreatePrivateDelegate("MyDelegate");

            vsCMAccess access = codeDelegate.Access;

            Assert.AreEqual(vsCMAccess.vsCMAccessPrivate, access);
        }
Example #19
0
        /// <summary>
        /// Creates a new variable code construct and inserts the code in the correct location.
        /// </summary>
        /// <param name="Name">Required. The name of the new variable.</param>
        /// <param name="Type">Required. A vsCMTypeRef constant indicating the data type that the function returns. This can be a CodeTypeRef object, a vsCMTypeRef constant, or a fully qualified type name.</param>
        /// <param name="Position">Optional. Default = 0. The code element after which to add the new element. If the value is a CodeElement, then the new element is added immediately after it.
        ///
        /// If the value is a Long, then AddVariable indicates the element after which to add the new element.
        ///
        /// Because collections begin their count at 1, passing 0 indicates that the new element should be placed at the beginning of the collection. A value of -1 means the element should be placed at the end.
        /// </param>
        /// <param name="Access">Optional. A vsCMAccess constant.</param>
        /// <param name="Location">Optional. The path and file name for the new variable definition. Depending on the language, the file name is either relative or absolute to the project file. The file is added to the project if it is not already a project item. If the file cannot be created and added to the project, then AddVariable fails.</param>
        /// <returns></returns>
        public CodeVariable AddVariable(string Name, object Type, object Position, vsCMAccess Access, object Location)
        {
            CodeDomCodeVariable codeVar = new CodeDomCodeVariable(DTE, this, Name, ObjectToTypeRef(Type), Access);

            CodeObject.Members.Insert(PositionToIndex(Position), codeVar.CodeObject);
            CommitChanges();
            return(codeVar);
        }
Example #20
0
        public void Access_PrivateStruct_ReturnsPrivate()
        {
            CreatePrivateStruct("MyStruct");

            vsCMAccess access = codeStruct.Access;

            Assert.AreEqual(vsCMAccess.vsCMAccessPrivate, access);
        }
Example #21
0
        public CodeDelegate AddDelegate(string Name, object Type, object Position, vsCMAccess Access)
        {
            CodeDomCodeDelegate codeDelegate = new CodeDomCodeDelegate(DTE, this, Name, Type);

            CodeObject.Members.Insert(PositionToIndex(Position), codeDelegate.CodeObject);
            CommitChanges();
            return(codeDelegate);
        }
Example #22
0
        /// <summary>
        /// Adds a function to the top-level CodeElement.
        /// </summary>
        /// <param name="objectName">Name of the object.</param>
        /// <param name="objectKind">Kind of the object.</param>
        /// <param name="returnType">Type of the return.</param>
        /// <param name="function">The function.</param>
        /// <param name="access">The access.</param>
        /// <returns></returns>
        public CodeFunction AddFunction(string objectName, vsCMFunction objectKind, object returnType, object function,
                                        vsCMAccess access)
        {
            CodeFunction codeFunction = AddFunction(objectName, returnType as LuaDeclaredType,
                                                    function as FunctionDeclaration);

            codeFunction.Access = access;
            return(codeFunction);
        }
Example #23
0
        public void Access_PrivateProperty_AccessIsPrivate()
        {
            helper.CreatePrivateProperty("MyProperty");
            CreateCodeProperty2();

            vsCMAccess access = property.Access;

            Assert.AreEqual(vsCMAccess.vsCMAccessPrivate, access);
        }
Example #24
0
        /// <summary>
        /// Creates the lua code variable table.
        /// </summary>
        /// <param name="dte">The DTE.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="access">The access.</param>
        /// <param name="variable">The variable.</param>
        /// <returns></returns>
        public static LuaCodeVariable CreateLuaCodeVariableTable(
            DTE dte, CodeElement parent, string name,
            LuaType type, vsCMAccess access, TableConstructor variable)
        {
            var result = new LuaCodeVariableTable(dte, parent, name,
                                                  access, variable);

            return(result);
        }
Example #25
0
        /// <summary>
        /// Adds a function to the Lua class.
        /// </summary>
        /// <param name="functionName"></param>
        /// <param name="kind"></param>
        /// <param name="returnType"></param>
        /// <param name="position"></param>
        /// <param name="functionAccess"></param>
        /// <param name="functionNode"></param>
        /// <returns></returns>
        public CodeFunction AddFunction(string functionName, vsCMFunction kind, object returnType, object position,
                                        vsCMAccess functionAccess, object functionNode)
        {
            var codeFunction = new LuaCodeFunction(
                DTE, this, functionName, kind, returnType, Access, functionNode as FunctionDeclaration);

            AddFunction(codeFunction);
            return(codeFunction);
        }
Example #26
0
        public void Access_PrivateClass_ReturnsPrivate()
        {
            CreateProjectContent();
            CreatePrivateClass("MyClass");

            vsCMAccess access = codeClass.Access;

            Assert.AreEqual(vsCMAccess.vsCMAccessPrivate, access);
        }
Example #27
0
        /// <summary>
        /// Creates the lua code function.
        /// </summary>
        /// <param name="dte">The DTE.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="name">The name.</param>
        /// <param name="returnType">Type of the return.</param>
        /// <param name="access">The access.</param>
        /// <param name="kind">The kind.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static LuaCodeFunction CreateLuaCodeFunction(
            DTE dte, CodeElement parent, string name, LuaType returnType, vsCMAccess access, vsCMFunction kind, FunctionDeclaration function)
        {
            var result = new LuaCodeFunction(dte, parent, name, kind,
                                             new LuaCodeTypeRef(dte, LuaDeclaredType.Find(returnType.ToString())),
                                             access, function);

            return(result);
        }
Example #28
0
        /// <summary>
        /// Creates the variable.
        /// </summary>
        /// <param name="dte">The DTE.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="access">The access.</param>
        /// <param name="variable">The variable.</param>
        /// <returns></returns>
        public static LuaCodeVariable CreateVariable(
            DTE dte, CodeElement parent, string name,
            LuaType type, vsCMAccess access, Variable variable)
        {
            var result = new LuaCodeVariable(dte, parent, name,
                                             new LuaCodeTypeRef(dte, LuaDeclaredType.Find(type.ToString())),
                                             access, variable);

            return(result);
        }
Example #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuaCodeVariableTable"/> class.
 /// </summary>
 /// <param name="dte"></param>
 /// <param name="parentElement"></param>
 /// <param name="name"></param>
 /// <param name="access"></param>
 /// <param name="variable"></param>
 public LuaCodeVariableTable(DTE dte, CodeElement parentElement, string name, vsCMAccess access,
     TableConstructor variable)
     : base(dte, parentElement, name, new LuaCodeTypeRef(
                                          dte, LuaDeclaredType.Table), access,
            new Variable(variable.Location) {Identifier = new Identifier(variable.Location)})
 {
     childObjects = new LuaCodeElements(dte, this);
     astNode = variable;
     parent = parentElement;
 }
Example #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuaCodeVariableTable"/> class.
 /// </summary>
 /// <param name="dte"></param>
 /// <param name="parentElement"></param>
 /// <param name="name"></param>
 /// <param name="access"></param>
 /// <param name="variable"></param>
 public LuaCodeVariableTable(DTE dte, CodeElement parentElement, string name, vsCMAccess access,
                             TableConstructor variable)
     : base(dte, parentElement, name, new LuaCodeTypeRef(
                dte, LuaDeclaredType.Table), access,
            new Variable(variable.Location) { Identifier = new Identifier(variable.Location) })
 {
     childObjects = new LuaCodeElements(dte, this);
     astNode      = variable;
     parent       = parentElement;
 }
Example #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuaCodeFunction"/> class.
 /// </summary>
 /// <param name="dte">The DTE.</param>
 /// <param name="parentElement">The parent element.</param>
 /// <param name="name">The name.</param>
 /// <param name="kind">The kind.</param>
 /// <param name="codeType">Type of the code.</param>
 /// <param name="access">The access.</param>
 /// <param name="function">The function.</param>
 public LuaCodeFunction(DTE dte, CodeElement parentElement, string name, vsCMFunction kind,
                        object codeType, vsCMAccess access, FunctionDeclaration function)
     : base(dte, name, function)
 {
     parent       = parentElement;
     FunctionBody = new LuaCodeElements(dte, this);
     parameters   = new LuaCodeElements(dte, this);
     FunctionType = kind;
     Access       = access;
     Type         = ObjectToTypeRef(codeType);
 }
        /// <summary>
        /// Adds a class to the <see cref="CodeNamespace"/> and supports adding a partial class.
        /// </summary>
        /// <param name="codeNamespace"><see cref="CodeNamespace"/> instance.</param>
        /// <param name="name">Name of the class.</param>
        /// <param name="baseName">Name of the base class. Null indicates no base class.</param>
        /// <param name="access">Class access.</param>
        /// <param name="classKind">Class kind.</param>
        /// <returns><see cref="CodeClass"/> instance.</returns>
        internal static CodeClass AddClassWithPartialSupport(this CodeNamespace codeNamespace, string name, string baseName, 
            vsCMAccess access, vsCMClassKind classKind)
        {
            // Workaround to support existing partial class, set name after.
            CodeClass codeClass = codeNamespace.AddClass(Resources.TempClassName, AppConstants.PLACE_AT_THE_END, baseName, null, access);

            (codeClass as CodeClass2).ClassKind = classKind;

            codeClass.Name = name;

            return codeClass;
        }
Example #33
0
 /// <summary>
 /// Gets the keyword for the specified access modifier.
 /// </summary>
 /// <param name="accessModifier">The access modifier.</param>
 /// <returns>The matching keyword, otherwise null.</returns>
 internal static string GetAccessModifierKeyword(vsCMAccess accessModifier)
 {
     switch (accessModifier)
     {
         case vsCMAccess.vsCMAccessPublic: return "public";
         case vsCMAccess.vsCMAccessProtected: return "protected";
         case vsCMAccess.vsCMAccessProject: return "internal";
         case vsCMAccess.vsCMAccessProjectOrProtected: return "protected internal";
         case vsCMAccess.vsCMAccessPrivate: return "private";
         default: return null;
     }
 }
Example #34
0
 public CodeDomCodeVariant(DTE dte, CodeElement parent, string name, object bases, object interfaces, vsCMAccess access)
     : base(dte, parent, name, bases, interfaces, access)
 {
 }
Example #35
0
		public CodeVariable AddVariable(string Name, object Location, object Type, object Position, vsCMAccess Access)
		{
			throw new Exception("The method or operation is not implemented.");
		}
Example #36
0
 /// <summary>
 /// Adds a class to the top-level (empty) namespace 
 /// </summary>
 /// <param name="objectName">The name of the class to add</param>
 /// <param name="Position">The position where the class should be added (1 based)</param>
 /// <param name="Bases">The bases the class dervies from</param>
 /// <param name="ImplementedInterfaces">the interfaces the class implements</param>
 /// <param name="Access">The classes protection level</param>
 public CodeClass AddClass(string objectName, object Position, object Bases, object ImplementedInterfaces,
     vsCMAccess Access)
 {
     throw new NotSupportedException("Lua does not support this feature.");
 }
Example #37
0
 /// <summary>
 /// Adds the struct.
 /// </summary>
 /// <param name="objectName">Name of the object.</param>
 /// <param name="position">The position.</param>
 /// <param name="bases">The bases.</param>
 /// <param name="implementedInterfaces">The implemented interfaces.</param>
 /// <param name="access">The access.</param>
 /// <returns></returns>
 public CodeStruct AddStruct(string objectName, object position, object bases, object implementedInterfaces, vsCMAccess access)
 {
     throw new NotSupportedException("Lua does not support this feature.");
 }
Example #38
0
		public CodeFunction AddFunction(string name, vsCMFunction kind, object type, object Position = null, vsCMAccess Access = vsCMAccess.vsCMAccessPublic)
		{
			var codeGenerator = new ClassCodeGenerator(Class);
			return codeGenerator.AddPublicMethod(name, (string)type);
		}
Example #39
0
		public CodeFunction AddFunction(string Name, object Location, vsCMFunction Kind, object Type, object Position, vsCMAccess Access)
		{
			throw new Exception("The method or operation is not implemented.");
		}
Example #40
0
        public CodeDelegate AddDelegate(string Name, object Type, object Position, vsCMAccess Access)
        {
            Initialize();

            InitTopNamespace();

            CodeDelegate cd = vsTopNamespace.AddDelegate(Name, Type, Position, Access);

            CommitChanges();

            return cd;
        }
 public CodeInterface AddInterface(string Name, object Location, object Position, object Bases, vsCMAccess Access)
 {
     throw new NotImplementedException();
 }
Example #42
0
        public CodeInterface AddInterface(string Name, object Position, object Bases, vsCMAccess Access)
        {
            Initialize();

            InitTopNamespace();

            CodeInterface ci = vsTopNamespace.AddInterface(Name, Position, Bases, Access);

            CommitChanges();

            return ci;
        }
Example #43
0
 /// <summary>
 /// Adds the delegate.
 /// </summary>
 /// <param name="objectName">Name of the object.</param>
 /// <param name="type">The type.</param>
 /// <param name="position">The position.</param>
 /// <param name="access">The access.</param>
 /// <returns></returns>
 public CodeDelegate AddDelegate(string objectName, object type, object position, vsCMAccess access)
 {
     throw new NotSupportedException("Lua does not support this feature.");
 }
 public CodeDelegate AddDelegate(string Name, object Location, object Type, object Position, vsCMAccess Access)
 {
     throw new NotImplementedException();
 }
 public CodeVariable AddVariable(string Name, object Location, object Type, object Position, vsCMAccess Access)
 {
     throw new NotImplementedException();
 }
 protected static TypeAttributes VSAccessToCodeAccess(vsCMAccess access)
 {
     switch (access) {
         case vsCMAccess.vsCMAccessAssemblyOrFamily: return TypeAttributes.NestedFamORAssem;
         case vsCMAccess.vsCMAccessDefault: return TypeAttributes.NotPublic;
         case vsCMAccess.vsCMAccessPrivate: return TypeAttributes.NotPublic;
         case vsCMAccess.vsCMAccessProject: return TypeAttributes.NestedFamANDAssem;
         case vsCMAccess.vsCMAccessProjectOrProtected: return TypeAttributes.NestedFamily;
         case vsCMAccess.vsCMAccessProtected: return TypeAttributes.NestedAssembly;
         case vsCMAccess.vsCMAccessPublic: return TypeAttributes.Public;
         case vsCMAccess.vsCMAccessWithEvents: return TypeAttributes.NestedPublic;
     }
     throw new NotImplementedException();
 }
 protected static MemberAttributes VSAccessToMemberAccess(vsCMAccess access)
 {
     switch (access) {
         case vsCMAccess.vsCMAccessAssemblyOrFamily: return MemberAttributes.FamilyOrAssembly;
         case vsCMAccess.vsCMAccessPrivate: return MemberAttributes.Private;
         case vsCMAccess.vsCMAccessProject: return MemberAttributes.Assembly;
         case vsCMAccess.vsCMAccessProjectOrProtected: return MemberAttributes.FamilyOrAssembly;
         case vsCMAccess.vsCMAccessProtected: return MemberAttributes.Family;
         case vsCMAccess.vsCMAccessPublic: return MemberAttributes.Public;
         case vsCMAccess.vsCMAccessDefault:
         case vsCMAccess.vsCMAccessWithEvents:
         default:
             return (MemberAttributes)0;
     }
 }
Example #48
0
        public CodeStruct AddStruct(string Name, object Position, object Bases, object ImplementedInterfaces, vsCMAccess Access)
        {
            Initialize();

            InitTopNamespace();

            CodeStruct cs = vsTopNamespace.AddStruct(Name, Position, Bases, ImplementedInterfaces, Access);

            CommitChanges();

            return cs;
        }
Example #49
0
		public CodeStruct AddStruct(string Name, object Location, object Position, object Bases, object ImplementedInterfaces, vsCMAccess Access)
		{
			throw new Exception("The method or operation is not implemented.");
		}
Example #50
0
 public ShellCodeMethod AddFunction(string Name, vsCMFunction Kind, object Type, object Position,
                                    vsCMAccess Access)
 {
     return new ShellCodeMethod(_codeInterface.AddFunction(Name, Kind, Type, Position, Access) as CodeFunction2);
 }
Example #51
0
 public ShellCodeEvent AddEvent(string Name, string FullDelegateName, bool CreatePropertyStyleEvent,
                                object Position, vsCMAccess Access)
 {
     return
         new ShellCodeEvent(_codeInterface.AddEvent(Name, FullDelegateName, CreatePropertyStyleEvent, Position,
                                                    Access));
 }
Example #52
0
 /// <summary>
 /// Adds the enum.
 /// </summary>
 /// <param name="objectName">Name of the object.</param>
 /// <param name="position">The position.</param>
 /// <param name="bases">The bases.</param>
 /// <param name="access">The access.</param>
 /// <returns></returns>
 public CodeEnum AddEnum(string objectName, object position, object bases, vsCMAccess access)
 {
     throw new NotSupportedException("Lua does not support this feature.");
 }
Example #53
0
 public IShellCodeModelElement2 AddProperty(string GetterName, string PutterName, object Type, object Position,
                                            vsCMAccess Access, object Location)
 {
     return
         ShellObjectFactory.CreateFromCodeElement(
             _codeInterface.AddProperty(GetterName, PutterName, Type, Position, Access, Location) as CodeElement);
 }
Example #54
0
        public CodeEnum AddEnum(string Name, object Position, object Bases, vsCMAccess Access)
        {
            Initialize();

            InitTopNamespace();

            CodeEnum ce = vsTopNamespace.AddEnum(Name, Position, Bases, Access);

            CommitChanges();

            return ce;
        }
        /// <summary>
        /// Determines if the access modifier is explicitly defined on the specified code element declaration.
        /// </summary>
        /// <param name="codeElementDeclaration">The code element declaration.</param>
        /// <param name="accessModifier">The access modifier.</param>
        /// <returns>True if access modifier is explicitly specified, otherwise false.</returns>
        private static bool IsAccessModifierExplicitlySpecifiedOnCodeElement(string codeElementDeclaration, vsCMAccess accessModifier)
        {
            string keyword = CodeElementHelper.GetAccessModifierKeyword(accessModifier);

            return IsKeywordSpecified(codeElementDeclaration, keyword);
        }
Example #56
0
 /// <summary>
 /// Adds a function to the top-level CodeElement.
 /// </summary>
 /// <param name="objectName">Name of the object.</param>
 /// <param name="objectKind">Kind of the object.</param>
 /// <param name="returnType">Type of the return.</param>
 /// <param name="function">The function.</param>
 /// <param name="access">The access.</param>
 /// <returns></returns>
 public CodeFunction AddFunction(string objectName, vsCMFunction objectKind, object returnType, object function,
     vsCMAccess access)
 {
     CodeFunction codeFunction = AddFunction(objectName, returnType as LuaDeclaredType,
                                             function as FunctionDeclaration);
     codeFunction.Access = access;
     return codeFunction;
 }
 public CodeEnum AddEnum(string Name, object Location, object Position, object Bases, vsCMAccess Access)
 {
     throw new NotImplementedException();
 }
Example #58
0
 /// <summary>
 /// Adds a variable to the top-level CodeElement.
 /// </summary>
 /// <param name="objectName">Name of the object.</param>
 /// <param name="variableType">Type of the variable.</param>
 /// <param name="variableNode">The variable node.</param>
 /// <param name="access">The access.</param>
 /// <returns></returns>
 public CodeVariable AddVariable(string objectName, object variableType, object variableNode, vsCMAccess access)
 {
     return RootElement.AddVariable(objectName, variableType, null, access, variableNode);
 }
 public CodeFunction AddFunction(string Name, object Location, vsCMFunction Kind, object Type, object Position, vsCMAccess Access)
 {
     throw new NotImplementedException();
 }
Example #60
0
        /// <summary>
        /// Adds a function to the top-level namespace.  Currently adding functions to namespaces doesn't do anything.
        /// </summary>
        public CodeFunction AddFunction(string Name, vsCMFunction Kind, object Type, object Position, vsCMAccess Access)
        {
            Initialize();

            InitTopNamespace();

            CodeFunction cf = vsTopNamespace.AddFunction(Name, Kind, Type, Position, Access);

            CommitChanges();

            return cf;
        }