Orcus
include
orcus
stream.hpp
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
*/
7
8
#ifndef INCLUDED_ORCUS_STREAM_HPP
9
#define INCLUDED_ORCUS_STREAM_HPP
10
11
#include "env.hpp"
12
#include "orcus/pstring.hpp"
13
14
#include <memory>
15
16
namespace
orcus
{
17
23
class
ORCUS_PSR_DLLPUBLIC
file_content
24
{
25
struct
impl;
26
std::unique_ptr<impl> mp_impl;
27
public
:
28
file_content
(
const
file_content
&) =
delete
;
29
file_content
& operator= (
const
file_content
&) =
delete
;
30
31
file_content
();
32
file_content
(
file_content
&& other);
33
file_content
(
const
char
* filepath);
34
~
file_content
();
35
36
const
char
* data()
const
;
37
size_t
size()
const
;
38
bool
empty()
const
;
39
40
void
swap(
file_content
& other);
41
48
void
load(
const
char
* filepath);
49
55
void
convert_to_utf8();
56
57
pstring
str()
const
;
58
};
59
67
class
ORCUS_PSR_DLLPUBLIC
memory_content
68
{
69
struct
impl;
70
std::unique_ptr<impl> mp_impl;
71
public
:
72
memory_content
(
const
file_content
&) =
delete
;
73
memory_content
& operator= (
const
file_content
&) =
delete
;
74
75
memory_content
();
76
memory_content
(
const
char
* p,
size_t
n);
77
memory_content
(
memory_content
&& other);
78
~
memory_content
();
79
80
const
char
* data()
const
;
81
size_t
size()
const
;
82
bool
empty()
const
;
83
84
void
swap(
memory_content
& other);
85
91
void
convert_to_utf8();
92
93
pstring
str()
const
;
94
};
95
96
struct
ORCUS_PSR_DLLPUBLIC
line_with_offset
97
{
98
std::string line;
99
size_t
line_number;
100
size_t
offset_on_line;
101
102
line_with_offset
(std::string _line,
size_t
_line_number,
size_t
_offset_on_line);
103
line_with_offset
(
const
line_with_offset
& other);
104
line_with_offset
(
line_with_offset
&& other);
105
~
line_with_offset
();
106
};
107
117
ORCUS_PSR_DLLPUBLIC std::string create_parse_error_output(
118
const
pstring
& strm, std::ptrdiff_t offset);
119
130
ORCUS_PSR_DLLPUBLIC
line_with_offset
locate_line_with_offset(
const
pstring
& strm, std::ptrdiff_t offset);
131
143
ORCUS_PSR_DLLPUBLIC
size_t
locate_first_different_char(
144
const
pstring
& left,
const
pstring
& right);
145
146
}
// namespace orcus
147
148
#endif
149
150
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::pstring
Definition:
pstring.hpp:27
orcus::file_content
Definition:
stream.hpp:23
orcus::memory_content
Definition:
stream.hpp:67
orcus::line_with_offset
Definition:
stream.hpp:96
orcus
Definition:
base64.hpp:15
Generated on Mon Jul 18 2022 14:22:29 for Orcus by
1.8.14