PDFSearchResult.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 
  2. namespace Paroxe.PdfRenderer
  3. {
  4. /// <summary>
  5. /// Reprensent a search result. To result location is describe with index of the first char and the length of the result.
  6. /// </summary>
  7. public struct PDFSearchResult
  8. {
  9. private readonly int m_PageIndex;
  10. private readonly int m_StartIndex; // index of the first character
  11. private readonly int m_Count; // number of characters
  12. public PDFSearchResult(int pageIndex, int startIndex, int count)
  13. {
  14. m_PageIndex = pageIndex;
  15. m_StartIndex = startIndex;
  16. m_Count = count;
  17. }
  18. /// <summary>
  19. /// Indicate whether the result is valid or invalid.
  20. /// </summary>
  21. public bool IsValid
  22. {
  23. get { return m_PageIndex != -1; }
  24. }
  25. /// <summary>
  26. /// The pageIndex of the result.
  27. /// </summary>
  28. public int PageIndex
  29. {
  30. get { return m_PageIndex; }
  31. }
  32. /// <summary>
  33. /// The index of the first character of the result within the page.
  34. /// </summary>
  35. public int StartIndex
  36. {
  37. get { return m_StartIndex; }
  38. }
  39. /// <summary>
  40. /// The length of the result within the page.
  41. /// </summary>
  42. public int Count
  43. {
  44. get { return m_Count; }
  45. }
  46. }
  47. }