5 * Copyright 2018 Andy Street <andy@street.me.uk>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30 * @author Andy Street <andy@street.me.uk>
32 abstract class DataType
45 * Sent to GPS as comment.
54 * Holds additional information about the element intended for the user,
59 protected $description;
64 * Included to give user some idea of reliability and accuracy of data.
65 * E.g. "Garmin eTrex", "USGS quad Boston North".
72 * A list of associated links.
74 * @var TypedDoublyLinkedList (Link)
79 * Type (classification).
86 * A list of XML snippets describing unsupported data.
88 * @var TypedDoublyLinkedList (string)
90 protected $extensions;
95 * @return string|null The name or null if not set.
97 public function getName()
105 * @param string $name The name or null to delete.
108 public function setName(string $name = null)
116 * @return string The comment or null if not set.
118 public function getComment()
120 return $this->comment;
126 * @param string $comment The comment or null to delete.
129 public function setComment(string $comment = null)
131 $this->comment = $comment;
135 * Fetch the description.
137 * @return string The description or null if not set.
139 public function getDescription()
141 return $this->description;
145 * Set the description.
147 * @param string $description The description or null to delete.
150 public function setDescription(string $description = null)
152 $this->description = $description;
156 * Fetch the source of the data.
158 * @return string|null The source or null if not set.
160 public function getSource()
162 return $this->source;
166 * Set the source of the data.
168 * @param string $source The source of the data or null to delete.
171 public function setSource(string $source = null)
173 $this->source = $source;
177 * Fetch a list of associated links.
179 * @param boolean $create Create the list if it does not already exist.
180 * @return TypedDoublyLinkedList|null A list of Link objects.
182 public function getLinks(bool $create = true)
184 if ($create && $this->links === null)
185 $this->links = new TypedDoublyLinkedList('libgpx\Link');
192 * @return string|null The type or null if not set.
194 public function getType()
202 * @param string $type The type or null to delete.
205 public function setType(string $type = null)
211 * Fetch a list of XML strings that describe unsupported elements.
213 * @param boolean $create Create the list if it does not already exist.
214 * @return TypedDoublyLinkedList|null A list of XML strings.
216 public function getExtensions(bool $create = true)
218 if ($create && $this->extensions === null)
219 $this->extensions = new TypedDoublyLinkedList('string');
220 return $this->extensions;