0
|
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 |
*/
|
|
17 |
|
|
18 |
package com.nokia.s60tools.appdep.core.model;
|
|
19 |
|
|
20 |
import com.nokia.s60tools.appdep.exceptions.ZeroFunctionOrdinalException;
|
|
21 |
|
|
22 |
/**
|
|
23 |
* Data placeholder for import function data.
|
|
24 |
*/
|
|
25 |
public class ImportFunctionData extends AbstractFunctionData{
|
|
26 |
|
|
27 |
//
|
|
28 |
// These indexes are used to access cache data
|
|
29 |
//
|
|
30 |
public static final int ORDINAL_FIELD_INDEX = 0; // This field count is to access cache data file
|
|
31 |
public static final int NAME_FIELD_INDEX = 1; // This field count is to access cache data file
|
|
32 |
public static final int ISVIRTUAL_FIELD_INDEX = 2; // This field count is to access cache data file
|
|
33 |
public static final int OFFSET_FIELD_INDEX = 3; // This field count is to access cache data file
|
|
34 |
|
|
35 |
//
|
|
36 |
// NOTE: Column indeces must start from zero (0) and
|
|
37 |
// the columns must be added in ascending numeric
|
|
38 |
// order.
|
|
39 |
//
|
|
40 |
public static final int ORDINAL_COLUMN_INDEX = 0; // This field count is for UI
|
|
41 |
public static final int NAME_COLUMN_INDEX = 1; // This field count is for UI
|
|
42 |
public static final int OFFSET_COLUMN_INDEX = 2; // This field count is for UI
|
|
43 |
|
|
44 |
/**
|
|
45 |
* <code>true</code> if function is virtual, otherwise <code>false</code>.
|
|
46 |
*/
|
|
47 |
private final boolean isVirtual;
|
|
48 |
/**
|
|
49 |
* Function offset.
|
|
50 |
*/
|
|
51 |
private final String functionOffset;
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Constructor.
|
|
55 |
* @param functionOrdinal Function ordinal (1..n when converted into integer).
|
|
56 |
* @param functionName Function name.
|
|
57 |
* @param isVirtual <code>true</code> if function is virtual, otherwise <code>false</code>.
|
|
58 |
* @param functionOffset Function offset.
|
|
59 |
* @throws IllegalArgumentException
|
|
60 |
* @throws ZeroFunctionOrdinalException
|
|
61 |
*/
|
|
62 |
public ImportFunctionData(String functionOrdinal, String functionName, boolean isVirtual, String functionOffset) throws IllegalArgumentException, ZeroFunctionOrdinalException{
|
|
63 |
super(functionOrdinal, functionName);
|
|
64 |
this.isVirtual = isVirtual;
|
|
65 |
this.functionOffset = functionOffset;
|
|
66 |
}
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Checks if function is virtual of not.
|
|
70 |
* @return <code>true</code> in case is virtual, otherwise <code>false</code>.
|
|
71 |
*/
|
|
72 |
public boolean isVirtual() {
|
|
73 |
return isVirtual;
|
|
74 |
}
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Gets function offset
|
|
78 |
* @return the functionOffset
|
|
79 |
*/
|
|
80 |
public int getFunctionOffset() {
|
|
81 |
return Integer.parseInt(functionOffset);
|
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Getting string representation for function offset. Only valid for virtual functions.
|
|
86 |
* @return the functionOffset
|
|
87 |
*/
|
|
88 |
public String getFunctionOffsetAsString() {
|
|
89 |
// Returning empty string for non-virtual function that do not really have offset.
|
|
90 |
if(!isVirtual()){
|
|
91 |
return ""; //$NON-NLS-1$
|
|
92 |
}
|
|
93 |
return functionOffset;
|
|
94 |
}
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Sets function name for the given imported function data.
|
|
98 |
* This is needed in order to set function name in case it is resolved
|
|
99 |
* later on by help of the user interaction that provides additional
|
|
100 |
* information.
|
|
101 |
* @param functionName Function name to be set.
|
|
102 |
*/
|
|
103 |
public void setFunctionName(String functionName) {
|
|
104 |
this.functionName = functionName;
|
|
105 |
}
|
|
106 |
|
|
107 |
}
|