~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IReturnType.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections.Generic;
 
6
 
 
7
namespace ICSharpCode.SharpDevelop.Dom
 
8
{
 
9
        /// <summary>
 
10
        /// Interface for reference to types (classes).
 
11
        /// Such a reference can be direct (DefaultReturnType), lazy (SearchClassReturnType) or
 
12
        /// returns types that stand for special references (e.g. ArrayReturnType)
 
13
        /// </summary>
 
14
        public interface IReturnType : IEquatable<IReturnType>
 
15
        {
 
16
                /// <summary>
 
17
                /// Gets the fully qualified name of the class the return type is pointing to.
 
18
                /// </summary>
 
19
                /// <returns>
 
20
                /// "System.Int32" for int[]<br/>
 
21
                /// "System.Collections.Generic.List" for List&lt;string&gt;
 
22
                /// </returns>
 
23
                string FullyQualifiedName {
 
24
                        get;
 
25
                }
 
26
                
 
27
                /// <summary>
 
28
                /// Gets the short name of the class the return type is pointing to.
 
29
                /// </summary>
 
30
                /// <returns>
 
31
                /// "Int32" or "int" (depending how the return type was created) for int[]<br/>
 
32
                /// "List" for List&lt;string&gt;
 
33
                /// </returns>
 
34
                string Name {
 
35
                        get;
 
36
                }
 
37
                
 
38
                /// <summary>
 
39
                /// Gets the namespace of the class the return type is pointing to.
 
40
                /// </summary>
 
41
                /// <returns>
 
42
                /// "System" for int[]<br/>
 
43
                /// "System.Collections.Generic" for List&lt;string&gt;
 
44
                /// </returns>
 
45
                string Namespace {
 
46
                        get;
 
47
                }
 
48
                
 
49
                /// <summary>
 
50
                /// Gets the full dotnet name of the return type. The DotnetName is used for the
 
51
                /// documentation tags.
 
52
                /// </summary>
 
53
                /// <returns>
 
54
                /// "System.Int[]" for int[]<br/>
 
55
                /// "System.Collections.Generic.List{System.String}" for List&lt;string&gt;
 
56
                /// </returns>
 
57
                string DotNetName {
 
58
                        get;
 
59
                }
 
60
                
 
61
                /// <summary>
 
62
                /// Gets the number of type parameters the target class should have
 
63
                /// / the number of type arguments specified by this type reference.
 
64
                /// </summary>
 
65
                int TypeArgumentCount {
 
66
                        get;
 
67
                }
 
68
                
 
69
                /// <summary>
 
70
                /// Gets the underlying class of this return type. This method will return <c>null</c> for
 
71
                /// generic return types and types that cannot be resolved.
 
72
                /// </summary>
 
73
                IClass GetUnderlyingClass();
 
74
                
 
75
                /// <summary>
 
76
                /// Gets all methods that can be called on this return type.
 
77
                /// </summary>
 
78
                List<IMethod> GetMethods();
 
79
                
 
80
                /// <summary>
 
81
                /// Gets all properties that can be called on this return type.
 
82
                /// </summary>
 
83
                List<IProperty> GetProperties();
 
84
                
 
85
                /// <summary>
 
86
                /// Gets all fields that can be called on this return type.
 
87
                /// </summary>
 
88
                List<IField> GetFields();
 
89
                
 
90
                /// <summary>
 
91
                /// Gets all events that can be called on this return type.
 
92
                /// </summary>
 
93
                List<IEvent> GetEvents();
 
94
                
 
95
                
 
96
                /// <summary>
 
97
                /// Gets if the return type is a default type, i.e. no array, generic etc.
 
98
                /// </summary>
 
99
                /// <returns>
 
100
                /// True for SearchClassReturnType, GetClassReturnType and DefaultReturnType.<br/>
 
101
                /// False for ArrayReturnType, SpecificReturnType etc.
 
102
                /// </returns>
 
103
                bool IsDefaultReturnType { get; }
 
104
                
 
105
                /// <summary>
 
106
                /// Gets if the cast to the specified decorating return type would be valid.
 
107
                /// </summary>
 
108
                bool IsDecoratingReturnType<T>() where T : DecoratingReturnType;
 
109
                
 
110
                /// <summary>
 
111
                /// Casts this return type to the decorating return type specified as type parameter.
 
112
                /// This methods casts correctly even when the return type is wrapped by a ProxyReturnType.
 
113
                /// When the cast is invalid, <c>null</c> is returned.
 
114
                /// </summary>
 
115
                T CastToDecoratingReturnType<T>() where T : DecoratingReturnType;
 
116
                
 
117
                bool IsArrayReturnType { get; }
 
118
                ArrayReturnType CastToArrayReturnType();
 
119
                
 
120
                bool IsGenericReturnType { get; }
 
121
                GenericReturnType CastToGenericReturnType();
 
122
                
 
123
                bool IsConstructedReturnType { get; }
 
124
                ConstructedReturnType CastToConstructedReturnType();
 
125
                
 
126
                /// <summary>
 
127
                /// Gets whether the type is a reference type or value type.
 
128
                /// </summary>
 
129
                /// <returns>
 
130
                /// true, if the type is a reference type.
 
131
                /// false, if the type is a value type.
 
132
                /// null, if the type is not known (e.g. generic type argument or type not found)
 
133
                /// </returns>
 
134
                bool? IsReferenceType { get; }
 
135
                
 
136
                /// <summary>
 
137
                /// Gets an identical return type that binds directly to the underlying class, so
 
138
                /// that repeatedly calling methods does not cause repeated class lookups.
 
139
                /// The direct return type will always point to the old version of the class, so don't
 
140
                /// store direct return types!
 
141
                /// </summary>
 
142
                /// <returns>This method never returns null.</returns>
 
143
                IReturnType GetDirectReturnType();
 
144
        }
 
145
}