A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/strbuffer_8cpp_source.html below:

NCBI C++ ToolKit: src/util/strbuffer.cpp Source File

41 #define NCBI_USE_ERRCODE_X Util_Stream 57

: m_Error(0), m_BufferPos(0),

58

m_BufferSize(0), m_Buffer(0),

59

m_CurrentPos(0), m_DataEndPos(0),

62

m_CanceledCallback(0),

69

: m_Error(0), m_BufferPos(0),

70

m_BufferSize(0), m_Buffer(const_cast<char*>(

buffer

)),

74

m_CanceledCallback(0),

85  NCBI_CATCH_X

(1,

"~CIStreamBuffer: exception while closing"

);

217  const char

* pos = m_CurrentPos;

218  const char

* end = m_DataEndPos;

222

pos = FillBuffer(pos);

244

}

while

( ++pos < end );

249

pos = FillBuffer(pos);

261  const char

* pos = m_CurrentPos;

262  const char

* end = m_DataEndPos;

266

pos = FillBuffer(pos);

276  const void

* found = memchr(pos, c, end - pos);

278

m_CurrentPos =

static_cast<const char

*

>

(found);

284

pos = FillBuffer(end);

296

PeekCharNoEOF(limit - 1);

298  const char

* pos = m_CurrentPos;

299  size_t

bufferSize = 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() ) {

324

m_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;

338

m_Collector->AddChunk(m_CollectPos,

count

);

340

m_BufferPos += (m_DataEndPos - m_Buffer);

341

m_BufferSize = m_Input->GetNextPart(&m_Buffer, m_DataEndPos - m_CurrentPos);

342

m_CurrentPos = m_Buffer;

343

m_DataEndPos = m_Buffer + m_BufferSize;

345

m_CollectPos = m_CurrentPos;

348  if

(m_CurrentPos != m_DataEndPos) {

357

m_Error =

"end of file"

;

361  size_t

newPosOffset = pos - m_Buffer;

362  if

( m_BufferLockSize == 0 &&

363

(newPosOffset >= m_BufferSize || m_DataEndPos == m_CurrentPos) ) {

366  size_t

erase = m_CurrentPos - m_Buffer;

368  const char

* newPos = m_CurrentPos - erase;

371  size_t count

= m_CurrentPos - m_CollectPos;

373

m_Collector->AddChunk(m_CollectPos,

count

);

374

m_CollectPos = newPos;

376  size_t

copy_count = m_DataEndPos - m_CurrentPos;

378  memmove

(

const_cast<char

*

>

(newPos), m_CurrentPos, copy_count);

379

m_CurrentPos = newPos;

380

m_DataEndPos -= erase;

383

newPosOffset -= erase;

386  size_t

dataSize = m_DataEndPos - m_Buffer;

387  if

( newPosOffset >= m_BufferSize ) {

390  while

( newPosOffset >= newSize ) {

393  if

( m_BufferLockSize != 0 ) {

394

newSize =

min

(newSize, m_BufferLockSize);

395  if

( newPosOffset >= newSize ) {

399  char

* newBuffer =

new char

[newSize];

400

memcpy(newBuffer, m_Buffer, dataSize);

401

m_CurrentPos = newBuffer + (m_CurrentPos - m_Buffer);

403

m_CollectPos = newBuffer + (m_CollectPos - m_Buffer);

404

pos = newBuffer + newPosOffset;

405

m_DataEndPos = newBuffer + dataSize;

407

m_Buffer = newBuffer;

408

m_BufferSize = newSize;

410  size_t

load = m_BufferSize - dataSize;

411  while

( load > 0 && pos >= m_DataEndPos ) {

416

m_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 &&

431

m_CollectPos<=m_CurrentPos));

434

m_Error =

"end of file"

;

438

m_Error =

"read fault"

;

442

m_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_t

c = m_DataEndPos - pos;

482

m_CurrentPos = pos +

count

;

489

m_CurrentPos = pos += c;

490

pos = FillBuffer(pos);

500  const char

* pos = m_CurrentPos;

501  size_t

in_buffer = m_DataEndPos - pos;

502  if

( in_buffer >=

count

) {

505

m_CurrentPos = pos +

count

;

509  str

.assign(pos, in_buffer);

512

m_CurrentPos = pos += in_buffer;

513

pos = FillBuffer(pos);

514

in_buffer = m_DataEndPos - pos;

515  if

( in_buffer >=

count

) {

518

m_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  char

nextChar = PeekCharNoEOF();

535  if

( (lastChar + nextChar) == (

'\r'

+

'\n'

) )

546  char

c = *buff++ = GetChar();

553  if

( PeekChar() ==

'\n'

)

557  if

( PeekChar() ==

'\r'

)

573

m_Error =

"bad number"

;

575  "bad number in line "

<< GetLine());

582

m_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) )

765

d = (

Uint1

)(PeekCharNoEOF() -

'0'

);

771  if

(

n

> kMaxBeforeMul )

785

: m_Output(

out

), m_DeleteOutput(deleteOut), m_Closed(

false

), m_Error(0),

786

m_IndentLevel(0), m_BufferPos(0),

788

m_CurrentPos(m_Buffer),

790

m_Line(1), m_LineLength(0),

791

m_BackLimit(0), m_UseIndentation(

true

), m_UseEol(

true

),

792

m_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() ) {

876

m_Error =

"canceled"

;

880  size_t

used = GetUsedSpace();

891  count

= used - leave;

894  if

( !m_Output.write(m_Buffer,

count

) ) {

895

m_Error =

"write fault"

;

900

m_CurrentPos -=

count

;

903

m_CurrentPos = m_Buffer;

915  if

( !m_Output.flush() ) {

924

FlushBuffer(

false

);

925  size_t

usedSize = m_CurrentPos - m_Buffer;

926  size_t

needSize = usedSize +

count

;

927  size_t

bufferSize = m_BufferEnd - m_Buffer;

928  if

( bufferSize < needSize ) {

932

}

while

( bufferSize < needSize );

933  if

( usedSize == 0 ) {

935

m_CurrentPos = m_Buffer =

new char

[bufferSize];

936

m_BufferEnd = m_Buffer + bufferSize;

939  char

* oldBuffer = m_Buffer;

940

m_Buffer =

new char

[bufferSize];

941

m_BufferEnd = m_Buffer + bufferSize;

942

memcpy(m_Buffer, oldBuffer, usedSize);

944

m_CurrentPos = m_Buffer + usedSize;

954  const size_t

BSIZE = (

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_t

BSIZE = (

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_t

BSIZE = (

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

) {

1041

dst[

i

] = pos[

i

];

1049  const size_t

BSIZE = (

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

) {

1079

dst[

i

] = pos[

i

];

1091  size_t

linePos = m_LineLength;

1092  char

* pos = m_CurrentPos;

1093  bool

goodPlace =

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 ) {

1116

pos += lineLength - linePos;

1117

linePos = 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;

1136

m_LineLength =

count

;

1146  while

( dataLength > 0 ) {

1149

FlushBuffer(

false

);

1159

memcpy(m_CurrentPos,

data

, dataLength);

1160

m_CurrentPos += dataLength;

1170

FlushBuffer(

false

);

1175  if

( reader.EndOfData() )

1180

m_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