Commit | Line | Data |
---|---|---|
7b4f13e6 MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are made | |
5 | * available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.ctf.core.event.types; | |
14 | ||
15 | ||
16 | /** | |
17 | * Parent of sequences and arrays | |
18 | * | |
19 | * @author Matthew Khouzam | |
20 | * @since 3.1 | |
21 | */ | |
22 | public abstract class CompoundDeclaration extends Declaration { | |
23 | ||
24 | /** | |
25 | * Get the element type | |
26 | * | |
27 | * @return the type of element in the array | |
28 | */ | |
29 | public abstract IDeclaration getElementType(); | |
30 | ||
9377d173 MK |
31 | @Override |
32 | public long getAlignment() { | |
33 | return getElementType().getAlignment(); | |
34 | } | |
35 | ||
36 | /** | |
37 | * Sometimes, strings are encoded as an array of 1-byte integers (each one | |
38 | * being an UTF-8 byte). | |
39 | * | |
40 | * @return true if this array is in fact an UTF-8 string. false if it's a | |
41 | * "normal" array of generic Definition's. | |
42 | */ | |
43 | public boolean isString(){ | |
44 | IDeclaration elementType = getElementType(); | |
45 | if (elementType instanceof IntegerDeclaration) { | |
46 | IntegerDeclaration elemInt = (IntegerDeclaration) elementType; | |
47 | return elemInt.isCharacter(); | |
48 | } | |
49 | return false; | |
50 | } | |
51 | ||
7b4f13e6 | 52 | } |