| | 1 | | using ValidateLib.Metadata.Descriptors; |
| | 2 | | using ValidateLib.TabularData.Datatypes.DateDatatypes; |
| | 3 | | using ValidateLib.TabularData.Datatypes.DurationDatatypes; |
| | 4 | | using ValidateLib.TabularData.Datatypes.NumericDatatypes; |
| | 5 | | using ValidateLib.TabularData.Datatypes.StringDatatypes; |
| | 6 | |
|
| | 7 | | namespace ValidateLib.TabularData.Datatypes |
| | 8 | | { |
| | 9 | | public class DatatypeFactory |
| | 10 | | { |
| | 11 | | public static BaseDT GetDatatype(string? strValue, string baseType, FormatDescriptor? format) |
| | 12 | | { |
| | 13 | | switch (baseType) |
| | 14 | | { |
| | 15 | | case "anyAtomicType": |
| | 16 | | case "any": |
| 0 | 17 | | return ProduceAny(strValue, format); |
| | 18 | | case "anyURI": |
| 1 | 19 | | return ProduceAnyUri(strValue, format); |
| | 20 | | case "base64Binary": |
| | 21 | | case "binary": |
| 1 | 22 | | return ProduceBinary(strValue, format); |
| | 23 | | case "boolean": |
| 1 | 24 | | return ProduceBoolean(strValue, format); |
| | 25 | | case "date": |
| 1 | 26 | | return ProduceDate(strValue, format); |
| | 27 | | case "dateTime": |
| | 28 | | case "datetime": |
| 1 | 29 | | return ProduceDateTime(strValue, format); |
| | 30 | | case "dateTimeStamp": |
| 1 | 31 | | return ProduceDateTimeStamp(strValue, format); |
| | 32 | | case "decimal": |
| 1 | 33 | | return ProduceDecimal(strValue, format); |
| | 34 | | case "integer": |
| 1 | 35 | | return ProduceInteger(strValue, format); |
| | 36 | | case "long": |
| 1 | 37 | | return ProduceLong(strValue, format); |
| | 38 | | case "int": |
| 1 | 39 | | return ProduceInt(strValue, format); |
| | 40 | | case "short": |
| 1 | 41 | | return ProduceShort(strValue, format); |
| | 42 | | case "byte": |
| 1 | 43 | | return ProduceByte(strValue, format); |
| | 44 | | case "nonNegativeInteger": |
| 1 | 45 | | return ProduceNonNegativeInteger(strValue, format); |
| | 46 | | case "positiveInteger": |
| 1 | 47 | | return ProducePositiveInteger(strValue, format); |
| | 48 | | case "unsignedLong": |
| 1 | 49 | | return ProduceUnsignedLong(strValue, format); |
| | 50 | | case "unsignedInt": |
| 1 | 51 | | return ProduceUnsignedInt(strValue, format); |
| | 52 | | case "unsignedShort": |
| 1 | 53 | | return ProduceUnsignedShort(strValue, format); |
| | 54 | | case "unsignedByte": |
| 1 | 55 | | return ProduceUnsignedByte(strValue, format); |
| | 56 | | case "nonPositiveInteger": |
| 1 | 57 | | return ProduceNonPositiveInteger(strValue, format); |
| | 58 | | case "negativeInteger": |
| 1 | 59 | | return ProduceNegativeInteger(strValue, format); |
| | 60 | | case "double": |
| | 61 | | case "number": |
| 1 | 62 | | return ProduceDouble(strValue, format); |
| | 63 | | case "duration": |
| 1 | 64 | | return ProduceDuration(strValue, format); |
| | 65 | | case "dayTimeDuration": |
| 1 | 66 | | return ProduceDayTimeDuration(strValue, format); |
| | 67 | | case "yearMonthDuration": |
| 1 | 68 | | return ProduceYearMonthDuration(strValue, format); |
| | 69 | | case "float": |
| 1 | 70 | | return ProduceFloat(strValue, format); |
| | 71 | | case "gDay": |
| 1 | 72 | | return ProduceGDay(strValue, format); |
| | 73 | | case "gMonth": |
| 1 | 74 | | return ProduceGMonth(strValue, format); |
| | 75 | | case "gMonthDay": |
| 1 | 76 | | return ProduceGMonthDay(strValue, format); |
| | 77 | | case "gYear": |
| 1 | 78 | | return ProduceGYear(strValue, format); |
| | 79 | | case "gYearMonth": |
| 1 | 80 | | return ProduceGYearMonth(strValue, format); |
| | 81 | | case "hexBinary": |
| 1 | 82 | | return ProduceHexBinary(strValue, format); |
| | 83 | | case "QName": |
| 1 | 84 | | return ProduceQName(strValue, format); |
| | 85 | | case "string": |
| 1 | 86 | | return ProduceString(strValue, format); |
| | 87 | | case "normalizedString": |
| 1 | 88 | | return ProduceNormalizedString(strValue, format); |
| | 89 | | case "token": |
| 1 | 90 | | return ProduceToken(strValue, format); |
| | 91 | | case "language": |
| 1 | 92 | | return ProduceLanguage(strValue, format); |
| | 93 | | case "Name": |
| 1 | 94 | | return ProduceName(strValue, format); |
| | 95 | | case "NMTOKEN": |
| 1 | 96 | | return ProduceNMTOKEN(strValue, format); |
| | 97 | | case "xml": |
| 1 | 98 | | return ProduceXml(strValue!, format); |
| | 99 | | case "html": |
| 0 | 100 | | return ProduceHtml(strValue, format); |
| | 101 | | case "json": |
| 0 | 102 | | return ProduceJson(strValue, format); |
| | 103 | | case "time": |
| 1 | 104 | | return ProduceTime(strValue, format); |
| | 105 | | default: |
| 0 | 106 | | throw new ArgumentException(); |
| | 107 | | } |
| | 108 | |
|
| | 109 | | } |
| | 110 | |
|
| | 111 | | static BaseDT ProduceAny(string? strValue, FormatDescriptor? format) |
| | 112 | | { |
| 0 | 113 | | if (strValue == null) |
| 0 | 114 | | return new AnyAtomicTypeDT(); |
| 0 | 115 | | if (format == null) |
| 0 | 116 | | return new AnyAtomicTypeDT(strValue); |
| | 117 | | else |
| 0 | 118 | | return new AnyAtomicTypeDT(strValue, format); |
| | 119 | | } |
| | 120 | |
|
| | 121 | | static BaseDT ProduceAnyUri(string? strValue, FormatDescriptor? format) |
| | 122 | | { |
| 1 | 123 | | if (strValue == null) |
| 1 | 124 | | return new AnyUriDT(); |
| 1 | 125 | | if (format == null) |
| 1 | 126 | | return new AnyUriDT(strValue); |
| | 127 | | else |
| 1 | 128 | | return new AnyUriDT(strValue, format); |
| | 129 | | } |
| | 130 | |
|
| | 131 | | static BaseDT ProduceBinary(string? strValue, FormatDescriptor? format) |
| | 132 | | { |
| 1 | 133 | | if (strValue == null) |
| 1 | 134 | | return new Base64BinaryDT(); |
| 1 | 135 | | if (format == null) |
| 1 | 136 | | return new Base64BinaryDT(strValue); |
| | 137 | | else |
| 0 | 138 | | return new Base64BinaryDT(strValue, format); |
| | 139 | | } |
| | 140 | |
|
| | 141 | | static BaseDT ProduceBoolean(string? strValue, FormatDescriptor? format) |
| | 142 | | { |
| 1 | 143 | | if (strValue == null) |
| 1 | 144 | | return new BooleanDT(); |
| 1 | 145 | | if (format == null) |
| 1 | 146 | | return new BooleanDT(strValue); |
| | 147 | | else |
| 1 | 148 | | return new BooleanDT(strValue, format); |
| | 149 | | } |
| | 150 | |
|
| | 151 | | static BaseDT ProduceDate(string? strValue, FormatDescriptor? format) |
| | 152 | | { |
| 1 | 153 | | if (strValue == null) |
| 1 | 154 | | return new DateDT(); |
| 1 | 155 | | if (format is null) |
| 1 | 156 | | return new DateDT(strValue, new FormatDescriptor()); |
| 1 | 157 | | return new DateDT(strValue, format); |
| | 158 | | } |
| | 159 | | // |
| | 160 | | static BaseDT ProduceDateTime(string? strValue, FormatDescriptor? format) |
| | 161 | | { |
| 1 | 162 | | if (strValue == null) |
| 1 | 163 | | return new DateTimeDT(); |
| 1 | 164 | | if (format is null) |
| 1 | 165 | | return new DateTimeDT(strValue, new FormatDescriptor()); |
| 1 | 166 | | return new DateTimeDT(strValue, format); |
| | 167 | | } |
| | 168 | |
|
| | 169 | | static BaseDT ProduceDateTimeStamp(string? strValue, FormatDescriptor? format) |
| | 170 | | { |
| 1 | 171 | | if (strValue == null) |
| 1 | 172 | | return new DateTimeStampDT(); |
| 1 | 173 | | if (format is null) |
| 1 | 174 | | return new DateTimeStampDT(strValue, new FormatDescriptor()); |
| 1 | 175 | | return new DateTimeStampDT(strValue, format); |
| | 176 | | } |
| | 177 | |
|
| | 178 | |
|
| | 179 | | static BaseDT ProduceDecimal(string? strValue, FormatDescriptor? format) |
| | 180 | | { |
| 1 | 181 | | if (strValue == null) |
| 1 | 182 | | return new DecimalDT(); |
| 1 | 183 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 184 | | return new DecimalDT(strValue); |
| | 185 | | else |
| 1 | 186 | | return new DecimalDT(strValue, format); |
| | 187 | | } |
| | 188 | |
|
| | 189 | | static BaseDT ProduceInteger(string? strValue, FormatDescriptor? format) |
| | 190 | | { |
| 1 | 191 | | if (strValue == null) |
| 1 | 192 | | return new IntegerDT(); |
| 1 | 193 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 194 | | return new IntegerDT(strValue); |
| | 195 | | else |
| 1 | 196 | | return new IntegerDT(strValue, format); |
| | 197 | | } |
| | 198 | |
|
| | 199 | | static BaseDT ProduceLong(string? strValue, FormatDescriptor? format) |
| | 200 | | { |
| 1 | 201 | | if (strValue == null) |
| 1 | 202 | | return new LongDT(); |
| 1 | 203 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 204 | | return new LongDT(strValue); |
| | 205 | | else |
| 0 | 206 | | return new LongDT(strValue, format); |
| | 207 | | } |
| | 208 | | static BaseDT ProduceInt(string? strValue, FormatDescriptor? format) |
| | 209 | | { |
| 1 | 210 | | if (strValue == null) |
| 1 | 211 | | return new IntDT(); |
| 1 | 212 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 213 | | return new IntDT(strValue); |
| | 214 | | else |
| 0 | 215 | | return new IntDT(strValue, format); |
| | 216 | | } |
| | 217 | | static BaseDT ProduceShort(string? strValue, FormatDescriptor? format) |
| | 218 | | { |
| 1 | 219 | | if (strValue == null) |
| 1 | 220 | | return new ShortDT(); |
| 1 | 221 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 222 | | return new ShortDT(strValue); |
| | 223 | | else |
| 0 | 224 | | return new ShortDT(strValue, format); |
| | 225 | | } |
| | 226 | | static BaseDT ProduceByte(string? strValue, FormatDescriptor? format) |
| | 227 | | { |
| 1 | 228 | | if (strValue == null) |
| 1 | 229 | | return new ByteDT(); |
| 1 | 230 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 231 | | return new ByteDT(strValue); |
| | 232 | | else |
| 0 | 233 | | return new ByteDT(strValue, format); |
| | 234 | | } |
| | 235 | | static BaseDT ProduceNonNegativeInteger(string? strValue, FormatDescriptor? format) |
| | 236 | | { |
| 1 | 237 | | if (strValue == null) |
| 1 | 238 | | return new NonNegativeIntegerDT(); |
| 1 | 239 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 240 | | return new NonNegativeIntegerDT(strValue); |
| | 241 | | else |
| 0 | 242 | | return new NonNegativeIntegerDT(strValue, format); |
| | 243 | | } |
| | 244 | | static BaseDT ProducePositiveInteger(string? strValue, FormatDescriptor? format) |
| | 245 | | { |
| 1 | 246 | | if (strValue == null) |
| 1 | 247 | | return new DateDT(); |
| 1 | 248 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 249 | | return new PositiveIntegerDT(strValue); |
| | 250 | | else |
| 0 | 251 | | return new PositiveIntegerDT(strValue, format); |
| | 252 | | } |
| | 253 | | static BaseDT ProduceUnsignedLong(string? strValue, FormatDescriptor? format) |
| | 254 | | { |
| 1 | 255 | | if (strValue == null) |
| 1 | 256 | | return new UnsignedLongDT(); |
| 1 | 257 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 258 | | return new UnsignedLongDT(strValue); |
| | 259 | | else |
| 0 | 260 | | return new UnsignedLongDT(strValue, format); |
| | 261 | | } |
| | 262 | | static BaseDT ProduceUnsignedInt(string? strValue, FormatDescriptor? format) |
| | 263 | | { |
| 1 | 264 | | if (strValue == null) |
| 1 | 265 | | return new UnsignedIntDT(); |
| 1 | 266 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 267 | | return new UnsignedIntDT(strValue); |
| | 268 | | else |
| 0 | 269 | | return new UnsignedIntDT(strValue, format); |
| | 270 | | } |
| | 271 | | static BaseDT ProduceUnsignedShort(string? strValue, FormatDescriptor? format) |
| | 272 | | { |
| 1 | 273 | | if (strValue == null) |
| 1 | 274 | | return new UnsignedShortDT(); |
| 1 | 275 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 276 | | return new UnsignedShortDT(strValue); |
| | 277 | | else |
| 0 | 278 | | return new UnsignedShortDT(strValue, format); |
| | 279 | | } |
| | 280 | | static BaseDT ProduceUnsignedByte(string? strValue, FormatDescriptor? format) |
| | 281 | | { |
| 1 | 282 | | if (strValue == null) |
| 1 | 283 | | return new UnsignedByteDT(); |
| 1 | 284 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 285 | | return new UnsignedByteDT(strValue); |
| | 286 | | else |
| 0 | 287 | | return new UnsignedByteDT(strValue, format); |
| | 288 | | } |
| | 289 | | static BaseDT ProduceNonPositiveInteger(string? strValue, FormatDescriptor? format) |
| | 290 | | { |
| 1 | 291 | | if (strValue == null) |
| 1 | 292 | | return new NonPositiveIntegerDT(); |
| 1 | 293 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 294 | | return new NonPositiveIntegerDT(strValue); |
| | 295 | | else |
| 0 | 296 | | return new NonPositiveIntegerDT(strValue, format); |
| | 297 | | } |
| | 298 | | static BaseDT ProduceNegativeInteger(string? strValue, FormatDescriptor? format) |
| | 299 | | { |
| 1 | 300 | | if (strValue == null) |
| 1 | 301 | | return new NegativeIntegerDT(); |
| 1 | 302 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 303 | | return new NegativeIntegerDT(strValue); |
| | 304 | | else |
| 0 | 305 | | return new NegativeIntegerDT(strValue, format); |
| | 306 | | } |
| | 307 | | static BaseDT ProduceDouble(string? strValue, FormatDescriptor? format) |
| | 308 | | { |
| 1 | 309 | | if (strValue == null) |
| 1 | 310 | | return new DoubleDT(); |
| 1 | 311 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 312 | | return new DoubleDT(strValue); |
| | 313 | | else |
| 1 | 314 | | return new DoubleDT(strValue, format); |
| | 315 | | } |
| | 316 | | static BaseDT ProduceFloat(string? strValue, FormatDescriptor? format) |
| | 317 | | { |
| 1 | 318 | | if (strValue == null) |
| 1 | 319 | | return new FloatDT(); |
| 1 | 320 | | if (format == null || format.pattern is null && format.decimalChar is null && format.groupChar is null) |
| 1 | 321 | | return new FloatDT(strValue); |
| | 322 | | else |
| 0 | 323 | | return new FloatDT(strValue, format); |
| | 324 | | } |
| | 325 | |
|
| | 326 | | static BaseDT ProduceDuration(string? strValue, FormatDescriptor? format) |
| | 327 | | { |
| 1 | 328 | | if (strValue == null) |
| 1 | 329 | | return new DurationDT(); |
| 1 | 330 | | if (format == null) |
| 1 | 331 | | return new DurationDT(strValue); |
| | 332 | | else |
| 1 | 333 | | return new DurationDT(strValue, format); |
| | 334 | | } |
| | 335 | |
|
| | 336 | |
|
| | 337 | | static BaseDT ProduceDayTimeDuration(string? strValue, FormatDescriptor? format) |
| | 338 | | { |
| 1 | 339 | | if (strValue == null) |
| 1 | 340 | | return new DayTimeDurationDT(); |
| 1 | 341 | | if (format == null) |
| 1 | 342 | | return new DayTimeDurationDT(strValue); |
| | 343 | | else |
| 1 | 344 | | return new DayTimeDurationDT(strValue, format); |
| | 345 | | } |
| | 346 | | static BaseDT ProduceYearMonthDuration(string? strValue, FormatDescriptor? format) |
| | 347 | | { |
| 1 | 348 | | if (strValue == null) |
| 1 | 349 | | return new YearMonthDurationDT(); |
| 1 | 350 | | if (format == null) |
| 1 | 351 | | return new YearMonthDurationDT(strValue); |
| | 352 | | else |
| 1 | 353 | | return new YearMonthDurationDT(strValue, format); |
| | 354 | | } |
| | 355 | | static BaseDT ProduceGDay(string? strValue, FormatDescriptor? format) |
| | 356 | | { |
| 1 | 357 | | if (strValue == null) |
| 1 | 358 | | return new GDayDT(); |
| 1 | 359 | | if (format == null) |
| 1 | 360 | | return new GDayDT(strValue); |
| | 361 | | else |
| 0 | 362 | | return new GDayDT(strValue, format); |
| | 363 | | } |
| | 364 | | static BaseDT ProduceGMonth(string? strValue, FormatDescriptor? format) |
| | 365 | | { |
| 1 | 366 | | if (strValue == null) |
| 1 | 367 | | return new GMonthDT(); |
| 1 | 368 | | if (format == null) |
| 1 | 369 | | return new GMonthDT(strValue); |
| | 370 | | else |
| 0 | 371 | | return new GMonthDT(strValue, format); |
| | 372 | | } |
| | 373 | | static BaseDT ProduceGMonthDay(string? strValue, FormatDescriptor? format) |
| | 374 | | { |
| 1 | 375 | | if (strValue == null) |
| 1 | 376 | | return new GMonthDayDT(); |
| 1 | 377 | | if (format == null) |
| 1 | 378 | | return new GMonthDayDT(strValue); |
| | 379 | | else |
| 0 | 380 | | return new GMonthDayDT(strValue, format); |
| | 381 | | } |
| | 382 | | static BaseDT ProduceGYear(string? strValue, FormatDescriptor? format) |
| | 383 | | { |
| 1 | 384 | | if (strValue == null) |
| 1 | 385 | | return new GYearDT(); |
| 1 | 386 | | if (format == null) |
| 1 | 387 | | return new GYearDT(strValue); |
| | 388 | | else |
| 0 | 389 | | return new GYearDT(strValue, format); |
| | 390 | | } |
| | 391 | | static BaseDT ProduceGYearMonth(string? strValue, FormatDescriptor? format) |
| | 392 | | { |
| 1 | 393 | | if (strValue == null) |
| 1 | 394 | | return new GYearMonthDT(); |
| 1 | 395 | | if (format == null) |
| 1 | 396 | | return new GYearMonthDT(strValue); |
| | 397 | | else |
| 0 | 398 | | return new GYearMonthDT(strValue, format); |
| | 399 | | } |
| | 400 | | static BaseDT ProduceHexBinary(string? strValue, FormatDescriptor? format) |
| | 401 | | { |
| 1 | 402 | | if (strValue == null) |
| 1 | 403 | | return new HexBinaryDT(); |
| 1 | 404 | | if (format == null) |
| 1 | 405 | | return new HexBinaryDT(strValue); |
| | 406 | | else |
| 0 | 407 | | return new HexBinaryDT(strValue, format); |
| | 408 | | } |
| | 409 | | static BaseDT ProduceQName(string? strValue, FormatDescriptor? format) |
| | 410 | | { |
| 1 | 411 | | if (strValue == null) |
| 0 | 412 | | return new QNameDT(); |
| 1 | 413 | | if (format == null) |
| 1 | 414 | | return new QNameDT(strValue); |
| | 415 | | else |
| 0 | 416 | | return new QNameDT(strValue, format); |
| | 417 | | } |
| | 418 | | static BaseDT ProduceString(string? strValue, FormatDescriptor? format) |
| | 419 | | { |
| 1 | 420 | | if (strValue == null) |
| 1 | 421 | | return new StringDT(); |
| 1 | 422 | | if (format == null) |
| 1 | 423 | | return new StringDT(strValue); |
| | 424 | | else |
| 1 | 425 | | return new StringDT(strValue, format); |
| | 426 | |
|
| | 427 | | } |
| | 428 | | static BaseDT ProduceNormalizedString(string? strValue, FormatDescriptor? format) |
| | 429 | | { |
| 1 | 430 | | if (strValue == null) |
| 1 | 431 | | return new NormalizedStringDT(); |
| 1 | 432 | | if (format == null) |
| 1 | 433 | | return new NormalizedStringDT(strValue); |
| | 434 | | else |
| 1 | 435 | | return new NormalizedStringDT(strValue, format); |
| | 436 | | } |
| | 437 | | static BaseDT ProduceToken(string? strValue, FormatDescriptor? format) |
| | 438 | | { |
| 1 | 439 | | if (strValue == null) |
| 0 | 440 | | return new TokenDT(); |
| 1 | 441 | | if (format == null) |
| 1 | 442 | | return new TokenDT(strValue); |
| | 443 | | else |
| 0 | 444 | | return new TokenDT(strValue, format); |
| | 445 | | } |
| | 446 | | static BaseDT ProduceLanguage(string? strValue, FormatDescriptor? format) |
| | 447 | | { |
| 1 | 448 | | if (strValue == null) |
| 0 | 449 | | return new LanguageDT(); |
| 1 | 450 | | if (format == null) |
| 1 | 451 | | return new LanguageDT(strValue); |
| | 452 | | else |
| 0 | 453 | | return new LanguageDT(strValue, format); |
| | 454 | | } |
| | 455 | | static BaseDT ProduceName(string? strValue, FormatDescriptor? format) |
| | 456 | | { |
| 1 | 457 | | if (strValue == null) |
| 0 | 458 | | return new NameDT(); |
| 1 | 459 | | if (format == null) |
| 1 | 460 | | return new NameDT(strValue); |
| | 461 | | else |
| 0 | 462 | | return new NameDT(strValue, format); |
| | 463 | | } |
| | 464 | | static BaseDT ProduceNMTOKEN(string? strValue, FormatDescriptor? format) |
| | 465 | | { |
| 1 | 466 | | if (strValue == null) |
| 1 | 467 | | return new NMTOKENDT(); |
| 1 | 468 | | if (format == null) |
| 1 | 469 | | return new NMTOKENDT(strValue); |
| | 470 | | else |
| 1 | 471 | | return new NMTOKENDT(strValue, format); |
| | 472 | | } |
| | 473 | | static BaseDT ProduceXml(string? strValue, FormatDescriptor? format) |
| | 474 | | { |
| 1 | 475 | | if (strValue == null) |
| 1 | 476 | | return new XmlDT(); |
| 1 | 477 | | if (format == null) |
| 1 | 478 | | return new XmlDT(strValue); |
| | 479 | | else |
| 0 | 480 | | return new XmlDT(strValue, format); |
| | 481 | | } |
| | 482 | | static BaseDT ProduceHtml(string? strValue, FormatDescriptor? format) |
| | 483 | | { |
| 0 | 484 | | if (strValue == null) |
| 0 | 485 | | return new HtmlDT(); |
| 0 | 486 | | if (format == null) |
| 0 | 487 | | return new HtmlDT(strValue); |
| | 488 | | else |
| 0 | 489 | | return new HtmlDT(strValue, format); |
| | 490 | | } |
| | 491 | | static BaseDT ProduceJson(string? strValue, FormatDescriptor? format) |
| | 492 | | { |
| 0 | 493 | | if (strValue == null) |
| 0 | 494 | | return new JsonDT(); |
| 0 | 495 | | if (format == null) |
| 0 | 496 | | return new JsonDT(strValue); |
| | 497 | | else |
| 0 | 498 | | return new JsonDT(strValue, format); |
| | 499 | | } |
| | 500 | | static BaseDT ProduceTime(string? strValue, FormatDescriptor? format) |
| | 501 | | { |
| 1 | 502 | | if (strValue == null) |
| 1 | 503 | | return new TimeDT(); |
| 1 | 504 | | if (format == null) |
| 1 | 505 | | return new TimeDT(strValue); |
| | 506 | | else |
| 1 | 507 | | return new TimeDT(strValue, format); |
| | 508 | | } |
| | 509 | |
|
| | 510 | | } |
| | 511 | | } |