#include "../config/pathan_config.h" /* * Copyright (c) 2001, DecisionSoft Limited All rights reserved. * Please see LICENSE.TXT for more information. */ #include "LexerDOMStringStream.hpp" #include #include int get_min(int a,int b) { return a 0xFFFF) { std::cerr << "Unfortunately there is no current support for Unicode characters represented by more than 2 bytes. Unexpected behaviour is to be expected :)." << std::endl; }//if buffer[cnt] = inputBuffer[cnt]; }//for buffer[length]=0; }//constructor LexerDOMStringStream::~LexerDOMStringStream() { delete []buffer; }//destructor int LexerDOMStringStream::read(unsigned char *ptr, unsigned int numBytes) { if(position == length) { last_retrieved = 0; return 0; }//if unsigned short *inputBuffer = (unsigned short *)ptr; //Note: numBytes is in terms of bytes, not Unicode characters numBytes /= sizeof(unsigned short); //Figure out how many characters to read int towrite = get_min(numBytes,length - position); //Copy the characters into ptr int outpos = 0; for(unsigned int cnt=position; cnt