tesseract  4.0.0-1-g2a2b
InMemoryFilePointer Class Reference

Public Member Functions

 InMemoryFilePointer (const char *memory, int mem_size)
 
char * fgets (char *orig_dst, int size)
 

Detailed Description

Definition at line 727 of file unicharset.cpp.

Constructor & Destructor Documentation

◆ InMemoryFilePointer()

InMemoryFilePointer::InMemoryFilePointer ( const char *  memory,
int  mem_size 
)
inline

Definition at line 729 of file unicharset.cpp.

730  : memory_(memory), fgets_ptr_(memory), mem_size_(mem_size) { }

Member Function Documentation

◆ fgets()

char* InMemoryFilePointer::fgets ( char *  orig_dst,
int  size 
)
inline

Definition at line 732 of file unicharset.cpp.

732  {
733  const char *src_end = memory_ + mem_size_;
734  char *dst_end = orig_dst + size - 1;
735  if (size < 1) {
736  return fgets_ptr_ < src_end ? orig_dst : nullptr;
737  }
738 
739  char *dst = orig_dst;
740  char ch = '^';
741  while (fgets_ptr_ < src_end && dst < dst_end && ch != '\n') {
742  ch = *dst++ = *fgets_ptr_++;
743  }
744  *dst = 0;
745  return (dst == orig_dst) ? nullptr : orig_dst;
746  }

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