(filename !=
"-") {
56}
catch(exception& e) {
58 " CMemoryLineReader to CBufferedLineReader for " 59<< filename <<
" due to exception: "<< e.what());
80: m_Stream(&is, ownership), m_LineNumber(0), m_LastReadSize(0),
81m_UngetLine(
false), m_AutoEOL(eol_style == eEOL_unknown),
89: m_Stream(&is, ownership), m_LineNumber(0), m_LastReadSize(0),
90m_UngetLine(
false), m_AutoEOL(
true), m_EOLStyle(eEOL_unknown)
120 if(c ==
'\n'|| c ==
'\r') {
135 if(c ==
'\n'|| c ==
'\r') {
252 if(eol !=
'\n'|| pos !=
m_Line.size()) {
301: m_Start(static_cast<char*>(mem_file->GetPtr())),
302m_End(m_Start + mem_file->GetSize()),
304m_MemFile(mem_file, ownership),
360 const char* p =
m_Pos;
366 while( p <
m_End&& *p !=
'\r'&& *p !=
'\n') {
372 if(p + 1 <
m_End&& *p ==
'\r'&& p[1] ==
'\n') {
374}
else if(p <
m_End) {
419: m_Reader(reader, ownership),
421m_UngetLine(
false),
422m_BufferSize(32*1024),
423m_Buffer(new char[m_BufferSize]),
424m_Pos(m_Buffer.get()),
437m_UngetLine(
false),
438m_BufferSize(32*1024),
439m_Buffer(new char[m_BufferSize]),
440m_Pos(m_Buffer.get()),
452m_UngetLine(
false),
453m_BufferSize(32*1024),
454m_Buffer(new char[m_BufferSize]),
455m_Pos(m_Buffer.get()),
523 const char* start =
m_Pos;
524 const char* end =
m_End;
525 for(
const char* p = start; p < end; ++p ) {
537 else if( *p ==
'\r') {
573 const char* start =
m_Pos;
574 const char* end =
m_End;
579 for(
const char* p = start; p < end; ++p ) {
581 if( c ==
'\r'|| c ==
'\n') {
591 if( p < end && c ==
'\r'&& *p ==
'\n') {
599 if( c ==
'\r'&& *p ==
'\n') {
611 m_String.append(start, end - start);
629 for(
boolflag =
true; flag; ) {
Implementation of ILineReader for IReader.
Simple implementation of ILineReader for regions of memory (such as memory-mapped files).
Simple implementation of ILineReader for i(o)streams.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
A very basic data-read interface.
element_type * get(void) const
Get pointer.
element_type * get(void) const
Get pointer.
@ eTakeOwnership
An object can take ownership of another.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Info(CExceptionArgs_Base &args)
bool MemMapAdvise(EMemMapAdvise advise) const
Advise on memory map usage.
AutoArray< char > m_Buffer
CStreamLineReader(CNcbiIstream &is, EEOLStyle eol_style=eEOL_unknown, EOwnership ownership=eNoOwnership)
Open a line reader over a given stream, with the given EOL-style and ownership settings (if specified...
CMemoryLineReader(const char *start, const char *end)
Open a line reader over the half-open memory range [start, end).
void UngetLine(void)
Unget current line, which must be valid.
void UngetLine(void)
Unget current line, which must be valid.
char PeekChar(void) const
Returns the first character of the next string without consuming it.
char PeekChar(void) const
Returns the first character of the next string without consuming it.
CTempString operator*(void) const
Return the current line, minus its terminator.
AutoPtr< CMemoryFile > m_MemFile
void UngetLine(void)
Unget current line, which must be valid.
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
AutoPtr< IReader > m_Reader
CStreamLineReader & operator++(void)
Make a line available.
EEOLStyle x_AdvanceEOLSimple(char eol, char alt_eol)
char PeekChar(void) const
Returns the first character of the next string without consuming it.
CBufferedLineReader(IReader *reader, EOwnership ownership=eNoOwnership)
read from the IReader
CTempString operator*(void) const
Return the current line, minus its terminator.
CTempString operator*(void) const
Return the current line, minus its terminator.
bool AtEOF(void) const
Indicates (negatively) whether there is any more input.
Uint8 GetLineNumber(void) const
Returns the current line number (counting from 1, not 0).
CBufferedLineReader & operator++(void)
Make a line available.
Uint8 GetLineNumber(void) const
Returns the current line number (counting from 1, not 0).
AutoPtr< CNcbiIstream > m_Stream
CT_POS_TYPE GetPosition(void) const
Return the current (absolute) position.
bool AtEOF(void) const
Indicates (negatively) whether there is any more input.
CMemoryLineReader & operator++(void)
Make a line available.
CT_POS_TYPE GetPosition(void) const
Return the current (absolute) position.
CT_POS_TYPE GetPosition(void) const
Return the current (absolute) position.
EEOLStyle x_AdvanceEOLCRLF(void)
virtual ~CBufferedLineReader()
bool AtEOF(void) const
Indicates (negatively) whether there is any more input.
EEOLStyle x_AdvanceEOLUnknown(void)
Uint8 GetLineNumber(void) const
Returns the current line number (counting from 1, not 0).
@ eEOL_mixed
contains both bare CRs and bare LFs
@ eEOL_lf
bare LF (Unix et al.)
@ eEOL_cr
bare CR (classic Mac)
@ eEOL_unknown
to be detected
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
ERW_Result
Result codes for I/O operations.
CNcbiIstream & NcbiGetline(CNcbiIstream &is, string &str, char delim, string::size_type *count=NULL)
Read from "is" to "str" up to the delimiter symbol "delim" (or EOF)
static void Pushback(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size, void *del_ptr)
virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read=0)=0
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
NCBI_NS_STD::char_traits< char >::pos_type NcbiInt8ToStreampos(Int8 pos)
Convert plain numeric stream position (offset) into stream position usable with STL stream library.
@ eRW_NotImplemented
Action / information is not available.
@ eRW_Eof
End of data, should be considered permanent.
@ eRW_Error
Unrecoverable error, no retry possible.
@ eRW_Timeout
Timeout expired, try again later.
@ eRW_Success
Everything is okay, I/O completed.
NCBI_NS_STD::string::size_type SIZE_TYPE
const_iterator end() const
Return an iterator to the string's ending position (one past the end of the represented sequence)
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
size_type size(void) const
Return the length of the represented array.
const_iterator begin() const
Return an iterator to the string's starting position.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
Definition of all error codes used in util (xutil.lib).
Lightweight interface for getting lines of data with minimal memory copying.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static SLJIT_INLINE sljit_ins lr(sljit_gpr dst, sljit_gpr src)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4