stringcode.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*====================================================================*
  2. - Copyright (C) 2001 Leptonica. All rights reserved.
  3. -
  4. - Redistribution and use in source and binary forms, with or without
  5. - modification, are permitted provided that the following conditions
  6. - are met:
  7. - 1. Redistributions of source code must retain the above copyright
  8. - notice, this list of conditions and the following disclaimer.
  9. - 2. Redistributions in binary form must reproduce the above
  10. - copyright notice, this list of conditions and the following
  11. - disclaimer in the documentation and/or other materials
  12. - provided with the distribution.
  13. -
  14. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
  18. - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19. - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  21. - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  22. - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  23. - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *====================================================================*/
  26. #ifndef LEPTONICA_STRINGCODE_H
  27. #define LEPTONICA_STRINGCODE_H
  28. /*!
  29. * \file stringcode.h
  30. *
  31. * Data structure to hold accumulating generated code for storing
  32. * and extracing serializable leptonica objects (e.g., pixa, recog).
  33. *
  34. * Also a flag for selecting a string from the L_GenAssoc struct
  35. * in stringcode.
  36. */
  37. struct L_StrCode
  38. {
  39. l_int32 fileno; /*!< index for function and output file names */
  40. l_int32 ifunc; /*!< index into struct currently being stored */
  41. SARRAY *function; /*!< store case code for extraction */
  42. SARRAY *data; /*!< store base64 encoded data as strings */
  43. SARRAY *descr; /*!< store line in description table */
  44. l_int32 n; /*!< number of data strings */
  45. };
  46. typedef struct L_StrCode L_STRCODE;
  47. /*! Select string in stringcode for a specific serializable data type */
  48. enum {
  49. L_STR_TYPE = 0, /*!< typedef for the data type */
  50. L_STR_NAME = 1, /*!< name of the data type */
  51. L_STR_READER = 2, /*!< reader to get the data type from file */
  52. L_STR_MEMREADER = 3 /*!< reader to get the compressed string in memory */
  53. };
  54. #endif /* LEPTONICA_STRINGCODE_H */