using System;
using System.Collections.Generic;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANXStatusComparer.Data
{
///
/// Data holder for an assembly namespace.
///
public class NamespaceData
{
#region Public
///
/// True if the namespace contains any public types.
///
public bool IsPublic
{
get;
private set;
}
///
/// The name of the namespace.
///
public string Name
{
get;
private set;
}
///
/// All types contained in this namespace.
///
public List AllTypes
{
get;
private set;
}
///
/// All interfaces of this namespace.
///
public Dictionary Interfaces
{
get;
private set;
}
///
/// All classes of this namespace.
///
public Dictionary Classes
{
get;
private set;
}
///
/// All structures of this namespace.
///
public Dictionary Structs
{
get;
private set;
}
///
/// All enumerations of this namespace.
///
public Dictionary Enums
{
get;
private set;
}
#endregion
#region Constructor
///
/// Create a new namespace data holder.
///
/// The name of the namespace.
public NamespaceData(string setName)
{
Name = setName;
AllTypes = new List();
Interfaces = new Dictionary();
Structs = new Dictionary();
Classes = new Dictionary();
Enums = new Dictionary();
}
#endregion
#region ParseTypes
///
/// Parse all the added types. This is done after parsing all assemblies
/// is finished and we're sure all types are available in here.
///
public void ParseTypes()
{
IsPublic = false;
foreach (Type type in AllTypes)
{
if (type.IsPublic)
{
IsPublic = true;
if (type.IsInterface)
{
Interfaces.Add(type.Name, new BaseObject(type));
}
if (type.IsEnum)
{
Enums.Add(type.Name, new EnumData(type));
}
if (type.IsClass)
{
Classes.Add(type.Name, new BaseObject(type));
}
if (type.IsValueType &&
type.IsEnum == false &&
type.IsPrimitive == false)
{
Structs.Add(type.Name, new BaseObject(type));
}
}
}
}
#endregion
}
}