예제 #1
0
        /// <summary>
        /// Creates a clone of the instance and assigns any state.
        /// </summary>
        /// <returns>Clone of this instance.</returns>
        public override object Clone()
        {
            CommentedElement clone = base.Clone() as CommentedElement;

            foreach (ICommentElement comment in HeaderComments)
            {
                ICommentElement commentClone = comment.Clone() as ICommentElement;
                clone.AddHeaderComment(commentClone);
            }

            return(clone);
        }
예제 #2
0
        /// <summary>
        /// Gets the formatted text to write for a comment.
        /// </summary>
        /// <param name="comment">Comment with text.</param>
        /// <returns>Formatted comment text.</returns>
        protected string FormatCommentText(ICommentElement comment)
        {
            string commentText = null;

            if (comment != null)
            {
                switch (comment.Type)
                {
                case CommentType.Line:
                    int    tabCount     = 0;
                    string commentLine  = ProcessLineWhitepace(comment.Text, ref tabCount);
                    string leadingSpace = CreateTabWhitespace(tabCount);
                    commentText = leadingSpace + commentLine;
                    break;

                default:
                    commentText = comment.Text;
                    break;
                }
            }

            return(commentText);
        }
예제 #3
0
        /// <summary>
        /// Gets the formatted text to write for a comment.
        /// </summary>
        /// <param name="comment">Comment with text.</param>
        /// <returns>Formatted comment text.</returns>
        protected string FormatCommentText(ICommentElement comment)
        {
            string commentText = null;

            if (comment != null)
            {
                switch (comment.Type)
                {
                    case CommentType.Line:
                        int tabCount = 0;
                        string commentLine = ProcessLineWhitepace(comment.Text, ref tabCount);
                        string leadingSpace = CreateTabWhitespace(tabCount);
                        commentText = leadingSpace + commentLine;
                        break;

                    default:
                        commentText = comment.Text;
                        break;
                }
            }

            return commentText;
        }
예제 #4
0
 /// <summary>
 /// Adds a header comment to this element.
 /// </summary>
 /// <param name="comment">The comment.</param>
 public void AddHeaderComment(ICommentElement comment)
 {
     BaseHeaderComments.Add(comment);
 }
예제 #5
0
 /// <summary>
 /// Adds a header comment to this element.
 /// </summary>
 /// <param name="comment">The comment.</param>
 public void AddHeaderComment(ICommentElement comment)
 {
     BaseHeaderComments.Add(comment);
 }