crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/SourceParser/Parsers/ParserSrcMethodModifier.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 using SymbianUtils.SourceParser.Objects;
       
    21 
       
    22 namespace SymbianUtils.SourceParser.Parsers
       
    23 {
       
    24     public class ParserSrcMethodModifier
       
    25     {
       
    26         #region Constructors
       
    27         public ParserSrcMethodModifier()
       
    28         {
       
    29         }
       
    30         #endregion
       
    31 
       
    32         #region API
       
    33         public SrcMethodModifier Parse( ref string aText )
       
    34         {
       
    35             SrcMethodModifier ret = null;
       
    36 
       
    37             // Should not be the first or second character as
       
    38             // we should always have an opening bracket before
       
    39             // the closing bracket, and the shortest possible
       
    40             // valid sequence is "(<char>)" where <char> is a
       
    41             // single character (type).
       
    42             //
       
    43             // Needs to also handle tricky things like...:
       
    44             //
       
    45             // RDbHandle::operator ->() const
       
    46 
       
    47             int closingBracketPos = aText.LastIndexOf( ")" );
       
    48             System.Diagnostics.Debug.Assert( closingBracketPos >= 1 );
       
    49 
       
    50             // Get the modifier text. We currently only support
       
    51             // one modifier and that's the const keyword
       
    52             string modifierText = aText.Substring( closingBracketPos + 1 ).Trim();
       
    53             if ( modifierText.Length > 0 )
       
    54             {
       
    55                 ret = new SrcMethodModifier();
       
    56 
       
    57                 if ( modifierText.ToLower() == "const" )
       
    58                 {
       
    59                     ret.Type = SrcMethodModifier.TModifier.EConst;
       
    60                 }
       
    61             }
       
    62 
       
    63             // Clean up the text object we were passed...
       
    64             aText = aText.Substring( 0, closingBracketPos + 1 );
       
    65 
       
    66             return ret;
       
    67         }
       
    68         #endregion
       
    69 
       
    70         #region Properties
       
    71         #endregion
       
    72 
       
    73         #region Data members
       
    74         #endregion
       
    75     }
       
    76 }