PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/NRefactory/ICSharpCode.NRefactory/TypeSystem/IProjectContent.cs

http://github.com/icsharpcode/ILSpy
C# | 159 lines | 32 code | 22 blank | 105 comment | 0 complexity | d80581344d183aabfab4a43faa97bc93 MD5 | raw file
  1// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team
  2// 
  3// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4// software and associated documentation files (the "Software"), to deal in the Software
  5// without restriction, including without limitation the rights to use, copy, modify, merge,
  6// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7// to whom the Software is furnished to do so, subject to the following conditions:
  8// 
  9// The above copyright notice and this permission notice shall be included in all copies or
 10// substantial portions of the Software.
 11// 
 12// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 13// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 14// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
 15// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 16// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 17// DEALINGS IN THE SOFTWARE.
 18
 19using System;
 20using System.Collections.Generic;
 21using System.Diagnostics.Contracts;
 22
 23namespace ICSharpCode.NRefactory.TypeSystem
 24{
 25	/// <summary>
 26	/// Represents an assembly consisting of source code (parsed files).
 27	/// </summary>
 28	public interface IProjectContent : IUnresolvedAssembly
 29	{
 30		/// <summary>
 31		/// Gets the path to the project file (e.g. .csproj).
 32		/// </summary>
 33		string ProjectFileName { get; }
 34		
 35		/// <summary>
 36		/// Gets a parsed file by its file name.
 37		/// </summary>
 38		IUnresolvedFile GetFile(string fileName);
 39		
 40		/// <summary>
 41		/// Gets the list of all files in the project content.
 42		/// </summary>
 43		IEnumerable<IUnresolvedFile> Files { get; }
 44		
 45		/// <summary>
 46		/// Gets the referenced assemblies.
 47		/// </summary>
 48		IEnumerable<IAssemblyReference> AssemblyReferences { get; }
 49		
 50		/// <summary>
 51		/// Gets the compiler settings object.
 52		/// The concrete type of the settings object depends on the programming language used to implement this project.
 53		/// </summary>
 54		object CompilerSettings { get; }
 55		
 56		/// <summary>
 57		/// Creates a new <see cref="ICompilation"/> that allows resolving within this project.
 58		/// </summary>
 59		/// <remarks>
 60		/// This method does not support <see cref="ProjectReference"/>s. When dealing with a solution
 61		/// containing multiple projects, consider using <see cref="ISolutionSnapshot.GetCompilation"/> instead.
 62		/// </remarks>
 63		ICompilation CreateCompilation();
 64		
 65		/// <summary>
 66		/// Creates a new <see cref="ICompilation"/> that allows resolving within this project.
 67		/// </summary>
 68		/// <param name="solutionSnapshot">The parent solution snapshot to use for the compilation.</param>
 69		/// <remarks>
 70		/// This method is intended to be called by ISolutionSnapshot implementations. Other code should
 71		/// call <see cref="ISolutionSnapshot.GetCompilation"/> instead.
 72		/// This method always creates a new compilation, even if the solution snapshot already contains
 73		/// one for this project.
 74		/// </remarks>
 75		ICompilation CreateCompilation(ISolutionSnapshot solutionSnapshot);
 76		
 77		/// <summary>
 78		/// Changes the assembly name of this project content.
 79		/// </summary>
 80		IProjectContent SetAssemblyName(string newAssemblyName);
 81
 82		/// <summary>
 83		/// Changes the project file name of this project content.
 84		/// </summary>
 85		IProjectContent SetProjectFileName(string newProjectFileName);
 86		
 87		/// <summary>
 88		/// Changes the path to the assembly location (the output path where the project compiles to).
 89		/// </summary>
 90		IProjectContent SetLocation(string newLocation);
 91
 92		/// <summary>
 93		/// Add assembly references to this project content.
 94		/// </summary>
 95		IProjectContent AddAssemblyReferences(IEnumerable<IAssemblyReference> references);
 96		
 97		/// <summary>
 98		/// Add assembly references to this project content.
 99		/// </summary>
100		IProjectContent AddAssemblyReferences(params IAssemblyReference[] references);
101		
102		/// <summary>
103		/// Removes assembly references from this project content.
104		/// </summary>
105		IProjectContent RemoveAssemblyReferences(IEnumerable<IAssemblyReference> references);
106		
107		/// <summary>
108		/// Removes assembly references from this project content.
109		/// </summary>
110		IProjectContent RemoveAssemblyReferences(params IAssemblyReference[] references);
111		
112		/// <summary>
113		/// Adds the specified files to the project content.
114		/// If a file with the same name already exists, updated the existing file.
115		/// </summary>
116		/// <remarks>
117		/// You can create an unresolved file by calling <c>ToTypeSystem()</c> on a syntax tree.
118		/// </remarks>
119		IProjectContent AddOrUpdateFiles(IEnumerable<IUnresolvedFile> newFiles);
120		
121		/// <summary>
122		/// Adds the specified files to the project content.
123		/// If a file with the same name already exists, this method updates the existing file.
124		/// </summary>
125		/// <remarks>
126		/// You can create an unresolved file by calling <c>ToTypeSystem()</c> on a syntax tree.
127		/// </remarks>
128		IProjectContent AddOrUpdateFiles(params IUnresolvedFile[] newFiles);
129		
130		/// <summary>
131		/// Removes the files with the specified names.
132		/// </summary>
133		IProjectContent RemoveFiles(IEnumerable<string> fileNames);
134		
135		/// <summary>
136		/// Removes the files with the specified names.
137		/// </summary>
138		IProjectContent RemoveFiles(params string[] fileNames);
139		
140		/// <summary>
141		/// Removes types and attributes from oldFile from the project, and adds those from newFile.
142		/// </summary>
143		[Obsolete("Use RemoveFiles()/AddOrUpdateFiles() instead")]
144		IProjectContent UpdateProjectContent(IUnresolvedFile oldFile, IUnresolvedFile newFile);
145		
146		/// <summary>
147		/// Removes types and attributes from oldFiles from the project, and adds those from newFiles.
148		/// </summary>
149		[Obsolete("Use RemoveFiles()/AddOrUpdateFiles() instead")]
150		IProjectContent UpdateProjectContent(IEnumerable<IUnresolvedFile> oldFiles, IEnumerable<IUnresolvedFile> newFiles);
151		
152		/// <summary>
153		/// Sets the compiler settings object.
154		/// The concrete type of the settings object depends on the programming language used to implement this project.
155		/// Using the incorrect type of settings object results in an <see cref="ArgumentException"/>.
156		/// </summary>
157		IProjectContent SetCompilerSettings(object compilerSettings);
158	}
159}