41
|
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 |
* Writes type def objects
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
package com.nokia.tracecompiler.decodeplugins.dictionary.encoder;
|
|
20 |
|
|
21 |
/**
|
|
22 |
* Writes type def objects
|
|
23 |
*
|
|
24 |
*/
|
|
25 |
public class TypeDef {
|
|
26 |
|
|
27 |
/**
|
|
28 |
* Writes <typemember value="" name="" type=""/> structure
|
|
29 |
*
|
|
30 |
* @param value
|
|
31 |
* value which will be assigned to name attribute in case where
|
|
32 |
* object have classification equals enum
|
|
33 |
* @param name
|
|
34 |
* text which is assigned to value attribute or to type attribute
|
|
35 |
* @param type
|
|
36 |
* name of data type that will be assigned to name attribute in
|
|
37 |
* case where object classification equals compound
|
|
38 |
*/
|
|
39 |
public static void writeTypeMember(int value, String name, String type) {
|
|
40 |
StringBuffer sb = new StringBuffer();
|
|
41 |
sb.append(TagWriter.TYPEMEMBER_START_OPEN);
|
|
42 |
TagWriter.appendAttribute(sb, TagWriter.VALUE_ATTR, String
|
|
43 |
.valueOf(value), false);
|
|
44 |
TagWriter.appendAttribute(sb, TagWriter.NAME_ATTR, name, true);
|
|
45 |
if (type != null) { // optional attribute
|
|
46 |
TagWriter.appendAttribute(sb, TagWriter.TYPE_ATTR, type, true);
|
|
47 |
}
|
|
48 |
sb.append(TagWriter.TAG_END);
|
|
49 |
TagWriter.write(sb.toString(), TagWriter.INDENT_3);
|
|
50 |
}
|
|
51 |
|
|
52 |
}
|