home *** CD-ROM | disk | FTP | other *** search
- /*=====================================================================
- File: NativeConstructorInfo.cs
-
- Summary: For language-neutral reflection information.
-
- ---------------------------------------------------------------------
- This file is part of the Microsoft NGWS SDK Code Samples.
-
- Copyright (C) 2000 Microsoft Corporation. All rights reserved.
-
- This source code is intended only as a supplement to Microsoft
- Development Tools and/or on-line documentation. See these other
- materials for detailed information regarding Microsoft code samples.
-
- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
- PARTICULAR PURPOSE.
- =====================================================================*/
-
- namespace LangUtil {
-
- using System;
- using System.Text;
- using System.Reflection;
- using System.Collections;
-
- public class NativeConstructorInfo : LangConstructorInfo
- {
- public NativeConstructorInfo( ConstructorInfo myConstructor ): base( myConstructor )
- {
- }
-
- protected override ArrayList GetParamList( ParameterInfo[] ParamArray )
- {
- ArrayList ParamList = new ArrayList( ParamArray.Length );
- for ( int x = 0; x < ParamArray.Length; x++ )
- {
- ParamList.Add( new NativeLangType( ParamArray[x] ) );
- }
- return ParamList;
- }
-
- public ArrayList Parameters
- {
- get { return m_Parameters; }
- }
-
- public Type ThisType
- {
- override get { return m_ThisType; }
- }
-
- public String Attributes
- {
- override get
- {
- throw new Exception( "NativeConstructorInfo.NativeAttributes is not yet implemented." );
-
- }
- }
-
- public String TextDeclaration
- {
- override get
- {
- StringBuilder Syntax = new StringBuilder( this.Attributes + m_ThisConstructorInfo.ReflectedType.Name + "(" );
- for ( int i = 0; i < m_Parameters.Count; i++ )
- {
- if ( ( (NativeLangType)m_Parameters[i] ).m_IsByRef )
- Syntax.Append( "ref " );
- Syntax.Append( ( (NativeLangType)m_Parameters[i] ).ClassName );
- Syntax.Append( " " + ( (NativeLangType)m_Parameters[i] ).ParamVarName + "" );
-
- // Writes the comma, or the last break
- if ( i != ( m_Parameters.Count - 1 ) )
- Syntax.Append( ", " );
- }
- Syntax.Append( ")" );
- Syntax.Append( ";" );
- return Syntax.ToString();
- }
- }
-
- public String HTMLDeclaration
- {
- override get
- {
- StringBuilder Syntax = new StringBuilder( "<PRE class=\"Syntax\">" );
- Syntax.Append( "<span style=\"color:red\">[CSharp]</span><BR>" );
-
- Syntax.Append( "<B>" );
- Syntax.Append( this.Attributes + m_ThisConstructorInfo.ReflectedType.Name + "(" );
- for ( int i = 0; i < m_Parameters.Count; i++ )
- {
- Syntax.Append( "<BR> " );
- if ( ( (NativeLangType)m_Parameters[i]).m_IsByRef )
- Syntax.Append( "ref " );
- Syntax.Append( ( (NativeLangType)m_Parameters[i] ).ClassName );
- Syntax.Append( " <I>" + ((NativeLangType)m_Parameters[i]).ParamVarName + "</I>" );
-
- // Writes the comma, or the last break
- if ( i != ( m_Parameters.Count - 1 ) )
- Syntax.Append( ", " );
- else
- Syntax.Append( "<BR>" );
- }
- Syntax.Append( ")" );
- Syntax.Append( ";" );
- Syntax.Append( "</B></PRE>" );
-
- return Syntax.ToString();
- }
- }
-
- public VisualBasicConstructorInfo VisualBasicLangObject
- {
- get { return new VisualBasicConstructorInfo( m_ThisConstructorInfo ); }
- }
-
- public CSharpConstructorInfo CSharpLangObject
- {
- get { return new CSharpConstructorInfo( m_ThisConstructorInfo ); }
- }
-
- public MCConstructorInfo MCLangObject
- {
- get { return new MCConstructorInfo( m_ThisConstructorInfo ); }
- }
-
- public override bool IsConstructor()
- {
- return true;
- }
- }
-
- } // namespace LangUtil
-