VR-Vantage 2.3 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
Tutorials
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
rapidjson
filestream.h
Go to the documentation of this file.
1
#ifndef RAPIDJSON_FILESTREAM_H_
2
#define RAPIDJSON_FILESTREAM_H_
3
4
#include <cstdio>
5
6
namespace
rapidjson {
7
9
13
class
FileStream
{
14
public
:
15
typedef
char
Ch
;
16
17
FileStream
(FILE* fp) :
fp_
(fp),
count_
(0) {
Read
(); }
18
char
Peek
()
const
{
return
current_
; }
19
char
Take
() {
char
c
=
current_
;
Read
();
return
c
; }
20
size_t
Tell
()
const
{
return
count_
; }
21
void
Put
(
char
c
) { fputc(c,
fp_
); }
22
23
// Not implemented
24
char
*
PutBegin
() {
return
0; }
25
size_t
PutEnd
(
char
*) {
return
0; }
26
27
private
:
28
void
Read
() {
29
RAPIDJSON_ASSERT
(
fp_
!= 0);
30
int
c
= fgetc(
fp_
);
31
if
(c != EOF) {
32
current_
= (char)c;
33
count_
++;
34
}
35
else
36
current_
=
'\0'
;
37
}
38
39
FILE*
fp_
;
40
char
current_
;
41
size_t
count_
;
42
};
43
44
}
// namespace rapidjson
45
46
#endif // RAPIDJSON_FILESTREAM_H_
Copyright © 2005-2018 VT MAK. All Rights Reserved (
www.mak.com
)