Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
input_file_buffer.cpp
Go to the documentation of this file.
1
// Copyright 2008 Google Inc.
2
// All Rights Reserved.
3
// Author: ahmadab@google.com (Ahmad Abdulkader)
4
//
5
// input_file_buffer.h: Declarations of a class for an object that
6
// represents an input file buffer.
7
8
#include <string>
9
#include "
input_file_buffer.h
"
10
11
namespace
tesseract
{
12
// default and only contsructor
13
InputFileBuffer::InputFileBuffer
(
const
string
&file_name)
14
: file_name_(file_name) {
15
fp_
=
NULL
;
16
}
17
18
// virtual destructor
19
InputFileBuffer::~InputFileBuffer
() {
20
if
(
fp_
!=
NULL
) {
21
fclose(
fp_
);
22
}
23
}
24
25
// Read the specified number of bytes to the specified input buffer
26
int
InputFileBuffer::Read
(
void
*buffer,
int
bytes_to_read) {
27
// open the file if necessary
28
if
(
fp_
==
NULL
) {
29
fp_
= fopen(
file_name_
.c_str(),
"rb"
);
30
if
(
fp_
==
NULL
) {
31
return
0;
32
}
33
}
34
return
fread(buffer, 1, bytes_to_read,
fp_
);
35
}
36
}
tesseract::InputFileBuffer::~InputFileBuffer
virtual ~InputFileBuffer()
Definition:
input_file_buffer.cpp:19
tesseract::InputFileBuffer::InputFileBuffer
InputFileBuffer(const string &file_name)
Definition:
input_file_buffer.cpp:13
tesseract::InputFileBuffer::fp_
FILE * fp_
Definition:
input_file_buffer.h:27
tesseract::InputFileBuffer::file_name_
string file_name_
Definition:
input_file_buffer.h:26
tesseract
Definition:
baseapi.cpp:83
tesseract::InputFileBuffer::Read
int Read(void *buffer, int bytes_to_read)
Definition:
input_file_buffer.cpp:26
input_file_buffer.h
NULL
#define NULL
Definition:
host.h:144
neural_networks
runtime
input_file_buffer.cpp
Generated on Mon Jul 20 2015 18:37:54 by
1.8.8