]> Dogcows Code - chaz/carfire/blobdiff - CarFire/CarFire/CarFire/Parse.cs
git-svn-id: https://bd85.net/svn/cs3505_group@168 92bb83a3-7c8f-8a45-bc97-515c4e399668
[chaz/carfire] / CarFire / CarFire / CarFire / Parse.cs
index 2df3ca73028aadadc36013bb529593b988e38dfd..ca98353067cf4f55e0ad499aa235082d1e4e32a7 100644 (file)
@@ -10,7 +10,7 @@ namespace CarFire
     /// <summary>\r
     /// Class with handy static methods taking strings and returning objects\r
     /// parsed from those strings.  For all of these functions, white space is\r
-    /// generally ignored, but any superfluous characters will make the parse fail.\r
+    /// generally ignored, but superfluous characters are not allowed.\r
     /// </summary>\r
     public class Parse\r
     {\r
@@ -30,7 +30,7 @@ namespace CarFire
         /// Parses a comment of an INI file.\r
         /// </summary>\r
         /// <param name="line">Text.</param>\r
-        /// <returns>The comment.</returns>\r
+        /// <returns>The comment, or null if parsing failed.</returns>\r
         public static string IniComment(string line)\r
         {\r
             Match match = Regex.Match(line, @"^;\s*(.*)\s*$");\r
@@ -126,18 +126,18 @@ namespace CarFire
         /// </summary>\r
         /// <typeparam name="T">An enumeration.</typeparam>\r
         /// <param name="atom">Text.</param>\r
-        /// <returns>The constant, or default(T) if parsing failed.</returns>\r
-        public static T Constant<T>(string atom)\r
+        /// <returns>The constant, or null if parsing failed.</returns>\r
+        public static T? Constant<T>(string atom) where T : struct\r
         {\r
             try\r
             {\r
-                return (T)System.Enum.Parse(typeof(T), String(atom), true);\r
+                return (T)System.Enum.Parse(typeof(T), String(atom));\r
             }\r
 #pragma warning disable 0168\r
             catch (System.Exception ex)\r
 #pragma warning restore 0168\r
             {\r
-                return default(T);\r
+                return null;\r
             }\r
         }\r
 \r
@@ -181,7 +181,7 @@ namespace CarFire
         /// Parses a function.\r
         /// </summary>\r
         /// <param name="atom">Text.</param>\r
-        /// <returns>An array two strings containing the function name and\r
+        /// <returns>An array with two strings containing the function name and\r
         /// parameter-list, in that order, or null if parsing failed.</returns>\r
         public static string[] Function(string atom)\r
         {\r
This page took 0.026962 seconds and 4 git commands to generate.