|
1 /* |
|
2 * Copyright (c) 2010 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 * The class HtmlFormatter is used to format text to HTML format. |
|
16 * |
|
17 */ |
|
18 using System; |
|
19 using System.Collections.Generic; |
|
20 using System.Text; |
|
21 |
|
22 namespace ErrorLibrary |
|
23 { |
|
24 class HtmlFormatter |
|
25 { |
|
26 /** |
|
27 * Formats a description for a panic category in html format |
|
28 * @param categoryName category name |
|
29 * @param categoryDescription category description |
|
30 * @return category description in html format |
|
31 */ |
|
32 public static string formatCategoryDescription(string categoryName, string categoryDescription) |
|
33 { |
|
34 return BOLD + categoryName + BOLD_END + BREAK + BREAK + categoryDescription; |
|
35 } |
|
36 |
|
37 /** |
|
38 * Formats a description for an error in html format |
|
39 * @param errorName error name |
|
40 * @param errorDescription error description |
|
41 * @return error description in html format |
|
42 */ |
|
43 public static string formatErrorDescription(string errorName, string errorDescription) |
|
44 { |
|
45 return BOLD + errorName + " " + errorDescription + BOLD_END + BREAK + BREAK; |
|
46 } |
|
47 |
|
48 /** |
|
49 * Formats a description for a panic in html format |
|
50 * @param panicName panic name |
|
51 * @param panicDescription panic description |
|
52 * @return panic description in html format |
|
53 */ |
|
54 public static string formatPanicDescription(string panicName, string panicDescription) |
|
55 { |
|
56 return BOLD + panicName + BOLD_END + BREAK + panicDescription + BREAK + BREAK; |
|
57 } |
|
58 |
|
59 /** |
|
60 * Formats a panic name to html format |
|
61 * @param categoryName category name |
|
62 * @param panicId panic id |
|
63 * @return panic name in html format |
|
64 */ |
|
65 public static string formatPanicName(string categoryName, string panicId) |
|
66 { |
|
67 return BREAK + BREAK + BOLD + categoryName + " - " + panicId + BOLD_END + BREAK; |
|
68 } |
|
69 |
|
70 /** |
|
71 * |
|
72 * @param component |
|
73 * @return |
|
74 */ |
|
75 public static string formatErrorComponent(string component) |
|
76 { |
|
77 if (component.Trim().Length < 1) |
|
78 return ""; |
|
79 return BREAK + BREAK + BOLD + "Error Component:" + BOLD_END + BREAK + component; |
|
80 } |
|
81 |
|
82 private static string BOLD = "<b>"; |
|
83 private static string BOLD_END = "</b>"; |
|
84 private static string BREAK = "<br>"; |
|
85 } |
|
86 } |