|
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 ParserSrcClass |
|
25 { |
|
26 #region Constructors |
|
27 public ParserSrcClass() |
|
28 { |
|
29 } |
|
30 #endregion |
|
31 |
|
32 #region API |
|
33 public SrcClass Parse( ref string aText ) |
|
34 { |
|
35 SrcClass ret = new SrcClass(); |
|
36 |
|
37 // First look for the class separator. If we find that, then everything before |
|
38 // it is the class name. |
|
39 // |
|
40 // If no class separator exists, then we treat the whole thing as the class |
|
41 // name. |
|
42 int pos = aText.IndexOf( SrcClass.KClassSeparator ); |
|
43 if ( pos > 0 || pos < 0 ) |
|
44 { |
|
45 // By default, treat the whole text as the class name |
|
46 string className = aText; |
|
47 if ( pos > 0 ) |
|
48 { |
|
49 className = aText.Substring( 0, pos ); |
|
50 aText = aText.Substring( pos + SrcClass.KClassSeparator.Length ); |
|
51 ret.Name = className; |
|
52 } |
|
53 else |
|
54 { |
|
55 // Everything was consumed... We return the 'global function' class |
|
56 // for this text |
|
57 aText = string.Empty; |
|
58 } |
|
59 } |
|
60 else |
|
61 { |
|
62 // First thing in the string is the class separator. |
|
63 // Odd? |
|
64 System.Diagnostics.Debug.Assert( false ); |
|
65 } |
|
66 |
|
67 return ret; |
|
68 } |
|
69 #endregion |
|
70 |
|
71 #region Properties |
|
72 #endregion |
|
73 |
|
74 #region Data members |
|
75 #endregion |
|
76 } |
|
77 } |