⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codedata.cs

📁 UML设计相关的源码。作UML相关开发的不容错过。
💻 CS
📖 第 1 页 / 共 2 页
字号:
/* ---------------------------------------------------------------------------------------------------
 *  
 *                          PocketUML v0.01.0016
 *  
 *        
 *    Written by Jie Tang.
 *    Bug report : jiet@msn.com
 *  
 *
 * Copyright 2002 James <jiet@msn.com>
 * All rights reserved.
 *
 * This source file(s) may be redistributed unmodified by any means
 * PROVIDING they are not sold for profit without the authors expressed
 * written consent, and providing that this notice and the authors name
 * and all copyright notices remain intact.
 *
 * Any use of the software in source or binary forms, with or without
 * modification, must include, in the user documentation ("About" box and
 * printed documentation) and internal comments to the code, notices to
 * the end user as follows:
 *
 * "Portions Copyright 2002 Tang Jie
 *
 * An email letting me know that you are using it would be nice as well.
 * That's not much to ask considering the amount of work that went into
 * this.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
 * EXPRESS OR IMPLIED. USE IT AT YOUT OWN RISK. THE AUTHOR ACCEPTS NO
 * LIABILITY FOR ANY DATA DAMAGE/LOSS THAT THIS PRODUCT MAY CAUSE.
 *
 */
//-----------------------------------------------------------------------------------------------------
//										Update Information.
//-----------------------------------------------------------------------------------------------------

///
/// PocketUML Namespace
/// Parse UML Data from c# project source code...
/// 
/// PocketUML v0.1
/// Created by Jie Tang  04/10/2002.
///
///
namespace PocketUML
{
	///
	/// Data Struct for UML Parse v0.0001
	/// Created by James Tang 05/10/2002.
	///
	namespace Data
	{	
		using System;
		using System.Collections;



		/// *********************************************************** ///
		///                    UPDATE    RECORD                         ///
		/// *********************************************************** ///
		/// Created 05/10/2002. James Tang                              ///
		/// *********************************************************** ///
		///	Modifyed 07/10/2002. James Tang                             ///
		///	___________________________________________________________ ///
		///                                                             ///
		///	Add ExtendItemObject to ElementData class                   ///
		///	*********************************************************** ///
	

		/// <summary>
		/// Enum for Code type access type
		/// </summary>
		public enum enumElementAccessType
		{
			/// <summary>
			/// Unknow Access Type
			/// </summary>
			accessTypeUnknow				= 0,
			/// <summary>
			/// Element has public access.
			/// </summary>
			accessTypePublic				= 1,
			/// <summary>
			/// Element has private access.
			/// </summary>
			accessTypePrivate				= 2,
			/// <summary>
			/// Element has project access.
			/// </summary>
			accessTypeProject				= 4,
			/// <summary>
			/// Element has protected access.
			/// </summary>
			accessTypeProtected				= 8,
			/// <summary>
			/// Element has project or protected access.
			/// </summary>
			accessTypeProjectOrProtected    = 16,
			/// <summary>
			/// Element has default access.
			/// </summary>
			accessTypeDefault               = 32,
			/// <summary>
			/// Element has assembly or family access.
			/// </summary>
			accessTypeAssemblyOrFamily      = 64
		}


		/// <summary>
		/// Element Type
		/// e.g. Class, Struct etc...
		/// </summary>
		public enum enumElementType
		{
			/// <summary>
			/// An element not in the list.
			/// </summary>
			elementTypeUnknow				= 0,
			/// <summary>
			/// A class element.
			/// </summary>
			elementTypeClass				= 1,
			/// <summary>
			/// A function element.
			/// </summary>
			elementTypeFunction				= 2,
			/// <summary>
			/// A variable element.
			/// </summary>
			elementTypeVariable				= 3,
			/// <summary>
			/// A property element.
			/// </summary>
			elementTypeProperty				= 4,
			/// <summary>
			/// A namespace element.
			/// </summary>
			elementTypeNameSpace			= 5,
			/// <summary>
			/// A parameter element.
			/// </summary>
			elementTypeParameter			= 6,
			/// <summary>
			/// An attribute element.
			/// </summary>
			elementTypeAttribute			= 7,
			/// <summary>
			/// An interface element.
			/// </summary>
			elementTypeInterface			= 8,
			/// <summary>
			/// A delegate element.
			/// </summary>
			elementTypeDelegate				= 9,
			/// <summary>
			/// An enumerator element.
			/// </summary>
			elementTypeEnum					= 10,
			/// <summary>
			/// A structure element.
			/// </summary>
			elementTypeStruct				= 11,
			/// <summary>
			/// A union element.
			/// </summary>
			elementTypeUnion				= 12,
			/// <summary>
			/// A local declaration statement element.
			/// </summary>
			elementTypeLocalDeclStmt		= 13,
			/// <summary>
			/// A local declaration statement element.
			/// </summary>
			elementTypeFunctionInvokeStmt	= 14,
			/// <summary>
			/// A local declaration statement element.
			/// </summary>
			elementTypePropertySetStmt		= 15,
			/// <summary>
			/// An assignment statement element.
			/// </summary>
			elementTypeAssignmentStmt		= 16,
			/// <summary>
			/// An inherits statement element.
			/// </summary>
			elementTypeInheritStmt			= 17,
			/// <summary>
			/// An implements statement element.
			/// </summary>
			elementTypeImplementsStmt		= 18,
			/// <summary>
			/// An option statement element.
			/// </summary>
			elementTypeOptionStmt			= 19,
			/// <summary>
			/// A VB attributes statement element.
			/// </summary>
			elementTypeVBAttributeStmt		= 20,
			/// <summary>
			/// A VB attribute group element.
			/// </summary>
			elementTypeVBAttributeGroup		= 21,
			/// <summary>
			/// An events declaration element.
			/// </summary>
			elementTypeEventsDeclaration	= 22,
			/// <summary>
			/// A user-defined type declaration element.
			/// </summary>
			elementTypeUDTDecl				= 23,
			/// <summary>
			/// A declare declaration element.
			/// </summary>
			elementTypeDeclareDecl			= 24,
			/// <summary>
			/// A define statement element.
			/// </summary>
			elementTypeDefineStmt			= 25,
			/// <summary>
			/// A type definition element.
			/// </summary>
			elementTypeTypeDef				= 26,
			/// <summary>
			/// An include statement element.
			/// </summary>
			elementTypeIncludeStmt			= 27,
			/// <summary>
			/// A using statement element.
			/// </summary>
			elementTypeUsingStmt			= 28,
			/// <summary>
			/// A macro element.
			/// </summary>
			elementTypeMacro				= 29,
			/// <summary>
			/// A map element.
			/// </summary>
			elementTypeMap					= 30,
			/// <summary>
			/// An IDL import element.
			/// </summary>
			elementTypeIDLImport			= 31,
			/// <summary>
			/// An IDL import library element.
			/// </summary>
			elementTypeIDLImportLib			= 32,
			/// <summary>
			/// An IDL co-class element.
			/// </summary>
			elementTypeIDLCoClass			= 33,
			/// <summary>
			/// An IDL library element.
			/// </summary>
			elementTypeIDLLibrary			= 34,
			/// <summary>
			/// An import statement element.
			/// </summary>
			elementTypeImportStmt			= 35,
			/// <summary>
			/// A map entry element.
			/// </summary>
			elementTypeMapEntry				= 36,
			/// <summary>
			/// A VC base element.
			/// </summary>
			elementTypeVCBase				= 37,
			/// <summary>
			/// An event element.
			/// </summary>
			elementTypeEvent				= 38,
			/// <summary>
			/// A module element.
			/// </summary>
			elementTypeModule				= 39,

			///**************************************************
			///Extended element type to support solution etc.....
			///**************************************************
			
			/// <summary>
			/// Solution type
			/// </summary>
			elementTypeSolution             = 40,

			/// <summary>
			/// Project type
			/// </summary>
			elementTypeProject              = 41,

			/// <summary>
			/// Project Item 
			/// </summary>
			elementTypeProjectItem          = 42,

			/// <summary>
			/// File Code Model Type
			/// </summary>
			elementTypeCodeModel            = 43,

			/// <summary>
			/// Code Elements type
			/// </summary>
			elementTypeCodeElements         = 44
		}


		/// <summary>
		/// Define the function usage
		/// </summary>
		public enum enumFunctionType
		{
			/// <summary>
			/// A type of function not in this list.
			/// </summary>
			functionTypeUnknow         = 0,
			/// <summary>
			/// A constructor.
			/// </summary>
			functionTypeConstructor    = 1,
			/// <summary>
			/// A property get.
			/// </summary>
			functionTypePropertyGet    = 2, 
			/// <summary>
			/// A property let.
			/// </summary>
			functionTypePropertyLet    = 4,
			/// <summary>
			/// A property set.
			/// </summary>
			functionTypePropertySet    = 8,
			/// <summary>
			/// A put ref.
			/// </summary>
			functionTypePutRef         = 16,
			/// <summary>
			/// A property assign function.
			/// </summary>
			functionTypePropertyAssign = 32,
			/// <summary>
			/// A sub.
			/// </summary>
			functionTypeSub            = 64,
			/// <summary>
			/// A function.
			/// </summary>
			functionTypeFunction       = 128,
			/// <summary>
			/// A top level function.
			/// </summary>
			functionTypeTopLevel       = 256,
			/// <summary>
			/// A destructor.
			/// </summary>
			functionTypeDestructor     = 512,
			/// <summary>
			/// An operator.
			/// </summary>
			functionTypeOperatior      = 1024,
			/// <summary>
			/// A virtual function.
			/// </summary>
			functionTypeVirtual        = 2048,
			/// <summary>
			/// A pure function.
			/// </summary>
			functionTypePure           = 4096,
			/// <summary>
			/// A constant.
			/// </summary>
			functionTypeConstant       = 8192,
			/// <summary>
			/// A shared function.
			/// </summary>
			functionTypeShared         = 16384,
			/// <summary>
			/// An inline function.
			/// </summary>
			functionTypeInline         = 32768
		}


		/// <summary>
		/// A struct which stored prototype informations.
		/// </summary>
		public class ElementPhotoType
		{
			/// <summary>
			/// Indicates that the code element's full name should be used if it 
			/// is applicable. This means that classes and namespaces, for example, 
			/// would have fully qualified names.
			/// </summary>
			public String fullName;
			/// <summary>
			/// Do not include the name in the prototype string. This flag is 
			/// incompatible with other flags that request specific name information.
			/// </summary>
			public String noName;
			/// <summary>
			/// If the code element is a member of a class, then include the element's 
			/// name qualified with a prefix of the class name and a period (.).
			/// </summary>
			public String className;
			/// <summary>
			/// Include parameter types in the prototype string.
			/// </summary>
			public String paramTypes;
			/// <summary>
			/// Include parameter names in the prototype string.
			/// </summary>
			public String paramNames;
			/// <summary>
			/// Include parameter default value expressions in the prototype string.
			/// </summary>
			public String paramDefaultValus;
			/// <summary>
			/// Returns a unique specifier suitable for indexing or searching for 
			/// this code element later. This can be used, for example, for inserting 
			/// text to create an overridden or overloaded code element.
			/// </summary>
			public String uniqueSignature;
			/// <summary>
			/// Prefix the returned string with the function or variable's type.
			/// </summary>
			public String phototypeType;
			/// <summary>
			/// Include the variable's initialization expression in the prototype string.
			/// </summary>
			public String phototypeInitExpression;
		}


		/// <summary>
		/// UML CODE DATA VERSION
		/// </summary>
		public struct CodeDataVersion
		{
			// Code Data Version
			public String strVersion;

			/// <summary>
			/// Set Code data version
			/// </summary>
			/// <param name="strVersion"></param>
			public CodeDataVersion ( String strVersion )
			{
				this.strVersion = strVersion;
			}
		}


		/// <summary>
		/// Code Data Collections
		/// </summary>
		public class CodeData 
		{
			public CodeData ()
			{
			}
			
			// Solution List
			private ArrayList solutionList = new ArrayList();
			/// <summary>
			/// Get Solution List
			/// </summary>
			public ArrayList SolutionList
			{
				get
				{
					return this.solutionList;
				}
			}
			

			private CodeDataVersion version = new CodeDataVersion( "0000.0001" );
			/// <summary>
			/// Get Code Data Version
			/// </summary>
			public CodeDataVersion Version
			{
				get
				{
					return this.version;
				}
			}

			/// <summary>
			/// Add a solution data into array list
			/// </summary>
			/// <param name="data"></param>
			public void AddSolution ( SolutionData data )
			{
				this.solutionList.Add( data );
			}
			
		}


		/// <summary>
		/// Base class include the name, comment etc common functions.
		/// </summary>
		public class ElementData
		{
			public ElementData()
			{
				elementType			= enumElementType.elementTypeUnknow;
				accessType			= enumElementAccessType.accessTypeUnknow;
				phototype			= new ElementPhotoType();
				extendDataObject	= null;
			}

			#region Element Data

			/// <summary>
			/// The Element access type
			/// </summary>
			protected enumElementAccessType accessType;
			public enumElementAccessType AccessType
			{
				get
				{
					return this.accessType;
				}
				set
				{
					this.accessType = value;
				}
			}


			/// <summary>
			/// Set or Get Element type
			/// </summary>
			protected enumElementType elementType;
			public enumElementType ElementType
			{
				get
				{
					return this.elementType;
				}
				set
				{
					this.elementType = value;
				}
			}

			/// <summary>
			/// The name
			/// </summary>
			protected String name = null;
			public String Name
			{
				get
				{
					return this.name;
				}
				set 
				{
					this.name = value;
				}
			}

			/// <summary>
			/// All comments
			/// </summary>
			protected String docComment;
			public String DocComment
			{
				get
				{
					return this.docComment;
				}
				set 
				{
					this.docComment = value;
				}
			}
	        

			/// <summary>
			/// Store all class elements data in this namespace
			/// </summary>
			protected ArrayList element = new ArrayList();
			public ArrayList Element
			{
				get
				{
					return this.element;
				}
			}

			/// <summary>
			/// Add element data into this field
			/// </summary>
			/// <param name="data">Element Data</param>
			public void AddMember( ElementData data )
			{
				this.element.Add( data );
			}


			/// <summary>
			/// Element's phototypes information
			/// </summary>
			protected ElementPhotoType phototype;
			public ElementPhotoType PhotoType
			{
				get
				{
					return phototype;
				}
				set
				{
					phototype = value;
				}
			}


			/// <summary>
			/// References to a VS.NET object for code generation
			/// </summary>
			protected object vsObjectReference;
			public object VSObjectReference
			{
				get

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -