Orcus
Loading...
Searching...
No Matches
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
13
#include <memory>
14
#include <string>
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
(std::string_view filepath);
34
~file_content
();
35
41
const
char
*
data
()
const
;
42
49
size_t
size
()
const
;
50
56
bool
empty
()
const
;
57
63
void
swap
(
file_content
& other);
64
71
void
load
(std::string_view filepath);
72
78
void
convert_to_utf8
();
79
80
std::string_view str()
const
;
81
};
82
89
class
ORCUS_PSR_DLLPUBLIC
memory_content
90
{
91
struct
impl;
92
std::unique_ptr<impl> mp_impl;
93
public
:
94
memory_content
(
const
file_content
&) =
delete
;
95
memory_content
& operator= (
const
file_content
&) =
delete
;
96
97
memory_content
();
98
memory_content
(std::string_view s);
99
memory_content
(
memory_content
&& other);
100
~memory_content
();
101
102
const
char
* data()
const
;
103
size_t
size()
const
;
104
bool
empty()
const
;
105
106
void
swap(
memory_content
& other);
107
113
void
convert_to_utf8
();
114
115
std::string_view str()
const
;
116
};
117
118
struct
ORCUS_PSR_DLLPUBLIC
line_with_offset
119
{
120
std::string line;
121
size_t
line_number;
122
size_t
offset_on_line;
123
124
line_with_offset
(std::string _line,
size_t
_line_number,
size_t
_offset_on_line);
125
line_with_offset
(
const
line_with_offset
& other);
126
line_with_offset
(
line_with_offset
&& other);
127
~line_with_offset
();
128
};
129
139
ORCUS_PSR_DLLPUBLIC std::string create_parse_error_output(std::string_view strm, std::ptrdiff_t offset);
140
151
ORCUS_PSR_DLLPUBLIC
line_with_offset
locate_line_with_offset(std::string_view strm, std::ptrdiff_t offset);
152
164
ORCUS_PSR_DLLPUBLIC
size_t
locate_first_different_char(std::string_view left, std::string_view right);
165
166
}
// namespace orcus
167
168
#endif
169
170
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::file_content
Definition
stream.hpp:24
orcus::file_content::size
size_t size() const
orcus::file_content::swap
void swap(file_content &other)
orcus::file_content::load
void load(std::string_view filepath)
orcus::file_content::convert_to_utf8
void convert_to_utf8()
orcus::file_content::data
const char * data() const
orcus::file_content::empty
bool empty() const
orcus::memory_content
Definition
stream.hpp:90
orcus::memory_content::convert_to_utf8
void convert_to_utf8()
orcus::line_with_offset
Definition
stream.hpp:119
Generated on Mon Feb 20 2023 00:00:00 for Orcus by
1.9.7