|
// This code is copyright Dustin Metzgar.
// There are no restrictions to what you can do with this code. If you do
// use it for something interesting, let me know (dustin.metzgar@gmail.com).
using System;
using System.CodeDom;
using System.Xml;
namespace XmiParser
{
/// <summary>
/// Represents an xmi class object.
/// </summary>
[XmiElementName("Foundation.Core.Class")]
public class XmiClass : XmiBaseObject, IXmiModelElement, IXmiGeneralizableElement
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="xmiFragment"></param>
/// <param name="helper"></param>
public XmiClass(XmlElement xmiFragment, XmiHelper helper) : base(xmiFragment, helper)
{
}
/// <summary>
/// Parses the fragment.
/// </summary>
public override void ParseXmi()
{
base.ParseXmi ();
XmiModelElement.ParseXmi(this);
XmiGeneralizableElement.ParseXmi(this);
}
/// <summary>
/// Gets the CodeDom class matching this XMI class.
/// </summary>
/// <returns></returns>
public CodeTypeDeclaration GetCodeDomClass()
{
CodeTypeDeclaration ctd = new CodeTypeDeclaration(this.Name);
return ctd;
}
#region IXmiModelElement Members
private string _Name = string.Empty;
private string _Visibility = string.Empty;
private bool _IsSpecification = false;
private string _NamespaceId = string.Empty;
/// <summary>
/// Name
/// </summary>
public string Name
{
get { return _Name; }
set { _Name = value; }
}
/// <summary>
/// Visibility
/// </summary>
public string Visibility
{
get { return _Visibility; }
set { _Visibility = value; }
}
/// <summary>
/// Whether or not model element is a specification.
/// </summary>
public bool IsSpecification
{
get { return _IsSpecification; }
set { _IsSpecification = value; }
}
/// <summary>
/// The id of the namespace this model element belongs to.
/// </summary>
public string NamespaceId
{
get { return _NamespaceId; }
set { _NamespaceId = value; }
}
#endregion
#region IXmiGeneralizableElement Members
private bool _IsRoot = false;
private bool _IsLeaf = false;
private bool _IsAbstract = false;
/// <summary>
/// Is a root element.
/// </summary>
public bool IsRoot
{
get { return _IsRoot; }
set { _IsRoot = value; }
}
/// <summary>
/// Is a leaf element.
/// </summary>
public bool IsLeaf
{
get { return _IsLeaf; }
set { _IsLeaf = value; }
}
/// <summary>
/// Is an abstract element.
/// </summary>
public bool IsAbstract
{
get { return _IsAbstract; }
set { _IsAbstract = value; }
}
#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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.