1 /*******************************************************************************
2 * Copyright (c) 2011, 2014 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
.tracecompass
.ctf
.core
.event
.types
;
15 import org
.eclipse
.jdt
.annotation
.NonNull
;
16 import org
.eclipse
.tracecompass
.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.
25 * @author Matthew Khouzam
26 * @author Simon Marchi
28 public final class StringDefinition
extends Definition
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 private final String fString
;
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
44 * the parent declaration
45 * @param definitionScope
52 public StringDefinition(@NonNull StringDeclaration declaration
,
53 IDefinitionScope definitionScope
, @NonNull String fieldName
, String value
) {
54 super(declaration
, definitionScope
, fieldName
);
58 // ------------------------------------------------------------------------
59 // Getters/Setters/Predicates
60 // ------------------------------------------------------------------------
63 public StringDeclaration
getDeclaration() {
64 return (StringDeclaration
) super.getDeclaration();
68 * Gets the string (value)
72 public String
getValue() {
76 // ------------------------------------------------------------------------
78 // ------------------------------------------------------------------------
81 public String
toString() {
82 return '\"' + getValue() + '\"';