summaryrefslogtreecommitdiff
path: root/src/xmlstringreader.cpp
blob: 82caacd545b87de6630382aa0667b364f9a04c1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "xmlstringreader.h"
#include "xmlexception.h"
#include <string.h>

XmlStringReader::XmlStringReader( const char *sString, bool bStrip )
	: XmlReader( bStrip )
{
	this->sString = sString;
	
	nIndex = 0;
	nLength = strlen( sString );

	buildDoc();
}

XmlStringReader::~XmlStringReader()
{
}

char XmlStringReader::getChar( int nAdd )
{
	if( nLength >= nIndex+nAdd+1 )
	{
		return sString[nIndex+nAdd];
	}
	else
	{
		throw XmlException("End of XML stream read.");
	}
}

void XmlStringReader::usedChar()
{
	if( nLength >= nIndex+1 )
	{
		nIndex++;
	}
}