//
//
//
//
// $Revision$
//
using System;
using System.Collections;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
{
public interface IProjectContent : IDisposable
{
XmlDoc XmlDoc {
get;
}
///
/// Gets if the project content is representing the current version of the assembly.
/// This property always returns true for ParseProjectContents but might return false
/// for ReflectionProjectContent/CecilProjectContent if the file was changed.
///
bool IsUpToDate {
get;
}
ICollection Classes {
get;
}
///
/// Gets the list of namespaces defined in this project content. Does not include namespaces from
/// referenced project contents.
///
ICollection NamespaceNames {
get;
}
///
/// Gets the list of referenced project contents.
///
ICollection ReferencedContents {
get;
}
event EventHandler ReferencedContentsChanged;
///
/// Gets the properties of the language this project content was written in.
///
LanguageProperties Language {
get;
}
///
/// Gets the default imports of the project content. Can return null.
///
IUsing DefaultImports {
get;
}
///
/// Gets the project for this project content. Returns null for reflection project contents.
/// The type used for project objects depends on the host application.
///
object Project {
get;
}
///
/// Gets a class that allows to conveniently access commonly used types in the system
/// namespace.
///
SystemTypes SystemTypes {
get;
}
IList GetAssemblyAttributes();
string GetXmlDocumentation(string memberTag);
void AddClassToNamespaceList(IClass addClass);
void RemoveCompilationUnit(ICompilationUnit oldUnit);
void UpdateCompilationUnit(ICompilationUnit oldUnit, ICompilationUnit parserOutput, string fileName);
IClass GetClass(string typeName, int typeParameterCount);
bool NamespaceExists(string name);
ArrayList GetNamespaceContents(string nameSpace);
IClass GetClass(string typeName, int typeParameterCount, LanguageProperties language, bool lookInReferences);
bool NamespaceExists(string name, LanguageProperties language, bool lookInReferences);
///
/// Adds the contents of the specified to the .
///
void AddNamespaceContents(ArrayList list, string subNameSpace, LanguageProperties language, bool lookInReferences);
string SearchNamespace(string name, IClass curType, ICompilationUnit unit, int caretLine, int caretColumn);
SearchTypeResult SearchType(SearchTypeRequest request);
///
/// Gets the position of a member in this project content (not a referenced one).
///
/// The full member name in Reflection syntax (always case sensitive, ` for generics)
IEntity GetElement(string fullMemberName);
///
/// Gets the definition position of the class/member.
///
/// The full member name in Reflection syntax (always case sensitive, ` for generics)
FilePosition GetPosition(string fullMemberName);
}
public struct SearchTypeRequest
{
public readonly string Name;
public readonly int TypeParameterCount;
public readonly ICompilationUnit CurrentCompilationUnit;
public readonly IClass CurrentType;
public readonly int CaretLine;
public readonly int CaretColumn;
public SearchTypeRequest(string name, int typeParameterCount, IClass currentType, int caretLine, int caretColumn)
{
if (currentType == null)
throw new ArgumentNullException("currentType");
this.Name = name;
this.TypeParameterCount = typeParameterCount;
this.CurrentCompilationUnit = currentType.CompilationUnit;
this.CurrentType = currentType;
this.CaretLine = caretLine;
this.CaretColumn = caretColumn;
}
public SearchTypeRequest(string name, int typeParameterCount, IClass currentType, ICompilationUnit currentCompilationUnit, int caretLine, int caretColumn)
{
if (currentCompilationUnit == null)
throw new ArgumentNullException("currentCompilationUnit");
this.Name = name;
this.TypeParameterCount = typeParameterCount;
this.CurrentCompilationUnit = currentCompilationUnit;
this.CurrentType = currentType;
this.CaretLine = caretLine;
this.CaretColumn = caretColumn;
}
}
public struct SearchTypeResult
{
public static readonly SearchTypeResult Empty = new SearchTypeResult(null, null);
readonly IReturnType result;
readonly IUsing usedUsing;
public SearchTypeResult(IReturnType result) : this(result, null) {}
public SearchTypeResult(IClass c) : this(c != null ? c.DefaultReturnType : null) {}
public SearchTypeResult(IReturnType result, IUsing usedUsing)
{
this.result = result;
this.usedUsing = usedUsing;
}
public IReturnType Result {
get {
return result;
}
}
public IUsing UsedUsing {
get {
return usedUsing;
}
}
}
}