Пример #1
0
UINT MNTextBuffer::copyIn(WCHAR * buffer,UINT len)
{
	len = min(len,m_nSize);
	int l = findEol(buffer,len);
	memcpy(m_buffer, buffer, l * sizeof(WCHAR));

	
	return len;
}
Пример #2
0
bool LineSource::read(String *line)
{
    if (eoi_) {
        *line = String();
        return false;
    }

    Ref<StringList> backlog;

    while (true) {
        if (i_ < n_) {
            int i0 = i_;
            i_ = findEol(buf_, n_, i_);
            if (i_ < n_) {
                if (backlog) {
                    backlog->append(buf_->copy(i0, i_));
                    *line = backlog->join();
                }
                else {
                    *line = buf_->copy(i0, i_);
                }
                i_ = skipEol(buf_, n_, i_);
                return true;
            }
            if (!backlog)
                backlog = StringList::create();
            backlog->append(buf_->copy(i0, i_));
        }

        if (!stream_) break;

        n_ = stream_->read(buf_);
        if (n_ == 0) break;
        i_ = 0;
    }

    eoi_ = true;
    if (backlog) {
        *line = backlog->join();
        return true;
    }
    *line = String();
    return false;
}