- Nova.0.6.zip
- Nova.CLI
- Nova.CodeDOM
- CodeDOM
- Annotations
- Base
- Expressions
- AnonymousMethods
- Base
- Operators
- Other
- References
- Base
- GotoTargets
- Methods
- Namespaces
- Other
- Properties
- Types
- Variables
- Projects
- Statements
- Base
- Conditionals
- Exceptions
- Generics
- Iterators
- Jumps
- Loops
- Methods
- Miscellaneous
- Namespaces
- Properties
- Types
- Variables
- Configuration.cs
- Log.cs
- Nova.CodeDOM.csproj
- Parsing
- Properties
- Rendering
- Resolving
- Utilities
- Nova.Examples
- Nova.sln
- Nova.Studio
- Nova.Test
- Nova.UI
- CodeDOM
- Annotations
- Base
- Expressions
- AnonymousMethods
- Base
- Operators
- Other
- References
- Base
- GotoTargets
- Methods
- Namespaces
- Other
- Properties
- Types
- Variables
- Projects
- Statements
- Base
- Conditionals
- Exceptions
- Generics
- Iterators
- Jumps
- Loops
- Methods
- Miscellaneous
- Namespaces
- Properties
- Types
- Variables
- CodeRenderer.cs
- Nova.UI.csproj
- Properties
- Resolving
- Utilties
- Nova.0.6.exe.zip
|
// The Nova Project by Ken Beckett.
// Copyright (C) 2007-2012 Inevitable Software, all rights reserved.
// Released under the Common Development and Distribution License, CDDL-1.0: http://opensource.org/licenses/cddl1.php
using System;
using Nova.Rendering;
namespace Nova.CodeDOM
{
/// <summary>
/// Represents plain-text user documentation of code.
/// </summary>
/// <remarks>
/// This class is used to mix portions of plain-text with other embedded documentation comment objects, such as <see cref="DocSee"/> or <see cref="DocCode"/>.
/// If a documentation comment object contains only plain-text, it will store it as a simple string instead of using this object.
/// </remarks>
public class DocText : DocComment
{
#region /* CONSTRUCTORS */
/// <summary>
/// Create a <see cref="DocText"/>.
/// </summary>
public DocText(string text)
: base(text)
{ }
#endregion
#region /* PROPERTIES */
/// <summary>
/// The text content of the object.
/// </summary>
public override string Text
{
get { return (string)_content; }
}
#endregion
#region /* METHODS */
/// <summary>
/// Add the specified text to the documentation comment.
/// </summary>
public override void Add(string text)
{
_content += text;
}
/// <summary>
/// Throws an exception if called.
/// </summary>
public override void Add(DocComment docComment)
{
throw new Exception("Can't add DocComment objects to DocText objects (add them both to a parent DocComment instead).");
}
#endregion
#region /* FORMATTING */
/// <summary>
/// True if the code object defaults to starting on a new line.
/// </summary>
public override bool IsFirstOnLineDefault
{
get { return false; }
}
#endregion
#region /* RENDERING */
protected override void AsTextContent(CodeWriter writer, RenderFlags flags)
{
writer.EscapeUnicode = false;
AsTextText(writer, (string)_content, flags);
writer.EscapeUnicode = true;
}
public static void AsTextText(CodeWriter writer, string text, RenderFlags flags)
{
string[] lines = text.Split('\n');
for (int i = 0; i < lines.Length; ++i)
{
if (i > 0)
AsTextDocNewLines(writer, 1);
if (lines[i].Length > 0)
{
// Turn on translation of '<', '&', and '>' for content
if (!flags.HasFlag(RenderFlags.NoTranslations))
writer.InDocCommentContent = true;
writer.Write(lines[i]);
writer.InDocCommentContent = false;
}
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I've been writing software since the late 70's, currently focusing mainly on C#.NET. I also like to travel around the world, and I own a Chocolate Factory (sadly, none of my employees are oompa loompas).