: m_Error(0), m_BufferPos(0),
58m_BufferSize(0), m_Buffer(0),
59m_CurrentPos(0), m_DataEndPos(0),
62m_CanceledCallback(0),
69: m_Error(0), m_BufferPos(0),
70m_BufferSize(0), m_Buffer(const_cast<char*>(
buffer)),
74m_CanceledCallback(0),
85 NCBI_CATCH_X(1,
"~CIStreamBuffer: exception while closing");
217 const char* pos = m_CurrentPos;
218 const char* end = m_DataEndPos;
222pos = FillBuffer(pos);
244}
while( ++pos < end );
249pos = FillBuffer(pos);
261 const char* pos = m_CurrentPos;
262 const char* end = m_DataEndPos;
266pos = FillBuffer(pos);
276 const void* found = memchr(pos, c, end - pos);
278m_CurrentPos =
static_cast<const char*
>(found);
284pos = FillBuffer(end);
296PeekCharNoEOF(limit - 1);
298 const char* pos = m_CurrentPos;
299 size_tbufferSize = m_DataEndPos - pos;
300 if( bufferSize != 0 ) {
301 const void* found = memchr(pos, c,
min(limit, bufferSize));
303 return static_cast<const char*
>(found) - pos;
322 if(
const ICanceled* callback = m_CanceledCallback ) {
323 if( callback->IsCanceled() ) {
324m_Error =
"canceled";
330 _ASSERT(m_CurrentPos >= m_Buffer);
331 if( m_BufferSize == 0 ) {
332 if(m_Input.NotNull() && m_Input->IsMultiPart()) {
336 size_t count= m_CurrentPos - m_CollectPos;
338m_Collector->AddChunk(m_CollectPos,
count);
340m_BufferPos += (m_DataEndPos - m_Buffer);
341m_BufferSize = m_Input->GetNextPart(&m_Buffer, m_DataEndPos - m_CurrentPos);
342m_CurrentPos = m_Buffer;
343m_DataEndPos = m_Buffer + m_BufferSize;
345m_CollectPos = m_CurrentPos;
348 if(m_CurrentPos != m_DataEndPos) {
357m_Error =
"end of file";
361 size_tnewPosOffset = pos - m_Buffer;
362 if( m_BufferLockSize == 0 &&
363(newPosOffset >= m_BufferSize || m_DataEndPos == m_CurrentPos) ) {
366 size_terase = m_CurrentPos - m_Buffer;
368 const char* newPos = m_CurrentPos - erase;
371 size_t count= m_CurrentPos - m_CollectPos;
373m_Collector->AddChunk(m_CollectPos,
count);
374m_CollectPos = newPos;
376 size_tcopy_count = m_DataEndPos - m_CurrentPos;
378 memmove(
const_cast<char*
>(newPos), m_CurrentPos, copy_count);
379m_CurrentPos = newPos;
380m_DataEndPos -= erase;
383newPosOffset -= erase;
386 size_tdataSize = m_DataEndPos - m_Buffer;
387 if( newPosOffset >= m_BufferSize ) {
390 while( newPosOffset >= newSize ) {
393 if( m_BufferLockSize != 0 ) {
394newSize =
min(newSize, m_BufferLockSize);
395 if( newPosOffset >= newSize ) {
399 char* newBuffer =
new char[newSize];
400memcpy(newBuffer, m_Buffer, dataSize);
401m_CurrentPos = newBuffer + (m_CurrentPos - m_Buffer);
403m_CollectPos = newBuffer + (m_CollectPos - m_Buffer);
404pos = newBuffer + newPosOffset;
405m_DataEndPos = newBuffer + dataSize;
407m_Buffer = newBuffer;
408m_BufferSize = newSize;
410 size_tload = m_BufferSize - dataSize;
411 while( load > 0 && pos >= m_DataEndPos ) {
416m_Error =
"end of file";
419 size_t count= m_Input->Read(
const_cast<char*
>(m_DataEndPos), load);
421 if( pos < m_DataEndPos )
423 if( m_Input->EndOfData() ) {
426 _ASSERT(m_Buffer <= m_CurrentPos);
428 _ASSERT(m_DataEndPos <= m_Buffer + m_BufferSize);
430(m_CollectPos>=m_Buffer &&
431m_CollectPos<=m_CurrentPos));
434m_Error =
"end of file";
438m_Error =
"read fault";
442m_DataEndPos +=
count;
445 _ASSERT(m_Buffer <= m_CurrentPos);
448 _ASSERT(m_DataEndPos <= m_Buffer + m_BufferSize);
450(m_CollectPos>=m_Buffer && m_CollectPos<=m_CurrentPos));
476 const char* pos = m_CurrentPos;
478 size_tc = m_DataEndPos - pos;
482m_CurrentPos = pos +
count;
489m_CurrentPos = pos += c;
490pos = FillBuffer(pos);
500 const char* pos = m_CurrentPos;
501 size_tin_buffer = m_DataEndPos - pos;
502 if( in_buffer >=
count) {
505m_CurrentPos = pos +
count;
509 str.assign(pos, in_buffer);
512m_CurrentPos = pos += in_buffer;
513pos = FillBuffer(pos);
514in_buffer = m_DataEndPos - pos;
515 if( in_buffer >=
count) {
518m_CurrentPos = pos +
count;
521 str.append(pos, in_buffer);
529 _ASSERT(lastChar ==
'\n'|| lastChar ==
'\r');
530 _ASSERT(m_CurrentPos > m_Buffer && m_CurrentPos[-1] == lastChar);
532 charnextChar = PeekCharNoEOF();
535 if( (lastChar + nextChar) == (
'\r'+
'\n') )
546 charc = *buff++ = GetChar();
553 if( PeekChar() ==
'\n')
557 if( PeekChar() ==
'\r')
573m_Error =
"bad number";
575 "bad number in line "<< GetLine());
582m_Error =
"number overflow";
584 "number overflow in line "<< GetLine());
660 if(
n> kMaxBeforeMul || (
n== kMaxBeforeMul && d > kMaxLimitAdd) )
694 if(
n> kMaxBeforeMul || (
n== kMaxBeforeMul && d > kMaxLimitAdd) )
737 if(
n> kMaxBeforeMul || (
n== kMaxBeforeMul && d > kMaxLimitAdd) )
765d = (
Uint1)(PeekCharNoEOF() -
'0');
771 if(
n> kMaxBeforeMul )
785: m_Output(
out), m_DeleteOutput(deleteOut), m_Closed(
false), m_Error(0),
786m_IndentLevel(0), m_BufferPos(0),
788m_CurrentPos(m_Buffer),
790m_Line(1), m_LineLength(0),
791m_BackLimit(0), m_UseIndentation(
true), m_UseEol(
true),
792m_CanceledCallback(0)
802 NCBI_CATCH_X(2,
"~COStreamBuffer: exception while closing");
807 NCBI_CATCH_X(2,
"~COStreamBuffer: exception deleting output stream");
874 if(
const ICanceled* callback = m_CanceledCallback ) {
875 if( callback->IsCanceled() ) {
876m_Error =
"canceled";
880 size_tused = GetUsedSpace();
891 count= used - leave;
894 if( !m_Output.write(m_Buffer,
count) ) {
895m_Error =
"write fault";
900m_CurrentPos -=
count;
903m_CurrentPos = m_Buffer;
915 if( !m_Output.flush() ) {
924FlushBuffer(
false);
925 size_tusedSize = m_CurrentPos - m_Buffer;
926 size_tneedSize = usedSize +
count;
927 size_tbufferSize = m_BufferEnd - m_Buffer;
928 if( bufferSize < needSize ) {
932}
while( bufferSize < needSize );
933 if( usedSize == 0 ) {
935m_CurrentPos = m_Buffer =
new char[bufferSize];
936m_BufferEnd = m_Buffer + bufferSize;
939 char* oldBuffer = m_Buffer;
940m_Buffer =
new char[bufferSize];
941m_BufferEnd = m_Buffer + bufferSize;
942memcpy(m_Buffer, oldBuffer, usedSize);
944m_CurrentPos = m_Buffer + usedSize;
954 const size_tBSIZE = (
sizeof(v)*
CHAR_BIT) / 3 + 2;
960 char* pos =
b+ BSIZE;
963*--pos = char(
a-10*(
n/=
Uint4(10)));
968 int len= (
int)(
b+ BSIZE - pos);
969 char* dst = Skip(
len);
970 for(
int i= 0;
i<
len; ++
i) {
979 const size_tBSIZE = (
sizeof(v)*
CHAR_BIT) / 3 + 2;
982 char* pos =
b+ BSIZE;
985*--pos = char(
a-10*(
n/=
Uint4(10)));
987 int len= (
int)(
b+ BSIZE - pos);
988 char* dst = Skip(
len);
989 for(
int i= 0;
i<
len; ++
i) {
999 #define PRINT_INT8_CHUNK 1000000000 1000 #define PRINT_INT8_CHUNK_SIZE 9 1005 const size_tBSIZE = (
sizeof(v)*
CHAR_BIT) / 3 + 2;
1011 char* pos =
b+ BSIZE;
1012 #ifdef PRINT_INT8_CHUNK 1020*--pos = char(
a-10*(m/=10));
1021}
while( pos != end );
1027*--pos = char(
a-10*(m/=10));
1032*--pos = char(
a-10*(
n/=
Uint8(10)));
1038 int len= (
int)(
b+ BSIZE - pos);
1039 char* dst = Skip(
len);
1040 for(
int i= 0;
i<
len; ++
i) {
1041dst[
i] = pos[
i];
1049 const size_tBSIZE = (
sizeof(v)*
CHAR_BIT) / 3 + 2;
1052 char* pos =
b+ BSIZE;
1053 #ifdef PRINT_INT8_CHUNK 1061*--pos = char(
a-10*(m/=10));
1062}
while( pos != end );
1068*--pos = char(
a-10*(m/=10));
1073*--pos = char(
a-10*(
n/=10));
1076 int len= (
int)(
b+ BSIZE - pos);
1077 char* dst = Skip(
len);
1078 for(
int i= 0;
i<
len; ++
i) {
1079dst[
i] = pos[
i];
1091 size_tlinePos = m_LineLength;
1092 char* pos = m_CurrentPos;
1093 boolgoodPlace =
false;
1094 while( pos > m_Buffer && linePos > 0 ) {
1097 if( linePos <= lineLength && (
isspace((
unsigned char) (*pos)) ||
1102 else if( *pos ==
'\n'|| *pos ==
'"') {
1109 if(pos > m_Buffer && *(pos-1) ==
'\n') {
1115 if( linePos < lineLength ) {
1116pos += lineLength - linePos;
1117linePos = lineLength;
1120 while( pos > m_Buffer && *(pos - 1) ==
'"') {
1124 if( pos == m_Buffer ) {
1126 while( pos < m_CurrentPos && *pos ==
'"') {
1134 size_t count= m_CurrentPos - pos;
1136m_LineLength =
count;
1146 while( dataLength > 0 ) {
1149FlushBuffer(
false);
1159memcpy(m_CurrentPos,
data, dataLength);
1160m_CurrentPos += dataLength;
1170FlushBuffer(
false);
1175 if( reader.EndOfData() )
1180m_CurrentPos +=
count;
Interface for testing cancellation request in a long lasting operation.
NLM_EXTERN Nlm_CharPtr LIBCALL SkipChar(char FAR *theString, char Char)
std::ofstream out("events_result.xml")
main entry point for tests
static const char * str(char *buf, int n)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_CATCH_X(err_subcode, message)
Catch CExceptions as well with default error code and given error subcode placed in diagnostics.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
void Reset(void)
Reset reference object.
uint8_t Uint1
1-byte (8-bit) unsigned integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
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.
COStreamBuffer(CNcbiOstream &out, bool deleteOut=false)
void ResetBufferLock(size_t pos)
virtual bool IsMultiPart(void) const
virtual CRef< CByteSource > GetSource(void)=0
Get CByteSource implementation.
void GetChars(char *buffer, size_t count)
const CRef< CSubSourceCollector > & GetParentCollector(void) const
char * DoReserve(size_t reserve=0)
bool TryToFillBuffer(void)
bool TrySetCurrentPos(const char *pos)
void PutEolAtWordEnd(size_t lineLength)
void Open(CByteSourceReader &reader)
const char * m_CurrentPos
size_t PeekFindChar(char c, size_t limit)
void SetStreamOffset(CNcbiStreampos pos)
void StartSubSource(void)
void SetStreamPos(CNcbiStreampos pos)
virtual void Seekg(CNcbiStreampos pos)
virtual void AddChunk(const char *buffer, size_t bufferLength)
Add data to the sub-source.
virtual size_t GetNextPart(char **, size_t)
CRef< CSubSourceCollector > m_Collector
void Write(const char *data, size_t dataLength)
void SkipEndOfLine(char lastChar)
void SetCanceledCallback(const ICanceled *callback)
size_t SetBufferLock(size_t size)
CRef< CByteSourceReader > m_Input
CConstIRef< ICanceled > m_CanceledCallback
void FlushBuffer(bool fullBuffer=true)
const char * m_CollectPos
char FillBufferNoEOF(const char *pos)
const char * FillBuffer(const char *pos, bool noEOF=false)
void NumberOverflow(void)
virtual bool Pushback(const char *data, size_t size)
void SetCanceledCallback(const ICanceled *callback)
CRef< CByteSource > EndSubSource(void)
CConstIRef< ICanceled > m_CanceledCallback
const char * m_DataEndPos
size_t ReadLine(char *buff, size_t size)
virtual CRef< CSubSourceCollector > SubSource(size_t prepend, CRef< CSubSourceCollector > parent)
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::streampos CNcbiStreampos
Portable alias for streampos.
unsigned int
A callback function used to compare two keys in a database.
Definition of all error codes used in util (xutil.lib).
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is smart and slim</td> n<td> orig</td> n</tr> n<tr> n<td> last_modified</td> n<td> optional</td> n<td> Integer</td> n<td class=\"description\"> The blob last modification If provided then the exact match will be requested with n the Cassandra storage corresponding field value</td> n<td> Positive integer Not provided means that the most recent match will be selected</td> n<td></td> n</tr> n<tr> n<td> use_cache</td> n<td> optional</td> n<td> String</td> n<td class=\"description\"> The option controls if the Cassandra LMDB cache and or database should be used It n affects the seq id resolution step and the blob properties lookup step The following n options are available
static const CS_INT unused
const struct ncbi::grid::netcache::search::fields::SIZE size
const CharType(& source)[N]
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
@ eCanceled
Request canceled.
#define PRINT_INT8_CHUNK_SIZE
static size_t BiggerBufferSize(size_t size) THROWS1_NONE
static const size_t KInitialBufferSize
IOS_BASE::iostate m_State
~STemporarilyClearStreamState()
STemporarilyClearStreamState(ios &stream)
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