Remove all existing @since annotations
[deliverable/tracecompass.git] / org.eclipse.tracecompass.ctf.core / src / org / eclipse / tracecompass / ctf / core / event / types / StringDefinition.java
CommitLineData
866e5b51 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal and others
866e5b51
FC
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: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
12
f357bcd4 13package org.eclipse.tracecompass.ctf.core.event.types;
866e5b51 14
a4fa4e36 15import org.eclipse.jdt.annotation.NonNull;
f357bcd4 16import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
866e5b51
FC
17
18/**
d37aaa7f 19 * A CTF string definition (similar to a C null-terminated byte array).
486efb2e 20 *
d37aaa7f
FC
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.
24 *
d37aaa7f
FC
25 * @author Matthew Khouzam
26 * @author Simon Marchi
866e5b51 27 */
a4fa4e36 28public final class StringDefinition extends Definition {
866e5b51
FC
29
30 // ------------------------------------------------------------------------
31 // Attributes
32 // ------------------------------------------------------------------------
33
a4fa4e36 34 private final String fString;
866e5b51
FC
35
36 // ------------------------------------------------------------------------
37 // Constructors
38 // ------------------------------------------------------------------------
39
9ac2eb62
MK
40 /**
41 * Constructor
d6205f97
MK
42 *
43 * @param declaration
44 * the parent declaration
45 * @param definitionScope
46 * the parent scope
47 * @param fieldName
48 * the field name
a4fa4e36
MK
49 * @param value
50 * The String value
9ac2eb62 51 */
a4fa4e36
MK
52 public StringDefinition(@NonNull StringDeclaration declaration,
53 IDefinitionScope definitionScope, @NonNull String fieldName, String value) {
54 super(declaration, definitionScope, fieldName);
55 fString = value;
866e5b51
FC
56 }
57
58 // ------------------------------------------------------------------------
59 // Getters/Setters/Predicates
60 // ------------------------------------------------------------------------
61
9ac2eb62 62 @Override
866e5b51 63 public StringDeclaration getDeclaration() {
a4fa4e36 64 return (StringDeclaration) super.getDeclaration();
866e5b51
FC
65 }
66
9ac2eb62 67 /**
4f4b6212 68 * Gets the string (value)
d6205f97 69 *
4f4b6212 70 * @return the string
9ac2eb62 71 */
4f4b6212
EB
72 public String getValue() {
73 return fString;
866e5b51
FC
74 }
75
866e5b51
FC
76 // ------------------------------------------------------------------------
77 // Operations
78 // ------------------------------------------------------------------------
79
866e5b51
FC
80 @Override
81 public String toString() {
82 return '\"' + getValue() + '\"';
83 }
84
85}
This page took 0.057645 seconds and 5 git commands to generate.