| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System.Collections.Generic; |
| | | 5 | | |
| | | 6 | | namespace Azure.AI.FormRecognizer.Models |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// A form element representing text that is part of a <see cref="FormField"/>. |
| | | 10 | | /// This includes the location of the text in the form and a collection of the form |
| | | 11 | | /// elements that make up the text. |
| | | 12 | | /// </summary> |
| | | 13 | | public class FieldData : FormElement |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// </summary> |
| | | 17 | | /// <param name="formElement"></param> |
| | | 18 | | /// <param name="pageNumber"></param> |
| | | 19 | | /// <param name="boundingBox"></param> |
| | | 20 | | /// <param name="text"></param> |
| | | 21 | | internal FieldData(string text, int pageNumber, BoundingBox boundingBox, IReadOnlyList<FormElement> formElement) |
| | 1792 | 22 | | : base(boundingBox, pageNumber, text) |
| | | 23 | | { |
| | 1792 | 24 | | FieldElements = formElement; |
| | 1792 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// When `IncludeFieldElements` is set to <c>true</c>, a list of references to |
| | | 29 | | /// the field elements constituting this <see cref="FieldData"/>. An empty list otherwise. For calls to |
| | | 30 | | /// recognize content, this list is always populated. |
| | | 31 | | /// </summary> |
| | 2064 | 32 | | public IReadOnlyList<FormElement> FieldElements { get; } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Implicitly converts a <see cref="FieldData"/> instance into a <see cref="string"/>, using the |
| | | 36 | | /// value returned by <see cref="FormElement.Text"/>. |
| | | 37 | | /// </summary> |
| | | 38 | | /// <param name="text">The instance to be converted into a <see cref="string"/>.</param> |
| | | 39 | | /// <returns>The <see cref="string"/> corresponding to the recognized text.</returns> |
| | 0 | 40 | | public static implicit operator string(FieldData text) => text.Text; |
| | | 41 | | } |
| | | 42 | | } |