summaryrefslogtreecommitdiff
path: root/src/xmlstringreader.cpp
blob: 3956ff3b2153f1a25cd97b4e02d2971a1b414965 (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 "exceptions.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;
	}
}