]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/SamFormatParser_p.h
Added SAM header-handling classes for read/write/validate.
[bamtools.git] / src / api / internal / SamFormatParser_p.h
1 // ***************************************************************************
2 // SamFormatParser.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 23 December 2010 (DB)
7 // ---------------------------------------------------------------------------
8 // Provides functionality for parsing SAM header text into SamHeader object
9 // ***************************************************************************
10
11 #ifndef SAM_FORMAT_PARSER_H
12 #define SAM_FORMAT_PARSER_H
13
14 //  -------------
15 //  W A R N I N G
16 //  -------------
17 //
18 // This file is not part of the BamTools API.  It exists purely as an
19 // implementation detail. This header file may change from version to version
20 // without notice, or even be removed.
21 //
22 // We mean it.
23
24 #include <string>
25 #include <vector>
26
27 namespace BamTools {
28
29 class SamHeader;
30
31 namespace Internal {
32
33 class SamFormatParser {
34
35     // ctor & dtor
36     public:
37         SamFormatParser(BamTools::SamHeader& header);
38         ~SamFormatParser(void);
39
40     // parse text & populate header data
41     public:
42         void Parse(const std::string& headerText);
43
44     // internal methods
45     private:
46         void ParseSamLine(const std::string& line);
47         void ParseHDLine(const std::string& line);
48         void ParseSQLine(const std::string& line);
49         void ParseRGLine(const std::string& line);
50         void ParsePGLine(const std::string& line);
51         void ParseCOLine(const std::string& line);
52         const std::vector<std::string> Split(const std::string& line, const char delim);
53
54     // data members
55     private:
56         SamHeader& m_header;
57 };
58
59 } // namespace Internal
60 } // namespace BamTools
61
62 #endif // SAM_FORMAT_PARSER_H