crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/SourceParser/Objects/SrcMethod.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.Collections.Generic;
       
    19 using System.Text;
       
    20 
       
    21 namespace SymbianUtils.SourceParser.Objects
       
    22 {
       
    23     public class SrcMethod
       
    24     {
       
    25         #region Constructors
       
    26         public SrcMethod()
       
    27         {
       
    28         }
       
    29         #endregion
       
    30 
       
    31         #region API
       
    32         public void AddParameter( SrcMethodParameter aParameter )
       
    33         {
       
    34             iParameters.Add( aParameter );
       
    35         }
       
    36         #endregion
       
    37 
       
    38         #region Properties
       
    39         public string Name
       
    40         {
       
    41             get { return iName; }
       
    42             set { iName = value; }
       
    43         }
       
    44 
       
    45         public string FullName
       
    46         {
       
    47             get { return ToString(); }
       
    48         }
       
    49 
       
    50         public string FullNameWithoutParameters
       
    51         {
       
    52             get
       
    53             {
       
    54                 StringBuilder ret = new StringBuilder();
       
    55 
       
    56                 if ( Class != null )
       
    57                 {
       
    58                     ret.Append( Class );
       
    59                     ret.Append( SrcClass.KClassSeparator );
       
    60                 }
       
    61 
       
    62                 // Add method name itself
       
    63                 ret.Append( Name );
       
    64                 return ret.ToString();
       
    65             }
       
    66         }
       
    67 
       
    68         public SrcMethodModifier Modifier
       
    69         {
       
    70             get { return iModifier; }
       
    71             set { iModifier = value; }
       
    72         }
       
    73 
       
    74         public List<SrcMethodParameter> Parameters
       
    75         {
       
    76             get { return iParameters; }
       
    77         }
       
    78 
       
    79         public SrcClass Class
       
    80         {
       
    81             get { return iClass; }
       
    82             set { iClass = value; }
       
    83         }
       
    84 
       
    85         public object Tag
       
    86         {
       
    87             get { return iTag; }
       
    88             set { iTag = value; }
       
    89         }
       
    90         #endregion
       
    91 
       
    92         #region From System.Object
       
    93         public override string ToString()
       
    94         {
       
    95             StringBuilder ret = new StringBuilder();
       
    96             ret.Append( FullNameWithoutParameters );
       
    97 
       
    98             // Add parameters if present
       
    99             ret.Append( "(" );
       
   100             if ( Parameters.Count > 0 )
       
   101             {
       
   102                 foreach ( SrcMethodParameter param in Parameters )
       
   103                 {
       
   104                     ret.Append( param );
       
   105                     ret.Append( ", " );
       
   106                 }
       
   107 
       
   108                 // Remove redundant trailing comma
       
   109                 ret.Remove( ret.Length - 2, 2 );
       
   110             }
       
   111             ret.Append( ")" );
       
   112 
       
   113             // Add the modifier
       
   114             ret.Append( Modifier );
       
   115 
       
   116             return ret.ToString();
       
   117         }
       
   118         #endregion
       
   119 
       
   120         #region Data members
       
   121         private string iName = string.Empty;
       
   122         private object iTag = null;
       
   123         private SrcClass iClass = null;
       
   124         private SrcMethodModifier iModifier = new SrcMethodModifier();
       
   125         private List<SrcMethodParameter> iParameters = new List<SrcMethodParameter>();
       
   126         #endregion
       
   127     }
       
   128 }