Orcus
Toggle main menu visibility
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(std::u16string_view filepath);
36
~file_content();
37
43
const
char
*
data
()
const
;
44
51
size_t
size
()
const
;
52
58
bool
empty
()
const
;
59
65
void
swap
(file_content& other);
66
73
void
load
(std::string_view filepath);
74
80
void
convert_to_utf8
();
81
82
std::string_view str()
const
;
83
};
84
91
class
ORCUS_PSR_DLLPUBLIC memory_content
92
{
93
struct
impl;
94
std::unique_ptr<impl> mp_impl;
95
public
:
96
memory_content(
const
file_content
&) =
delete
;
97
memory_content& operator= (
const
file_content
&) =
delete
;
98
99
memory_content();
100
memory_content(std::string_view s);
101
memory_content(memory_content&& other);
102
~memory_content();
103
104
const
char
* data()
const
;
105
size_t
size()
const
;
106
bool
empty()
const
;
107
108
void
swap(memory_content& other);
109
115
void
convert_to_utf8
();
116
117
std::string_view str()
const
;
118
};
119
120
struct
ORCUS_PSR_DLLPUBLIC line_with_offset
121
{
123
std::string
line
;
125
std::size_t
line_number
;
127
std::size_t
offset_on_line
;
128
129
line_with_offset(std::string _line, std::size_t _line_number, std::size_t _offset_on_line);
130
line_with_offset(
const
line_with_offset& other);
131
line_with_offset(line_with_offset&& other);
132
~line_with_offset();
133
134
bool
operator== (
const
line_with_offset& other)
const
;
135
bool
operator!= (
const
line_with_offset& other)
const
;
136
};
137
147
ORCUS_PSR_DLLPUBLIC std::string create_parse_error_output(std::string_view strm, std::ptrdiff_t offset);
148
162
ORCUS_PSR_DLLPUBLIC
line_with_offset
locate_line_with_offset(std::string_view strm, std::ptrdiff_t offset);
163
175
ORCUS_PSR_DLLPUBLIC std::size_t locate_first_different_char(std::string_view left, std::string_view right);
176
183
ORCUS_PSR_DLLPUBLIC std::size_t calc_logical_string_length(std::string_view s);
184
185
}
// namespace orcus
186
187
#endif
188
189
/* 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::convert_to_utf8
void convert_to_utf8()
orcus::line_with_offset
Definition
stream.hpp:121
orcus::line_with_offset::offset_on_line
std::size_t offset_on_line
Definition
stream.hpp:127
orcus::line_with_offset::line_number
std::size_t line_number
Definition
stream.hpp:125
orcus::line_with_offset::line
std::string line
Definition
stream.hpp:123
Generated on
for Orcus by
1.17.0