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
24
class
ORCUS_PSR_DLLPUBLIC
file_content
25
{
26
struct
impl;
27
std::unique_ptr<impl> mp_impl;
28
public
:
29
file_content
(
const
file_content
&) =
delete
;
30
file_content
& operator= (
const
file_content
&) =
delete
;
31
32
file_content
();
33
file_content
(
file_content
&& other);
34
file_content
(std::string_view filepath);
35
~file_content
();
36
42
const
char
*
data
()
const
;
43
50
size_t
size
()
const
;
51
57
bool
empty
()
const
;
58
64
void
swap
(
file_content
& other);
65
72
void
load
(std::string_view filepath);
73
79
void
convert_to_utf8
();
80
81
std::string_view str()
const
;
82
};
83
90
class
ORCUS_PSR_DLLPUBLIC
memory_content
91
{
92
struct
impl;
93
std::unique_ptr<impl> mp_impl;
94
public
:
95
memory_content
(
const
file_content
&) =
delete
;
96
memory_content
& operator= (
const
file_content
&) =
delete
;
97
98
memory_content
();
99
memory_content
(std::string_view s);
100
memory_content
(
memory_content
&& other);
101
~memory_content
();
102
103
const
char
* data()
const
;
104
size_t
size()
const
;
105
bool
empty()
const
;
106
107
void
swap(
memory_content
& other);
108
114
void
convert_to_utf8
();
115
116
std::string_view str()
const
;
117
};
118
119
struct
ORCUS_PSR_DLLPUBLIC
line_with_offset
120
{
122
std::string
line
;
124
std::size_t
line_number
;
126
std::size_t
offset_on_line
;
127
128
line_with_offset
(std::string _line, std::size_t _line_number, std::size_t _offset_on_line);
129
line_with_offset
(
const
line_with_offset
& other);
130
line_with_offset
(
line_with_offset
&& other);
131
~line_with_offset
();
132
133
bool
operator== (
const
line_with_offset
& other)
const
;
134
bool
operator!= (
const
line_with_offset
& other)
const
;
135
};
136
146
ORCUS_PSR_DLLPUBLIC std::string create_parse_error_output(std::string_view strm, std::ptrdiff_t offset);
147
161
ORCUS_PSR_DLLPUBLIC
line_with_offset
locate_line_with_offset(std::string_view strm, std::ptrdiff_t offset);
162
174
ORCUS_PSR_DLLPUBLIC
size_t
locate_first_different_char(std::string_view left, std::string_view right);
175
182
ORCUS_PSR_DLLPUBLIC std::size_t calc_logical_string_length(std::string_view s);
183
184
}
// namespace orcus
185
186
#endif
187
188
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::file_content
Definition
stream.hpp:25
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:91
orcus::memory_content::convert_to_utf8
void convert_to_utf8()
orcus::line_with_offset
Definition
stream.hpp:120
orcus::line_with_offset::offset_on_line
std::size_t offset_on_line
Definition
stream.hpp:126
orcus::line_with_offset::line_number
std::size_t line_number
Definition
stream.hpp:124
orcus::line_with_offset::line
std::string line
Definition
stream.hpp:122
Generated on Wed Jan 17 2024 00:00:00 for Orcus by
1.10.0