1 /* |
|
2 * Copyright (c) 2008 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 * Location store |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracecompiler.decodeplugins.dictionary.encoder; |
|
20 |
|
21 /** |
|
22 * Location store |
|
23 * |
|
24 */ |
|
25 public class LocationStore { |
|
26 |
|
27 /** |
|
28 * Writes <locations> |
|
29 */ |
|
30 public static void startLocations() { |
|
31 TagWriter.write(TagWriter.LOCATIONS_START, TagWriter.INDENT_1); |
|
32 } |
|
33 |
|
34 /** |
|
35 * Starts <path val=""> structure |
|
36 * |
|
37 * @param path |
|
38 * relative or absolute path to some directory |
|
39 */ |
|
40 public static void startPath(String path) { |
|
41 StringBuffer sb = new StringBuffer(); |
|
42 sb.append(TagWriter.PATH_START_OPEN); |
|
43 TagWriter.appendAttribute(sb, TagWriter.VAL_ATTR, path, false); |
|
44 sb.append(TagWriter.TAG_CLOSE); |
|
45 TagWriter.write(sb.toString(), TagWriter.INDENT_2); |
|
46 } |
|
47 |
|
48 /** |
|
49 * Writes <file id="">fileName</file> structure |
|
50 * |
|
51 * @param id |
|
52 * unique number within <locations> structure |
|
53 * @param fileName |
|
54 * value of the file element |
|
55 */ |
|
56 public static void writeFile(int id, String fileName) { |
|
57 StringBuffer sb = new StringBuffer(); |
|
58 sb.append(TagWriter.FILE_START_OPEN); |
|
59 TagWriter.appendAttribute(sb, TagWriter.ID_ATTR, String.valueOf(id), |
|
60 false); |
|
61 sb.append(TagWriter.TAG_CLOSE); |
|
62 sb.append(XMLDataFilter.changeData(fileName)); |
|
63 sb.append(TagWriter.FILE_END); |
|
64 TagWriter.write(sb.toString(), TagWriter.INDENT_3); |
|
65 } |
|
66 |
|
67 /** |
|
68 * Writes </path> |
|
69 */ |
|
70 public static void endPath() { |
|
71 TagWriter.write(TagWriter.PATH_END, TagWriter.INDENT_2); |
|
72 } |
|
73 |
|
74 /** |
|
75 * Writes </locations> |
|
76 */ |
|
77 public static void endLocations() { |
|
78 TagWriter.write(TagWriter.LOCATIONS_END, TagWriter.INDENT_1); |
|
79 } |
|
80 |
|
81 } |
|