1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.ctf
.core
.event
.types
;
16 * <b><u>StringDeclaration</u></b>
18 public class StringDeclaration
implements IDeclaration
{
20 // ------------------------------------------------------------------------
22 // ------------------------------------------------------------------------
24 private Encoding encoding
= Encoding
.UTF8
;
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
31 * Generate a UTF8 string declaration
33 public StringDeclaration() {
37 * generate an encoded string declaration
38 * @param encoding the encoding, utf8 or ascii
40 public StringDeclaration(Encoding encoding
) {
41 this.encoding
= encoding
;
44 // ------------------------------------------------------------------------
45 // Getters/Setters/Predicates
46 // ------------------------------------------------------------------------
50 * @return the character encoding.
52 public Encoding
getEncoding() {
58 * @param encoding the character encoding to set
60 public void setEncoding(Encoding encoding
) {
61 this.encoding
= encoding
;
65 public long getAlignment() {
66 return 8; //FIXME: should be the elementtype.
68 // ------------------------------------------------------------------------
70 // ------------------------------------------------------------------------
73 public StringDefinition
createDefinition(IDefinitionScope definitionScope
,
75 return new StringDefinition(this, definitionScope
, fieldName
);
79 public String
toString() {
80 /* Only used for debugging */
81 return "[declaration] string[" + Integer
.toHexString(hashCode()) + ']'; //$NON-NLS-1$