1 // Copyright (c) 1994 James Clark
2 // See the file COPYING for copying permission.
3 #pragma ident "%Z%%M% %I% %E% SMI"
10 #include "InternalInputSource.h"
14 namespace SP_NAMESPACE
{
17 InternalInputSource::InternalInputSource(const StringC
&str
,
18 InputSourceOrigin
*origin
)
19 : InputSource(origin
, str
.data(), str
.data() + str
.size()), buf_(0),
24 InternalInputSource::~InternalInputSource()
30 Xchar
InternalInputSource::fill(Messenger
&)
35 void InternalInputSource::pushCharRef(Char c
, const NamedCharRef
&ref
)
37 ASSERT(cur() == start());
38 noteCharRef(startIndex() + (cur() - start()), ref
);
40 buf_
= new Char
[end() - start() + 1];
41 memcpy(buf_
+ 1, cur(), (end() - start())*sizeof(Char
));
42 changeBuffer(buf_
+ 1, cur());
48 Boolean
InternalInputSource::rewind(Messenger
&)
50 reset(contents_
->data(),
51 contents_
->data() + contents_
->size());