gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.9KB

  1. /******************************************************************************
  2. * $Id: cplkeywordparser.h c39d156816d937c3139360b11786c769aeabd21e 2018-05-05 19:48:08 +0200 Even Rouault $
  3. *
  4. * Project: Common Portability Library
  5. * Purpose: Implementation of CPLKeywordParser - a class for parsing
  6. * the keyword format used for files like QuickBird .RPB files.
  7. * This is a slight variation on the NASAKeywordParser used for
  8. * the PDS/ISIS2/ISIS3 formats.
  9. * Author: Frank Warmerdam <warmerdam@pobox.com
  10. *
  11. ******************************************************************************
  12. * Copyright (c) 2008, Frank Warmerdam <warmerdam@pobox.com>
  13. *
  14. * Permission is hereby granted, free of charge, to any person obtaining a
  15. * copy of this software and associated documentation files (the "Software"),
  16. * to deal in the Software without restriction, including without limitation
  17. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  18. * and/or sell copies of the Software, and to permit persons to whom the
  19. * Software is furnished to do so, subject to the following conditions:
  20. *
  21. * The above copyright notice and this permission notice shall be included
  22. * in all copies or substantial portions of the Software.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  25. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  26. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  27. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  29. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  30. * DEALINGS IN THE SOFTWARE.
  31. ****************************************************************************/
  32. #ifndef CPL_KEYWORD_PARSER
  33. #define CPL_KEYWORD_PARSER
  34. #include "cpl_string.h"
  35. /************************************************************************/
  36. /* ==================================================================== */
  37. /* CPLKeywordParser */
  38. /* ==================================================================== */
  39. /************************************************************************/
  40. /*! @cond Doxygen_Suppress */
  41. class CPLKeywordParser
  42. {
  43. char **papszKeywordList = nullptr;
  44. CPLString osHeaderText{};
  45. const char *pszHeaderNext = nullptr;
  46. void SkipWhite();
  47. bool ReadWord( CPLString &osWord );
  48. bool ReadPair( CPLString &osName, CPLString &osValue );
  49. bool ReadGroup( const char *pszPathPrefix, int nRecLevel );
  50. CPL_DISALLOW_COPY_ASSIGN(CPLKeywordParser)
  51. public:
  52. CPLKeywordParser();
  53. ~CPLKeywordParser();
  54. int Ingest( VSILFILE *fp );
  55. const char *GetKeyword( const char *pszPath, const char *pszDefault=nullptr );
  56. char **GetAllKeywords() { return papszKeywordList; }
  57. };
  58. /*! @endcond */
  59. #endif /* def CPL_KEYWORD_PARSER */
上海开阖软件有限公司 沪ICP备12045867号-1