NCBI C++ ToolKit
qual_parse.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: qual_parse.hpp 99335 2023-03-13 13:48:10Z stakhovv $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * File Name:
27  *
28  * Author: Frank Ludwig
29  *
30  * File Description:
31  *
32  */
33 
34 #ifndef FLATFILE__QUAL_PARSE__HPP
35 #define FLATFILE__QUAL_PARSE__HPP
36 
38 
39 #include "qual_validate.hpp"
40 
42 
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
46 {
47 public:
48  using DATA = vector<string>;
49 
51  Parser::EFormat fmt,
52  const string& featKey,
53  const string& featLocation,
54  const vector<string>& qualLines);
55  virtual ~CQualParser();
56 
57  virtual bool GetNextQualifier(
58  string& qualKey,
59  string& qualVal);
60 
61  bool Done() const;
62 
63 private:
65  string& qualKey,
66  string& qualVal,
67  bool& thereIsMore);
68 
70  const string& qualKey,
71  string& qualVal,
72  bool& thereIsMore);
73 
75  bool silent,
76  string& qualKey,
77  string& qualVal,
78  bool& thereIsMore);
79 
81  const string& qualKey,
82  string& qualVal,
83  bool& thereIsMore);
84 
85  bool xValidateSyntax( // rule:
86  const string& qualKey, // check syntax rules in the parser
87  const string& qualVal); // leave semantic rules for the validator
88 
89  static bool sIsLegalQual(
90  const string& qualKey);
91  static bool sHasBalancedQuotes(
92  const string& qualVal);
93 
94  void xQualValAppendLine(
95  const string& qualKey,
96  const string& line,
97  string& qualData);
98 
100  const string& mFeatKey;
101  const string& mFeatLocation;
103  const DATA& mData;
104  DATA::const_iterator mCurrent;
105  string mPendingKey;
106  string mPendingVal;
107 
110  const string::size_type mMaxChunkSize;
111 };
112 
114 
115 #endif // FLATFILE__QUAL_PARSE__HPP
void xQualValAppendLine(const string &qualKey, const string &line, string &qualData)
Definition: qual_parse.cpp:271
DATA::const_iterator mCurrent
Definition: qual_parse.hpp:104
Parser::EFormat mFlatFormat
Definition: qual_parse.hpp:99
virtual ~CQualParser()
Definition: qual_parse.cpp:64
static bool sIsLegalQual(const string &qualKey)
Definition: qual_parse.cpp:368
CQualParser(Parser::EFormat fmt, const string &featKey, const string &featLocation, const vector< string > &qualLines)
Definition: qual_parse.cpp:46
bool Done() const
Definition: qual_parse.cpp:360
vector< string > DATA
Definition: qual_parse.hpp:48
CQualCleanup mCleanerUpper
Definition: qual_parse.hpp:102
bool xParseQualifierCont(const string &qualKey, string &qualVal, bool &thereIsMore)
Definition: qual_parse.cpp:223
const DATA & mData
Definition: qual_parse.hpp:103
string mLastDataChunkForKey
Definition: qual_parse.hpp:109
string mPendingVal
Definition: qual_parse.hpp:106
virtual bool GetNextQualifier(string &qualKey, string &qualVal)
Definition: qual_parse.cpp:71
string mPendingKey
Definition: qual_parse.hpp:105
bool xParseQualifierTail(const string &qualKey, string &qualVal, bool &thereIsMore)
Definition: qual_parse.cpp:196
static bool sHasBalancedQuotes(const string &qualVal)
Definition: qual_parse.cpp:381
bool xParseQualifierHead(string &qualKey, string &qualVal, bool &thereIsMore)
Definition: qual_parse.cpp:107
bool xParseQualifierStart(bool silent, string &qualKey, string &qualVal, bool &thereIsMore)
Definition: qual_parse.cpp:124
const string & mFeatLocation
Definition: qual_parse.hpp:101
const string::size_type mMaxChunkSize
Definition: qual_parse.hpp:110
const string & mFeatKey
Definition: qual_parse.hpp:100
string mLastKeyForDataChunk
Definition: qual_parse.hpp:108
bool xValidateSyntax(const string &qualKey, const string &qualVal)
Definition: qual_parse.cpp:254
static int silent
Definition: done_handling.c:30
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Thu May 09 18:35:59 2024 by modify_doxy.py rev. 669887