Ejemplo n.º 1
0
        /// <summary>
        /// Gets the declaration of the specified code class as a string.
        /// </summary>
        /// <param name="codeClass">The code class.</param>
        /// <returns>The string declaration.</returns>
        internal static string GetClassDeclaration(CodeClass codeClass)
        {
            // Get the start point after the attributes.
            var startPoint = codeClass.GetStartPoint(vsCMPart.vsCMPartHeader);

            return(TextDocumentHelper.GetTextToFirstMatch(startPoint, @"\{"));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the declaration of the specified code method as a string.
        /// </summary>
        /// <param name="codeFunction">The code method.</param>
        /// <returns>The string declaration.</returns>
        internal static string GetMethodDeclaration(CodeFunction codeFunction)
        {
            // Get the start point after the attributes.
            var startPoint = codeFunction.GetStartPoint(vsCMPart.vsCMPartHeader);

            return(TextDocumentHelper.GetTextToFirstMatch(startPoint, @"[\(\{;]"));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the declaration of the specified code delegate as a string.
        /// </summary>
        /// <param name="codeDelegate">The code delegate.</param>
        /// <returns>The string declaration.</returns>
        internal static string GetDelegateDeclaration(CodeDelegate codeDelegate)
        {
            // Get the start point at the end of the attributes if there are any (vsCMPartHeader is
            // not available for delegates).
            var startPoint = codeDelegate.Attributes.Count > 0
                ? codeDelegate.GetEndPoint(vsCMPart.vsCMPartAttributesWithDelimiter)
                : codeDelegate.StartPoint;

            return(TextDocumentHelper.GetTextToFirstMatch(startPoint, @";"));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the declaration of the specified code field as a string.
        /// </summary>
        /// <param name="codeField">The code field.</param>
        /// <returns>The string declaration.</returns>
        internal static string GetFieldDeclaration(CodeVariable codeField)
        {
            // Get the start point at the end of the attributes if there are any (vsCMPartHeader is
            // not available for fields).
            var startPoint = codeField.Attributes.Count > 0
                ? codeField.GetEndPoint(vsCMPart.vsCMPartAttributesWithDelimiter)
                : codeField.StartPoint;

            return(TextDocumentHelper.GetTextToFirstMatch(startPoint, @"[,;]"));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the declaration of the specified code property as a string.
        /// </summary>
        /// <param name="codeProperty">The code property.</param>
        /// <returns>The string declaration.</returns>
        internal static string GetPropertyDeclaration(CodeProperty codeProperty)
        {
            // Get the start point at the end of the attributes if there are any (vsCMPartHeader is
            // not available for properties).
            var startPoint = codeProperty.Attributes.Count > 0
                ? codeProperty.GetEndPoint(vsCMPart.vsCMPartAttributesWithDelimiter)
                : codeProperty.StartPoint;

            return(TextDocumentHelper.GetTextToFirstMatch(startPoint, @"[\{;]"));
        }