]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/SamFormatPrinter_p.h
8250db660cab02e545f4fbbc505a4083a1b6064b
[bamtools.git] / src / api / internal / SamFormatPrinter_p.h
1 // ***************************************************************************
2 // SamFormatPrinter.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 23 December 2010 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides functionality for printing formatted SAM header to string
8 // ***************************************************************************
9
10 #ifndef SAM_FORMAT_PRINTER_H
11 #define SAM_FORMAT_PRINTER_H
12
13 //  -------------
14 //  W A R N I N G
15 //  -------------
16 //
17 // This file is not part of the BamTools API.  It exists purely as an
18 // implementation detail. This header file may change from version to version
19 // without notice, or even be removed.
20 //
21 // We mean it.
22
23 #include <sstream>
24 #include <string>
25
26 namespace BamTools {
27
28 class SamHeader;
29
30 namespace Internal {
31
32 class SamFormatPrinter {
33
34     // ctor & dtor
35     public:
36         SamFormatPrinter(const BamTools::SamHeader& header);
37         ~SamFormatPrinter(void);
38
39     // generates SAM-formatted string from header data
40     public:
41         const std::string ToString(void) const;
42
43     // internal methods
44     private:
45         const std::string FormatTag(const std::string& tag, const std::string& value) const;
46         void PrintHD(std::stringstream& out) const;
47         void PrintSQ(std::stringstream& out) const;
48         void PrintRG(std::stringstream& out) const;
49         void PrintPG(std::stringstream& out) const;
50         void PrintCO(std::stringstream& out) const;
51
52     // data members
53     private:
54         const SamHeader& m_header;
55 };
56
57 } // namespace Internal
58 } // namespace BamTools
59
60 #endif // SAM_FORMAT_PRINTER_H