ProteoWizard
Public Member Functions | Private Attributes
pwiz::proteome::TextWriter Class Reference

#include <TextWriter.hpp>

List of all members.

Public Member Functions

 TextWriter (std::ostream &os, int depth=0)
TextWriter child ()
TextWriteroperator() (const std::string &text)
template<typename object_type >
TextWriteroperator() (const std::string &label, const std::vector< object_type > &v)
TextWriteroperator() (const ProteomeData &pd, bool metadata_only=false)
TextWriteroperator() (const Protein &p)
TextWriteroperator() (const ProteinList &proteinList, bool metadata_only=false)
template<typename object_type >
TextWriteroperator() (const boost::shared_ptr< object_type > &p)

Private Attributes

std::ostream & os_
int depth_
std::string indent_

Detailed Description

Definition at line 39 of file TextWriter.hpp.


Constructor & Destructor Documentation

pwiz::proteome::TextWriter::TextWriter ( std::ostream &  os,
int  depth = 0 
)
inline

Definition at line 43 of file TextWriter.hpp.

: os_(os), depth_(depth), indent_(depth*2, ' ')
{}

Member Function Documentation

TextWriter pwiz::proteome::TextWriter::child ( )
inline

Definition at line 47 of file TextWriter.hpp.

References os_.

{return TextWriter(os_, depth_+1);}
TextWriter& pwiz::proteome::TextWriter::operator() ( const std::string &  text)
inline

Definition at line 49 of file TextWriter.hpp.

References os_.

{
os_ << indent_ << text << std::endl;
return *this;
}
template<typename object_type >
TextWriter& pwiz::proteome::TextWriter::operator() ( const std::string &  label,
const std::vector< object_type > &  v 
)
inline

Definition at line 56 of file TextWriter.hpp.

{
(*this)(label);
for_each(v.begin(), v.end(), child());
return *this;
}
TextWriter& pwiz::proteome::TextWriter::operator() ( const ProteomeData pd,
bool  metadata_only = false 
)
inline

Definition at line 64 of file TextWriter.hpp.

References pwiz::proteome::ProteomeData::id, and pwiz::proteome::ProteomeData::proteinListPtr.

{
(*this)("ProteomeData:");
("id: " + pd.id);
if (pd.proteinListPtr.get())
child()(*pd.proteinListPtr, metadata_only);
return *this;
}
TextWriter& pwiz::proteome::TextWriter::operator() ( const Protein p)
inline

Definition at line 76 of file TextWriter.hpp.

References pwiz::proteome::Protein::description, pwiz::proteome::Protein::id, pwiz::proteome::Protein::index, and pwiz::proteome::Peptide::sequence().

{
(*this)("protein:");
("id: " + p.id)
("index: " + p.index)
("description: " + p.description)
("sequence: " + p.sequence().substr(0, 10));
return *this;
}
TextWriter& pwiz::proteome::TextWriter::operator() ( const ProteinList proteinList,
bool  metadata_only = false 
)
inline

Definition at line 87 of file TextWriter.hpp.

References pwiz::proteome::ProteinList::protein(), and pwiz::proteome::ProteinList::size().

{
std::string text("proteinList (" + boost::lexical_cast<std::string>(proteinList.size()) + " proteins)");
if (!metadata_only)
text += ":";
(*this)(text);
if (!metadata_only)
for (size_t index = 0; index < proteinList.size(); ++index)
(*proteinList.protein(index, true));
return *this;
}
template<typename object_type >
TextWriter& pwiz::proteome::TextWriter::operator() ( const boost::shared_ptr< object_type > &  p)
inline

Definition at line 104 of file TextWriter.hpp.

{
return p.get() ? (*this)(*p) : *this;
}

Member Data Documentation

std::ostream& pwiz::proteome::TextWriter::os_
private

Definition at line 111 of file TextWriter.hpp.

int pwiz::proteome::TextWriter::depth_
private

Definition at line 112 of file TextWriter.hpp.

std::string pwiz::proteome::TextWriter::indent_
private

Definition at line 113 of file TextWriter.hpp.


The documentation for this class was generated from the following file: