Click here to Skip to main content
15,886,087 members
Articles / Programming Languages / C#

Resolving Symbolic References in a CodeDOM (Part 7)

Rate me:
Please Sign up or sign in to vote.
4.75/5 (6 votes)
2 Dec 2012CDDL12 min read 19.4K   509   14  
Resolving symbolic references in a CodeDOM.
// 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

namespace Nova.CodeDOM
{
    /// <summary>
    /// This interface is implemented by all <see cref="CodeObject"/>s that have a Name property, and can be referenced symbolically.
    /// </summary>
    /// <remarks>
    /// Implementers include:
    ///    <see cref="ITypeDecl"/> implementers (<see cref="TypeDecl"/> and subclasses [<see cref="ClassDecl"/>, <see cref="StructDecl"/>, <see cref="InterfaceDecl"/>, <see cref="EnumDecl"/>], <see cref="TypeParameter"/>, <see cref="Alias"/>),
    ///    <see cref="IVariableDecl"/> implementers (<see cref="VariableDecl"/> and subclasses [<see cref="ParameterDecl"/>, <see cref="LocalDecl"/>, <see cref="FieldDecl"/>, <see cref="EnumMemberDecl"/>],
    ///        <see cref="PropertyDeclBase"/> and subclasses [<see cref="PropertyDecl"/>, <see cref="IndexerDecl"/>, <see cref="EventDecl"/>]),
    ///    <see cref="MethodDeclBase"/> and subclasses (<see cref="MethodDecl"/>, <see cref="GenericMethodDecl"/>, <see cref="ConstructorDecl"/>, <see cref="DestructorDecl"/>)
    ///    <see cref="SwitchItem"/>, <see cref="Label"/>, <see cref="Solution"/>, <see cref="Project"/>, <see cref="CodeUnit"/>, <see cref="Namespace"/>, <see cref="ExternAlias"/>
    /// </remarks>
    public interface INamedCodeObject
    {
        /// <summary>
        /// The name of the <see cref="CodeObject"/>.
        /// </summary>
        string Name { get; }

        /// <summary>
        /// The descriptive category of the <see cref="CodeObject"/>.
        /// </summary>
        string Category { get; }

        /// <summary>
        /// Create a reference to the <see cref="CodeObject"/>.
        /// </summary>
        SymbolicRef CreateRef(bool isFirstOnLine);

        /// <summary>
        /// Create a reference to the <see cref="CodeObject"/>.
        /// </summary>
        SymbolicRef CreateRef();

        /// <summary>
        /// Find the parent object of the specified type.
        /// </summary>
        T FindParent<T>() where T : CodeObject;

        /// <summary>
        /// Add the <see cref="CodeObject"/> to the specified dictionary.
        /// </summary>
        void AddToDictionary(NamedCodeObjectDictionary dictionary);

        /// <summary>
        /// Remove the <see cref="CodeObject"/> from the specified dictionary.
        /// </summary>
        void RemoveFromDictionary(NamedCodeObjectDictionary dictionary);

        /// <summary>
        /// Get the full name of the <see cref="INamedCodeObject"/>, including any namespace name.
        /// </summary>
        /// <param name="descriptive">True to display type parameters and method parameters, otherwise false.</param>
        string GetFullName(bool descriptive);

        /// <summary>
        /// Get the full name of the <see cref="INamedCodeObject"/>, including any namespace name.
        /// </summary>
        string GetFullName();
    }
}

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.

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


Written By
Software Developer (Senior)
United States United States
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).

Comments and Discussions