diff trunk/src/dil/HtmlEntities.d @ 786:3b34f6a95a27

Added and revised documenation comments.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 24 Feb 2008 02:41:11 +0100
parents 0c10255d8009
children
line wrap: on
line diff
--- a/trunk/src/dil/HtmlEntities.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/HtmlEntities.d	Sun Feb 24 02:41:11 2008 +0100
@@ -6,12 +6,14 @@
 
 import common;
 
+/// A named HTML entity.
 struct Entity
 {
   char[] name;
-  uint value;
+  dchar value;
 }
 
+/// The table of named HTML entities.
 static const Entity[] namedEntities = [
   {"Aacute", '\u00C1'},
   {"aacute", '\u00E1'},
@@ -289,7 +291,7 @@
 char[] generateHashAndValueArrays()
 {
   uint[] hashes; // String hashes.
-  uint[] values; // Unicode codepoints.
+  dchar[] values; // Unicode codepoints.
   // Build arrays:
   foreach (entity; namedEntities)
   {
@@ -330,16 +332,19 @@
   return hashesText ~"\n"~ valuesText;
 }
 
-// Mixin:
-// private static const uint[] hashes;
-// private static const dchar[] values;
-mixin(generateHashAndValueArrays);
+version(DDoc)
+{
+  /// Table of hash values of the entities' names.
+  private static const uint[] hashes;
+  /// Table of Unicode codepoints.
+  private static const dchar[] values;
+}
+else
+  mixin(generateHashAndValueArrays);
 // pragma(msg, generateHashAndValueArrays());
 
-/++
-  Converts a named HTML entity into its equivalent Unicode codepoint.
-  Returns 0xFFFF if entity doesn't exist.
-+/
+/// Converts a named HTML entity into its equivalent Unicode codepoint.
+/// Returns: the entity's value or 0xFFFF if it doesn't exist.
 dchar entity2Unicode(char[] entity)
 {
   auto hash = stringToHash(entity);