* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * */ namespace libgpx; /** * A GPX data type. * * @author Andy Street */ abstract class DataType { /** * A name. * * @var string */ protected $name; /** * A comment. * * Sent to GPS as comment. * * @var string */ protected $comment; /** * A text description. * * Holds additional information about the element intended for the user, * not the GPS. * * @var string */ protected $description; /** * Source of data. * * Included to give user some idea of reliability and accuracy of data. * E.g. "Garmin eTrex", "USGS quad Boston North". * * @var string */ protected $source; /** * A list of associated links. * * @var TypedDoublyLinkedList (Link) */ protected $links; /** * Type (classification). * * @var string */ protected $type; /** * A list of XML snippets describing unsupported data. * * @var TypedDoublyLinkedList (string) */ protected $extensions; /** * Fetch the name. * * @return string|null The name or null if not set. */ public function getName() { return $this->name; } /** * Set the name. * * @param string $name The name or null to delete. * @return void */ public function setName(string $name = null) { $this->name = $name; } /** * Fetch a comment. * * @return string The comment or null if not set. */ public function getComment() { return $this->comment; } /** * Set a comment. * * @param string $comment The comment or null to delete. * @return void */ public function setComment(string $comment = null) { $this->comment = $comment; } /** * Fetch the description. * * @return string The description or null if not set. */ public function getDescription() { return $this->description; } /** * Set the description. * * @param string $description The description or null to delete. * @return void */ public function setDescription(string $description = null) { $this->description = $description; } /** * Fetch the source of the data. * * @return string|null The source or null if not set. */ public function getSource() { return $this->source; } /** * Set the source of the data. * * @param string $source The source of the data or null to delete. * @return void */ public function setSource(string $source = null) { $this->source = $source; } /** * Fetch a list of associated links. * * @param boolean $create Create the list if it does not already exist. * @return TypedDoublyLinkedList|null A list of Link objects. */ public function getLinks(bool $create = true) { if ($create && $this->links === null) $this->links = new TypedDoublyLinkedList('libgpx\Link'); return $this->links; } /** * Fetch the type. * * @return string|null The type or null if not set. */ public function getType() { return $this->type; } /** * Set the type. * * @param string $type The type or null to delete. * @return void */ public function setType(string $type = null) { $this->type = $type; } /** * Fetch a list of XML strings that describe unsupported elements. * * @param boolean $create Create the list if it does not already exist. * @return TypedDoublyLinkedList|null A list of XML strings. */ public function getExtensions(bool $create = true) { if ($create && $this->extensions === null) $this->extensions = new TypedDoublyLinkedList('string'); return $this->extensions; } }