public string GetTypeName(
            ICodeTranslationOptions

            options)
        {
            return(GetTypeName(options, false, new ITypeReference[0]));
        }
Beispiel #2
0
        /// <summary>
        /// Returns the type name of the <see cref="IType"/>.
        /// </summary>
        /// <param name="options">The code-dom generator options that direct the
        /// generation process.</param>
        /// <param name="commentStyle">Whether or not the type name is represented in
        /// comment style with the type-parameters expanded and encased in curly
        /// braces ('{' and '}').</param>
        /// <returns>A <see cref="System.String"/> which is a qualified name relative to the <see cref="IType"/>.</returns>
        public string GetTypeName(
            ICodeTranslationOptions

            options, bool commentStyle)
        {
            return(this.GetTypeName(options, commentStyle, this.FillInTypeParameters().ToArray()));
        }
        public string GetTypeName(
            ICodeTranslationOptions

            options, bool commentStyle)
        {
            return(GetTypeName(options, commentStyle, new ITypeReference[0]));
        }
Beispiel #4
0
        /// <summary>
        /// Returns the type name of the <see cref="IType"/>.
        /// </summary>
        /// <param name="options">The code-dom generator options that direct the
        /// generation process.</param>
        /// <param name="typeParameterValues">The series of <see cref="ITypeReference"/> instance
        /// implementations which relate to the generic-parameters of the <see cref="IType"/>.</param>
        /// <returns>A <see cref="System.String"/> which is a qualified name relative to the <see cref="IType"/>.</returns>
        public string GetTypeName(
            ICodeTranslationOptions

            options, ITypeReference[] typeParameterValues)
        {
            return(this.GetTypeName(options, false, typeParameterValues));
        }
Beispiel #5
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeConstructorParameters"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeConstructorParameters"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     foreach (IAttributeConstructorParameter iacp in this)
     {
         iacp.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #6
0
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (DefaultType != null)
     {
         result.Add(this.DefaultType);
     }
 }
Beispiel #7
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeDeclarations"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeDeclarations"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     foreach (IAttributeDeclaration iad in this)
     {
         iad.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #8
0
 public string GetTypeName(ICodeTranslationOptions options, bool commentStyle, ITypeReference[] typeParameterValues)
 {
     if (options.NameHandler.HandlesName(this))
     {
         return(options.NameHandler.HandleName(this));
     }
     else
     {
         return(this.Name);
     }
 }
Beispiel #9
0
 /// <summary>
 /// Performs a look-up on the <see cref="ExpressionCollection"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="ExpressionCollection"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     foreach (IExpression iexp in this)
     {
         iexp.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #10
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeConstructorParameter"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeConstructorParameter"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.value != null)
     {
         this.Value.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #11
0
 /// <summary>
 /// Creates a new <see cref="ProjectDependencyReport"/>
 /// with the <paramref name="target"/> element to
 /// begin profiling upon.
 /// </summary>
 /// <param name="target">The <see cref="ITypeReferenceable"/>
 /// object to start the profiling operation upon.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/>
 /// which determines the depth of scope of the profiling.</param>
 public ProjectDependencyReport(ITypeReferenceable target, ICodeTranslationOptions options, bool recurseReferences = false)
     : this()
 {
     this.recurseReferences = recurseReferences;
     this.initialized       = false;
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     this.target  = target;
     this.options = options;
 }
Beispiel #12
0
 /// <summary>
 /// Performs a look-up on the <see cref="NameSpaceDeclarations"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="NameSpaceDeclarations"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     foreach (INameSpaceDeclaration ti in this.Values)
     {
         if (options.AllowPartials)
         {
             if (this.targetDeclaration is ISegmentableDeclarationTarget)
             {
                 if (ti.ParentTarget == this.targetDeclaration)
                 {
                     ti.GatherTypeReferences(ref result, options);
                 }
             }
             else
             {
                 ti.GatherTypeReferences(ref result, options);
             }
             foreach (INameSpaceDeclaration insd in ti.Partials)
             {
                 if (this.targetDeclaration is ISegmentableDeclarationTarget)
                 {
                     if (insd.ParentTarget == this.targetDeclaration)
                     {
                         insd.GatherTypeReferences(ref result, options);
                     }
                 }
                 else
                 {
                     insd.GatherTypeReferences(ref result, options);
                 }
             }
         }
         else
         if (this.targetDeclaration is ISegmentableDeclarationTarget)
         {
             if (((ISegmentableDeclarationTarget)this.targetDeclaration).IsRoot)
             {
                 ti.GatherTypeReferences(ref result, options);
             }
         }
         else
         {
             ti.GatherTypeReferences(ref result, options);
         }
     }
 }
Beispiel #13
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeDeclaration"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeDeclaration"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.attributeType != null)
     {
         result.Add(this.AttributeType);
     }
     if (this.parameters != null)
     {
         this.parameters.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #14
0
 /// <summary>
 /// Performs a look-up on the <see cref="StatementBlock"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="StatementBlock"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.locals != null)
     {
         this.locals.GatherTypeReferences(ref result, options);
     }
     foreach (IStatement ist in this)
     {
         ist.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #15
0
 /// <summary>
 /// Performs a look-up on the <see cref="IntermediateProject"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="IntermediateProject"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (options.AllowPartials)
     {
         this.Classes.GatherTypeReferences(ref result, options);
         this.Delegates.GatherTypeReferences(ref result, options);
         this.Enumerators.GatherTypeReferences(ref result, options);
         this.Interfaces.GatherTypeReferences(ref result, options);
         this.Structures.GatherTypeReferences(ref result, options);
         this.NameSpaces.GatherTypeReferences(ref result, options);
         if (this.attributes != null)
         {
             if (this.Attributes.Count > 0)
             {
                 this.Attributes.GatherTypeReferences(ref result, options);
             }
         }
     }
     else
     {
         if (this.IsRoot)
         {
             this.Classes.GatherTypeReferences(ref result, options);
             this.Delegates.GatherTypeReferences(ref result, options);
             this.Enumerators.GatherTypeReferences(ref result, options);
             this.Interfaces.GatherTypeReferences(ref result, options);
             this.Structures.GatherTypeReferences(ref result, options);
             this.NameSpaces.GatherTypeReferences(ref result, options);
             if (this.attributes != null)
             {
                 if (this.Attributes.Count > 0)
                 {
                     this.Attributes.GatherTypeReferences(ref result, options);
                 }
             }
         }
     }
     if (this.resources != null)
     {
         this.resources.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #16
0
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.cases != null)
     {
         foreach (var @case in this.cases)
         {
             @case.GatherTypeReferences(ref result, options);
         }
     }
     if (this.statements != null)
     {
         this.Statements.GatherTypeReferences(ref result, options);
     }
 }
 public override string BuildCommentBody(ICodeTranslationOptions options)
 {
     if (options.BuildTrail != null)
     {
         foreach (IDeclarationTarget idt in options.BuildTrail)
         {
             if (idt == ((ReferenceExpression)Reference).referencePoint.ParentTarget)
             {
                 return(string.Format("<paramref name=\"{0}\"/>", ((ReferenceExpression)Reference).referencePoint.Name));
             }
         }
         return(string.Format("parameter {0} (out of scope)", ((ReferenceExpression)Reference).referencePoint.Name));
     }
     else
     {
         return(string.Format("<paramref name=\"{0}\"/>", ((ReferenceExpression)Reference).referencePoint.Name));
     }
 }
Beispiel #18
0
        public string ToString(ICodeTranslationOptions options)
        {
            if (options == null)
            {
                options = CodeGeneratorHelper.DefaultDomOptions;
            }
            if (this.ArrayElementType != null)
            {
                List <int> arrayRanks = new List <int>();

                ITypeReference arrayElementItem = this;
                while (arrayElementItem.ArrayElementType != null)
                {
                    arrayRanks.Add(arrayElementItem.ArrayRank);
                    arrayElementItem = arrayElementItem.ArrayElementType;
                }

                string[] arrayRankTexts = new string[arrayRanks.Count];
                for (int i = 0; i < arrayRankTexts.Length; i++)
                {
                    arrayRankTexts[i] = GetArrayRankText(arrayRanks[i]);
                }
                return(String.Format("{0}{1}", arrayElementItem.ToString(), String.Join("", arrayRankTexts)));
            }
            string pointer = string.Empty;

            for (int i = 0; i < this.pointerRank; i++)
            {
                pointer += "*";
            }
            string[] typeParamNames = new string[this.TypeParameters.Count];
            if (this.TypeParameters.Count > 0)
            {
                for (int i = 0; i < this.TypeParameters.Count; i++)
                {
                    typeParamNames[i] = TypeParameters[i].ToString();
                }
                return(String.Format("{0}<{1}>{2}{3}", this.typeInstance.GetTypeName(options), String.Join(",", typeParamNames), Nullable ? "?" : string.Empty, pointer));
            }
            else
            {
                return(string.Format("{0}{1}{2}", this.typeInstance.GetTypeName(options), Nullable ? "?" : string.Empty, pointer));
            }
        }
Beispiel #19
0
            internal static bool ImplementsNameCollideCheck(IDeclarationTarget source, string interfaceName, ICodeTranslationOptions options)
            {
                IDeclarationTarget idt = source;
                string             shortInterfaceName = interfaceName;

                if (shortInterfaceName.Contains("."))
                {
                    shortInterfaceName = shortInterfaceName.Substring(shortInterfaceName.LastIndexOf('.') + 1);
                }
                int  hitCount    = 0;
                bool autoResolve = options.AutoResolveReferences;

                if (autoResolve)
                {
                    options.AutoResolveReferences = false;
                }
                List <string> names = new List <string>();

                while (idt != null)
                {
                    if (idt is IInterfaceImplementableType)
                    {
                        IInterfaceImplementableType parent = (IInterfaceImplementableType)idt;
                        foreach (ITypeReference itr in parent.ImplementsList)
                        {
                            string shortCurrentName;
                            string currentName = itr.TypeInstance.GetTypeName(options);
                            if (currentName.Contains("."))
                            {
                                shortCurrentName = currentName.Substring(currentName.LastIndexOf('.') + 1);
                            }
                            else
                            {
                                shortCurrentName = currentName;
                            }
                            //Increment the hit count if the short name of the current
                            //interface equals that of the one requested.  And if the exact
                            //name hasn't been encountered yet.  If it hasn't then it's a valid match
                            //otherwise it's just the same exact one.
                            if (shortCurrentName == shortInterfaceName && !names.Contains(currentName))
                            {
                                hitCount++;
                            }
                            names.Add(currentName);
                        }
                    }
                    idt = idt.ParentTarget;
                }
                if (autoResolve)
                {
                    options.AutoResolveReferences = autoResolve;
                }
                return(hitCount > 1);
            }
Beispiel #20
0
 /// <summary>
 /// Performs a look-up on the <see cref="BinaryOperationExpression"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="BinaryOperationExpression"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.leftSide != null)
     {
         this.leftSide.GatherTypeReferences(ref result, options);
     }
     if (this.rightSide != null)
     {
         this.RightSide.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #21
0
 /// <summary>
 /// Performs a look-up on the <see cref="MethodInvokeExpression"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="MethodInvokeExpression"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.argumentExpressions != null)
     {
         this.ArgumentExpressions.GatherTypeReferences(ref result, options);
     }
     if (this.reference != null)
     {
         this.reference.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #22
0
 /// <summary>
 /// Performs a look-up on the <see cref="DeclaredType{TDom}"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="DeclaredType{TDom}"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.Attributes != null)
     {
         this.Attributes.GatherTypeReferences(ref result, options);
     }
 }
Beispiel #23
0
 /// <summary>
 /// Performs a look-up on the <see cref="PropertyMember"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="PropertyMember"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (this.HasGet && this.getPart != null)
     {
         this.GetPart.Statements.GatherTypeReferences(ref result, options);
         if (this.getPart.attributes != null && this.getPart.Attributes.Count > 0)
         {
             this.getPart.Attributes.GatherTypeReferences(ref result, options);
         }
     }
     if (this.HasSet && this.setPart != null)
     {
         this.setPart.Statements.GatherTypeReferences(ref result, options);
         if (this.setPart.attributes != null && this.setPart.Attributes.Count > 0)
         {
             this.setPart.Attributes.GatherTypeReferences(ref result, options);
         }
     }
 }
Beispiel #24
0
        /// <summary>
        /// Returns the type name of the <see cref="IType"/>.
        /// </summary>
        /// <param name="options">The code-dom generator options that direct the
        /// generation process.</param>
        /// <param name="commentStyle">Whether or not the type name is represented in
        /// comment style with the type-parameters expanded and encased in curly
        /// braces ('{' and '}').</param>
        /// <param name="typeParameterValues">The series of <see cref="ITypeReference"/> instance
        /// implementations which relate to the generic-parameters of the <see cref="IType"/>.</param>
        /// <returns>A <see cref="System.String"/> which is a qualified name relative to the <see cref="IType"/>.</returns>
        public string GetTypeName(ICodeTranslationOptions options, bool commentStyle, ITypeReference[] typeParameterValues)
        {
            INameSpaceDeclaration nsdType = GetNamespace();

            if (nsdType == null)
            {
                return(this.Name);
            }
            IList <IDeclarationTarget> hierarchy = GetDeclarationHierarchy(this);

            string[] typeArgNames = new string[0];
            string   tArgNames    = "";
            int      tpChainArgs  = 0;

            string[] names = new string[hierarchy.Count];
            for (int i = 0; i < hierarchy.Count; i++)
            {
                string currentName = null;
                if (options.NameHandler.HandlesName((IDeclaration)hierarchy[i]))
                {
                    currentName = options.NameHandler.HandleName((IDeclaration)hierarchy[i]);
                }
                else
                {
                    currentName = hierarchy[i].Name;
                }
                if (hierarchy[i] is IParameteredDeclaredType && ((IParameteredDeclaredType)hierarchy[i]).TypeParameters != null && ((IParameteredDeclaredType)hierarchy[i]).TypeParameters.Count > 0)
                {
                    IParameteredDeclaredType pdt = (IParameteredDeclaredType)hierarchy[i];
                    //string[] tpNam = new string[pdt.TypeParameters.Count];
                    if (!commentStyle)
                    {
                        currentName += string.Format("`{0}", pdt.TypeParameters.Count);
                    }
                    else
                    {
                        typeArgNames = new string[pdt.TypeParameters.Count];
                        for (int tpArgIndex = 0; tpArgIndex < pdt.TypeParameters.Count; tpArgIndex++)
                        {
                            typeArgNames[tpArgIndex] = ((ITypeParameterMember)pdt.TypeParameters.Values[tpArgIndex]).Name;
                        }
                        currentName += string.Format("{{{0}}}", String.Join(", ", typeArgNames));
                    }
                    if (!commentStyle)
                    {
                        tpChainArgs += pdt.TypeParameters.Count;
                    }
                }
                names[i] = currentName;
            }
            if ((!(commentStyle)) && (tpChainArgs == typeParameterValues.Length && tpChainArgs > 0))
            {
                typeArgNames = new string[tpChainArgs];
                for (int tpArgIndex = 0; tpArgIndex < typeParameterValues.Length; tpArgIndex++)
                {
                    if (((typeParameterValues[tpArgIndex].ResolutionOptions & TypeReferenceResolveOptions.FullType) == TypeReferenceResolveOptions.FullType) || ((typeParameterValues[tpArgIndex].ResolutionOptions & TypeReferenceResolveOptions.GlobalType) == TypeReferenceResolveOptions.GlobalType))
                    {
                        bool autoResolve = options.AutoResolveReferences;
                        if (autoResolve)
                        {
                            options.AutoResolveReferences = false;
                        }
                        typeArgNames[tpArgIndex] = typeParameterValues[tpArgIndex].TypeInstance.GetTypeName(options, typeParameterValues[tpArgIndex].TypeParameters.ToArray());
                        if (autoResolve)
                        {
                            options.AutoResolveReferences = autoResolve;
                        }
                    }
                    else
                    {
                        typeArgNames[tpArgIndex] = typeParameterValues[tpArgIndex].TypeInstance.GetTypeName(options, typeParameterValues[tpArgIndex].TypeParameters.ToArray());
                    }
                    typeArgNames[tpArgIndex] = string.Format("[{0}]", typeArgNames[tpArgIndex]);
                }
                tArgNames = String.Format("[{0}]", String.Join(",", typeArgNames));
            }

            if (options.CurrentNameSpace != null)
            {
                //The namespace the generator is 'in' contains the this's namespace.
                //Thus checking the imports list is un-necessary.
                if (options.CurrentNameSpace.FullName.Contains(String.Format("{0}.", nsdType.FullName)))
                {
                    return(String.Join("+", names));
                }
                if (options.AutoResolveReferences)
                {
                    if (!(options.ImportList.Contains(nsdType.Name)))
                    {
                        options.ImportList.Add(nsdType.FullName);
                    }
                    if (commentStyle)
                    {
                        return(String.Format("{0}{1}", String.Join(".", names), tArgNames));
                    }
                    return(String.Format("{0}{1}", String.Join("+", names), tArgNames));
                }
            }
            if (options.ImportList.Contains(nsdType.FullName) && options.AutoResolveReferences)
            {
                if (commentStyle)
                {
                    return(String.Join(".", names));
                }
                else
                {
                    return(String.Format("{0}{1}", String.Join("+", names), tArgNames));
                }
            }
            if (commentStyle)
            {
                return(string.Format("{0}.{1}", nsdType.FullName, String.Join(".", names)));
            }
            return(string.Format("{0}.{1}{2}", nsdType.FullName, String.Join("+", names), tArgNames));
        }
Beispiel #25
0
 public override string BuildCommentBody(ICodeTranslationOptions options)
 {
     return(_OIL._Core.BuildMemberReferenceComment(options, ((ReferenceExpression)this.Reference).referencePoint));
 }
Beispiel #26
0
 /// <summary>
 /// Performs a look-up on the <see cref="TypeParameterMember{TDom, TParent}"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="TypeParameterMember{TDom, TParent}"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (this.constraints != null)
     {
         foreach (ITypeReference itr in this.Constraints)
         {
             result.Add(itr);
         }
     }
 }
Beispiel #27
0
 /// <summary>
 /// Returns the type name of the <see cref="IType"/>.
 /// </summary>
 /// <param name="options">The code-dom generator options that direct the
 /// generation process.</param>
 /// <returns>A <see cref="System.String"/> which is a qualified name relative to the <see cref="IType"/>.</returns>
 public string GetTypeName(ICodeTranslationOptions options)
 {
     return(this.GetTypeName(options, false, this.FillInTypeParameters().ToArray()));
 }
Beispiel #28
0
 /// <summary>
 /// Performs a look-up on the <see cref="Statement{TDom}"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="Statement{TDom}"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public abstract void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options);
Beispiel #29
0
 /// <summary>
 /// Performs a look-up on the <see cref="StatementBlockLocalMember.ReferenceExpression"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="StatementBlockLocalMember.ReferenceExpression"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
 }
Beispiel #30
0
            public static string BuildMemberReferenceComment(ICodeTranslationOptions options, IMember member)
            {
                if (options == null)
                {
                    throw new ArgumentNullException("options");
                }
                string parentCref = ((IType)member.ParentTarget).GetTypeName(options, true);

                //If there is a build trail to go by, check to see what kind of scope
                //is available.  If the parent of the field is available, then referencing
                //field should be easier.
                if (options.BuildTrail != null)
                {
                    IDeclarationTarget idt = member.ParentTarget;
                    while (idt != null && !(idt is INameSpaceDeclaration))
                    {
                        idt = idt.ParentTarget;
                    }
                    INameSpaceDeclaration currentNameSpace = null;
                    bool importsContainsNameSpace          = false;
                    if (idt != null && options.ImportList != null)
                    {
                        importsContainsNameSpace = options.ImportList.Contains(((INameSpaceDeclaration)(idt)).FullName);
                    }
                    if (!importsContainsNameSpace)
                    {
                        for (int i = 0; i < options.BuildTrail.Count; i++)
                        {
                            if (Special.GetThisAt(options.BuildTrail, i) is INameSpaceDeclaration)
                            {
                                currentNameSpace = (INameSpaceDeclaration)Special.GetThisAt(options.BuildTrail, i);
                            }
                            else
                            {
                                break;
                            }
                        }
                    }

                    if (currentNameSpace != null && idt != null && (currentNameSpace.FullName == ((INameSpaceDeclaration)idt).FullName || currentNameSpace.FullName.Contains(((INameSpaceDeclaration)idt).FullName + ".")))
                    {
                        /* *
                         * The build trail's current namespace contains the full name of the
                         * parent namespace.
                         * */
                        parentCref = parentCref.Substring(currentNameSpace.FullName.Length + 1);
                    }
                    else if (importsContainsNameSpace)
                    {
                        /* *
                         * The import list contains the namespace
                         * */
                        parentCref = parentCref.Substring(((INameSpaceDeclaration)idt).FullName.Length + 1);
                    }
                    else
                    {
                        goto _verbose;
                    }
                }
                return(string.Format(_CommentConstants.SeeCrefTag, string.Format("{0}.{1}", parentCref, member.Name)));

_verbose:
                return(string.Format(_CommentConstants.SeeCrefTag, string.Format("{0}.{1}", parentCref, member.Name)));
            }