r23206 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23205‎ | r23206 | r23207 >
Date:11:20, 22 June 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
extension of datavalue API (getTypeID, getWikiValue)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_OldDataValue.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_OldDataValue.php
@@ -377,6 +377,10 @@
378378 return $this->vxsd;
379379 }
380380
 381+ public function getWikiValue() {
 382+ return $this->vuser;
 383+ }
 384+
381385 /**
382386 * Return the numeric representation of the value, or NULL
383387 * is none is available. This representation is used to
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -158,6 +158,15 @@
159159 abstract public function getXSDValue();
160160
161161 /**
 162+ * Return the plain wiki version of the value, or
 163+ * FALSE if no such version is available. The returned
 164+ * string suffices to reobtain the same DataValue
 165+ * when passing it as an input string to setUserValue().
 166+ * Thus it also includes units, if any.
 167+ */
 168+ abstract public function getWikiValue();
 169+
 170+ /**
162171 * Return the numeric representation of the value, or NULL
163172 * is none is available. This representation is used to
164173 * compare values of scalar types more efficiently, especially
@@ -179,6 +188,13 @@
180189 abstract public function getError();
181190
182191 /**
 192+ * Return a short string that unambiguously specify the type of this value.
 193+ * This value will globally be used to identify the type of a value (in spite
 194+ * of the class it actually belongs to, which can still implement various types).
 195+ */
 196+ abstract public function getTypeID();
 197+
 198+ /**
183199 * Return an array of SMWLink objects that provide additional resources
184200 * for the given value.
185201 * Captions can contain some HTML markup which is admissible for wiki
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php
@@ -78,6 +78,10 @@
7979 }
8080 }
8181
 82+ public function getWikiValue() {
 83+ return implode('; ', $this->m_typevalues);
 84+ }
 85+
8286 public function getNumericValue() {
8387 return NULL;
8488 }
@@ -90,6 +94,10 @@
9195 return $this->m_error;
9296 }
9397
 98+ public function getTypeID() {
 99+ return 'types';
 100+ }
 101+
94102 public function getInfolinks() {
95103 return array();
96104 }

Status & tagging log