aboutsummaryrefslogtreecommitdiff
path: root/src/xmlstringreader.cpp
blob: 211df78f71f65309ccf72ce80c9c2b0f60b138fb (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( int nAmnt )
{
	if( nLength >= nIndex+nAmnt )
	{
		nIndex += nAmnt;
	}
}