cplkeywordparser.h

00001 /******************************************************************************
00002  * $Id: cplkeywordparser.h 20996 2010-10-28 18:38:15Z rouault $
00003  *
00004  * Project:  Common Portability Library
00005  * Purpose:  Implementation of CPLKeywordParser - a class for parsing
00006  *           the keyword format used for files like QuickBird .RPB files.
00007  *           This is a slight variation on the NASAKeywordParser used for
00008  *           the PDS/ISIS2/ISIS3 formats. 
00009  * Author:   Frank Warmerdam <warmerdam@pobox.com
00010  *
00011  ******************************************************************************
00012  * Copyright (c) 2008, Frank Warmerdam <warmerdam@pobox.com>
00013  * 
00014  * Permission is hereby granted, free of charge, to any person obtaining a
00015  * copy of this software and associated documentation files (the "Software"),
00016  * to deal in the Software without restriction, including without limitation
00017  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00018  * and/or sell copies of the Software, and to permit persons to whom the
00019  * Software is furnished to do so, subject to the following conditions:
00020  *
00021  * The above copyright notice and this permission notice shall be included
00022  * in all copies or substantial portions of the Software.
00023  *
00024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00025  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00026  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00027  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00028  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00029  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00030  * DEALINGS IN THE SOFTWARE.
00031  ****************************************************************************/
00032 
00033 #ifndef CPL_KEYWORD_PARSER
00034 #define CPL_KEYWORD_PARSER
00035 
00036 #include "cpl_string.h"
00037 
00038 /************************************************************************/
00039 /* ==================================================================== */
00040 /*                          CPLKeywordParser                          */
00041 /* ==================================================================== */
00042 /************************************************************************/
00043 
00044 class CPLKeywordParser
00045 {
00046     char     **papszKeywordList;
00047 
00048     CPLString osHeaderText;
00049     const char *pszHeaderNext;
00050 
00051     void    SkipWhite();
00052     int     ReadWord( CPLString &osWord );
00053     int     ReadPair( CPLString &osName, CPLString &osValue );
00054     int     ReadGroup( const char *pszPathPrefix );
00055 
00056 public:
00057     CPLKeywordParser();
00058     ~CPLKeywordParser();
00059 
00060     int     Ingest( VSILFILE *fp );
00061 
00062     const char *GetKeyword( const char *pszPath, const char *pszDefault=NULL );
00063     char  **GetAllKeywords() { return papszKeywordList; }
00064 };
00065 
00066 #endif /* def CPL_KEYWORD_PARSER */

Generated for GDAL by doxygen 1.7.1.