Subversion Repositories DevTools

Rev

Rev 2104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2104 Rev 2106
Line 6... Line 6...
6
	/// <summary>
6
	/// <summary>
7
	/// Summary description for DocSectionTracking.
7
	/// Summary description for DocSectionTracking.
8
	/// </summary>
8
	/// </summary>
9
	public class DocSectionTracking
9
	public class DocSectionTracking
10
	{
10
	{
11
      private int[] DocSection = null;
11
      private static int[] DocSection = null;
12
      private int   iDocSection = 0;
12
      private static int   iDocSection = 0;
13
 
13
 
14
		public DocSectionTracking()
14
		public static void initialise()
15
		{
15
		{
16
         DocSection = new int[EA_Constants.MAX_HEADING_LEVEL + 1];
16
         DocSection = new int[EA_Constants.MAX_HEADING_LEVEL + 1];
17
         for (int i=0; i<DocSection.Length; i++)
17
         for (int i=0; i<DocSection.Length; i++)
18
         {
18
         {
19
            DocSection[i] = 0;
19
            DocSection[i] = 0;
20
         }
20
         }
21
         iDocSection = 0;
21
         iDocSection = 0;
22
		}
22
		}
23
 
23
 
24
 
24
 
25
      public void trackDocSection(int recurse_level)
25
      public static void trackDocSection(int recurse_level)
26
      {
26
      {
27
         if (recurse_level > EA_Constants.MAX_HEADING_LEVEL)
27
         if (recurse_level > EA_Constants.MAX_HEADING_LEVEL)
28
         {
28
         {
29
            throw new System.StackOverflowException(EA_Constants.maxRecursionDepthException );
29
            throw new System.StackOverflowException(EA_Constants.maxRecursionDepthException );
30
         }
30
         }
Line 33... Line 33...
33
         DocSection[iDocSection]++;     
33
         DocSection[iDocSection]++;     
34
         for (int i=iDocSection+1; i<DocSection.Length; i++)
34
         for (int i=iDocSection+1; i<DocSection.Length; i++)
35
            DocSection[i] = 0;
35
            DocSection[i] = 0;
36
      }
36
      }
37
 
37
 
38
      public void appendHeadingNumber(ref StringBuilder sb)
38
      public static void appendHeadingNumber(ref StringBuilder sb)
39
      {
39
      {
40
         for (int i = 1; i<=iDocSection; i++)
40
         for (int i = 1; i<=iDocSection; i++)
41
         {
41
         {
42
            if (i!=1)
42
            if (i!=1)
43
               sb.Append(".");
43
               sb.Append(".");
44
            sb.Append(DocSection[i].ToString());
44
            sb.Append(DocSection[i].ToString());
45
         }
45
         }
46
      }
46
      }
47
 
47
 
48
      public string formHeadingString(string headingName)
48
      public static string formHeadingString(string headingName)
49
      {
49
      {
50
         StringBuilder sb = new StringBuilder("");
50
         StringBuilder sb = new StringBuilder("");
51
         appendHeadingNumber(ref sb);
51
         appendHeadingNumber(ref sb);
52
         sb.Append("\t");
52
         sb.Append("\t");
53
         sb.Append(headingName);
53
         sb.Append(headingName);