CodeElement.cs :  » Development » devAdvantage » AnticipatingMinds » Genesis » CodeDOM » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Development » devAdvantage 
devAdvantage » AnticipatingMinds » Genesis » CodeDOM » CodeElement.cs
using System;
using System.Collections;
using System.Diagnostics;

namespace AnticipatingMinds.Genesis.CodeDOM{
  /// <summary>
  /// Represents any code element that can exist in a source code file.
  /// </summary>
  /// <remarks>This class helps to abstract all code elements that have a physical representation in
  /// source code file. For example namespace declaration have a clear presentation in source file when assembly 
  /// has only logical meaning of one or more modules that export types and does not have source
  /// code representation.</remarks>
  [Serializable]
  public abstract class CodeElement : object, ICloneable
  {
    #region Public instance properties
    /// <summary>
    /// Gets and sets postion information for code element.
    /// </summary>
    public  CodeElementPosition SourcePosition
    {
      get
      {
        return position;
      }
      set
      {
        position = value;
        if(position == null)
          position = new CodeElementPosition();
      }
    }
    /// <summary>
    /// Gets or sets documentation comment if one is associated with an element.
    /// </summary>
    public CodeComment DocumentationComment
    {
      get
      {
        return documentationComment;
      }
      set
      {
        documentationComment = value;
      }
    }
    /// <summary>
    /// Gets or sets a comment associated with the code element.
    /// </summary>
    public CodeComment Comment
    {
      get
      {
        return comment;
      }
      set
      {
        comment = value;
      }
    }
    /// <summary>
    /// Gets or sets CodeAssemblyFile that contains code element.
    /// </summary>
    public CodeAssemblyFile CompileUnit
    {
      get
      {
        return codeContainer;
      }
      set
      {
        codeContainer = value;
      }
    }

    public CodeLanguage Language
    {
      get
      {
        if(CompileUnit != null)
          return CompileUnit.Language;
        return CodeLanguage.Unknown;
      }
    }


    /// <summary>
    /// Gets assembly type manager if element is part of assembly and type manager is available
    /// </summary>
    /// <returns></returns>
    public CodeAssemblyTypeManager GetAssemblyTypeManager()
    {
      if(CompileUnit != null && CompileUnit.Assembly != null)
        return CompileUnit.Assembly.TypeManager;
      else
        return null;
    }

    /// <summary>
    /// Gets a dictinary object to store any data associated with code element.
    /// </summary>
    public IDictionary ApplicationData
    {
      get
      {
        if(applicationData == null)
        {
          lock(this)
          {
            if(applicationData == null)
              applicationData = new Hashtable() as IDictionary;
          }
        }
        return applicationData;
      }
    }
    /// <summary>
    /// Gets or sets code element parent element.
    /// </summary>
    public CodeElement Parent
    {
      get
      {
        return parent;
      }
      set
      {
        parent = value;
      }
    }
    #endregion Public instance properties
    #region Public instance methods
    /// <summary>
    /// Clones code element.
    /// </summary>
    /// <returns>Code element cloned by <see cref="Object.MemberwiseClone"/> method call.</returns>
    #region ICloneable Members
    public virtual object Clone()
    {
      return MemberwiseClone();;
    }
    #endregion
    #endregion Public instance methods
    #region Private instance fields
    private CodeAssemblyFile codeContainer;
    private CodeElementPosition position = new CodeElementPosition();
    private CodeCommentCollection comments = new CodeCommentCollection();
    private CodeComment documentationComment;
    private CodeElement parent;
    private IDictionary applicationData = null;
    private CodeComment comment;
    #endregion Private instance fields
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.