76 bool result = (iStream.good());
79 m_error =
"Read Error: invalid stream.\n";
83 oss << iStream.rdbuf();
115 m_error =
"Read Error: empty seq entry.\n";
167 while (nextPos !=
NPOS && nFound < (
int) index) {
168 nextPos = s.find(
gt, pos);
169 if (nextPos !=
NPOS) {
178 if (pos !=
NPOS && nFound == (
int) index) {
179 nextPos = s.find(
nl, pos);
180 if (nextPos !=
NPOS) {
182 nextPos = nextPos - pos;
183 result = s.substr(pos, nextPos);
186 nextPos = s.find(
gt, pos);
187 if (nextPos !=
NPOS) {
188 nextPos = nextPos - pos - 1;
190 result = s.substr(pos, nextPos);
204 unsigned int i,
len = s.length();
205 for (
i = 0;
i <
len; ++
i) {
216 if (removeWhitespace) {
235 if (removeWhitespace) {
User-defined methods of the data storage class.
TReadFastaFlags m_readFastaFlags
virtual bool ReadFile(CNcbiIstream &iStream)
bool ReadAsSeqEntry(CNcbiIstream &iStream, CRef< CSeq_entry > &seqEntry)
string m_activeFastaString
virtual unsigned int GetNumRead() const
virtual string GetActiveSequence(unsigned int index, bool removeWhitespace=true) const
virtual string GetActiveDefline(unsigned int index) const
string GetSubstring(const string &s, unsigned int index, bool isDefline) const
virtual string GetRawDefline(unsigned int index) const
virtual string GetRawSequence(unsigned int index, bool removeWhitespace=true) const
CRef< CSeq_entry > m_seqEntry
Base class for reading FASTA sequences.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Simple implementation of ILineReader for i(o)streams.
Include a standard set of the NCBI C++ Toolkit most basic headers.
string RemoveWhitespace_CJL(const string &s)
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CRef< CSeq_entry > ReadSet(int max_seqs=kMax_Int, ILineErrorListener *pMessageListener=nullptr)
Read multiple sequences (by default, as many as are available.)
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
NCBI_NS_STD::string::size_type SIZE_TYPE
TSet & SetSet(void)
Select the variant.
const TSet & GetSet(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
bool IsSet(void) const
Check if variant Set is selected.
const TSeq_set & GetSeq_set(void) const
Get the Seq_set member data.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
The NCBI C++/STL use hints.
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.