DCL
3.7.4
Loading...
Searching...
No Matches
BytesInputStream.cpp
Go to the documentation of this file.
1
#include <
string.h
>
// memcpy
2
#include <
dcl/BytesInputStream.h
>
3
#include <
dcl/size_t.h
>
4
5
#if __DCL_HAVE_ALLOC_DEBUG
6
#undef __DCL_ALLOC_LEVEL
7
#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
8
#endif
9
10
#if __DCL_HAVE_THIS_FILE__
11
#undef __THIS_FILE__
12
static
const
char_t
__THIS_FILE__
[] =
__T
(
"dcl/BytesInputStream.cpp"
);
13
#endif
14
15
__DCL_BEGIN_NAMESPACE
16
17
IMPLEMENT_CLASSINFO
(
BytesInputStream
,
InputStream
)
18
19
String
BytesInputStream::toString
()
const
20
{
21
StringBuilder
r
=
className
();
22
r
.format(
__T
(
"(%ubytes)"
),
__str
.length());
23
return
r
;
24
}
25
26
BytesInputStream::BytesInputStream(
const
ByteString& _str)
27
{
28
__str
= _str;
29
__begin
= _str;
30
__end
=
__begin
+ _str.length();
31
}
32
33
size_t
BytesInputStream::available() const
34
__DCL_THROWS1
(
IOException
*)
35
{
36
return
__end
-
__begin
;
37
}
38
39
size_t
BytesInputStream::read(
void
* _buf,
size_t
_n)
40
__DCL_THROWS1
(
IOException
*)
41
{
42
__DCL_ASSERT_PARAM
(_buf !=
NULL
);
43
44
size_t
n =
__MIN
(__end - __begin, _n);
45
memcpy(_buf, __begin, n);
46
__begin += n;
47
48
return
n;
49
}
50
51
__DCL_END_NAMESPACE
52
__THIS_FILE__
#define __THIS_FILE__
Definition
_trace.h:14
BytesInputStream.h
NULL
#define NULL
Definition
Config.h:312
char_t
wchar_t char_t
Definition
Config.h:247
__DCL_THROWS1
#define __DCL_THROWS1(e)
Definition
Config.h:152
r
IOException *size_t r
Definition
MediaInfo.cpp:82
__DCL_ASSERT_PARAM
#define __DCL_ASSERT_PARAM(expr)
Definition
Object.h:409
IMPLEMENT_CLASSINFO
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
Definition
Object.h:245
__T
#define __T(str)
Definition
Object.h:60
String.h
BytesInputStream
Definition
BytesInputStream.h:22
BytesInputStream::__str
ByteString __str
Definition
BytesInputStream.h:54
BytesInputStream::__begin
const char * __begin
Definition
BytesInputStream.h:55
BytesInputStream::__end
const char * __end
Definition
BytesInputStream.h:56
IOException
Definition
Exception.h:93
InputStream
Definition
InputStream.h:23
Object::toString
virtual String toString() const
Definition
Object.cpp:187
Object::className
String className() const
Definition
Object.cpp:163
size_t.h
__MIN
size_t __MIN(size_t x, size_t y)
Definition
size_t.h:27
src
DCLCore
BytesInputStream.cpp
Generated by
1.14.0