1 /*******************************************************************************
2 * Copyright (c) 2011, 2013 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
;
15 import org
.eclipse
.jdt
.annotation
.NonNull
;
16 import org
.eclipse
.linuxtools
.ctf
.core
.event
.scope
.IDefinitionScope
;
19 * A CTF string definition (similar to a C null-terminated byte array).
21 * Strings are an array of bytes of variable size and are terminated by a '\0'
22 * "NULL" character. Their encoding is described in the TSDL meta-data. In
23 * absence of encoding attribute information, the default encoding is UTF-8.
26 * @author Matthew Khouzam
27 * @author Simon Marchi
29 public final class StringDefinition
extends Definition
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 private final String fString
;
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
45 * the parent declaration
46 * @param definitionScope
54 public StringDefinition(@NonNull StringDeclaration declaration
,
55 IDefinitionScope definitionScope
, @NonNull String fieldName
, String value
) {
56 super(declaration
, definitionScope
, fieldName
);
60 // ------------------------------------------------------------------------
61 // Getters/Setters/Predicates
62 // ------------------------------------------------------------------------
65 public StringDeclaration
getDeclaration() {
66 return (StringDeclaration
) super.getDeclaration();
70 * Gets the string (value)
74 public String
getValue() {
78 // ------------------------------------------------------------------------
80 // ------------------------------------------------------------------------
83 public String
toString() {
84 return '\"' + getValue() + '\"';