include
ecl
devices
string.hpp
Go to the documentation of this file.
1
8
/*****************************************************************************
9
** Ifdefs
10
*****************************************************************************/
11
12
#ifndef ECL_DEVICES_STRING_HPP_
13
#define ECL_DEVICES_STRING_HPP_
14
15
/*****************************************************************************
16
** Includes
17
*****************************************************************************/
18
19
#include <string>
20
#include "
traits.hpp
"
21
#include "
macros.hpp
"
22
23
/*****************************************************************************
24
** Namespaces
25
*****************************************************************************/
26
27
namespace
ecl
{
28
29
/*****************************************************************************
30
** Interface [String]
31
*****************************************************************************/
49
class
ecl_devices_PUBLIC
String {
50
public
:
59
explicit
String(
const
char
* str =
""
);
65
virtual
~String();
66
67
/*********************
68
** String Interface
69
**********************/
78
const
char
* c_str();
87
std::string str();
94
void
clear();
95
96
/******************************************
97
** Device Source Interface
98
*******************************************/
107
long
read(
char
&c);
116
long
read(
char
* s,
unsigned
long
n);
125
unsigned
long
remaining();
126
127
/******************************************
128
** Device Sink Interface
129
*******************************************/
139
long
write(
char
c);
151
long
write(
const
char
* s,
unsigned
long
n);
152
153
/******************************************
154
** Device Seekable Interface
155
*******************************************/
165
unsigned
long
size();
172
void
flush() {};
173
174
/*********************
175
** Device Interface
176
**********************/
185
bool
open() {
return
true
; };
194
bool
isOpen() {
return
true
; };
196
private
:
197
unsigned
long
buffer_length;
// Actual reserved memory is this +1
198
char
*buffer;
199
char
* buffer_cur_write;
200
char
* buffer_cur_read;
210
void
grow(
int
no_bytes = 256);
211
212
};
213
214
/*****************************************************************************
215
** Traits
216
*****************************************************************************/
217
223
template
<>
224
class
is_sink
<
String
> :
public
True
{};
225
231
template
<>
232
class
is_source
<
String
> :
public
True
{};
233
239
template
<>
240
class
is_sourcesink<String> :
public
True
{};
241
242
}
// namespace ecl
243
244
245
#endif
/* ECL_DEVICES_STRING_HPP_ */
ecl::is_sink
Default action for detection of sink devices (output) (false).
Definition:
traits.hpp:56
ecl::Bool
macros.hpp
Macros for ecl devices.
ecl_devices_PUBLIC
#define ecl_devices_PUBLIC
Definition:
macros.hpp:37
True
Bool< true > True
ecl::String
A virtual device for manipulating strings.
Definition:
string.hpp:55
traits.hpp
Traits for devices.
ecl
Embedded control libraries.
ecl::is_source
Default action for detection of source devices (input) (false).
Definition:
traits.hpp:45
ecl_devices
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:45