summaryrefslogtreecommitdiff
path: root/src/xmlfilereader.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
commitf4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch)
tree13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/xmlfilereader.cpp
parent74d4c8cd27334fc7204d5a8773deb3d424565778 (diff)
downloadlibbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier.
Diffstat (limited to 'src/xmlfilereader.cpp')
-rw-r--r--src/xmlfilereader.cpp58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/xmlfilereader.cpp b/src/xmlfilereader.cpp
deleted file mode 100644
index ed674a8..0000000
--- a/src/xmlfilereader.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
1#include "xmlfilereader.h"
2#include "exceptions.h"
3#include <string.h>
4
5XmlFileReader::XmlFileReader( const char *sFile, bool bStrip )
6 : XmlReader( bStrip )
7{
8 fh = fopen( sFile, "rt" );
9
10 if( fh == NULL )
11 {
12 throw XmlException("Couldn't open file: %s", sFile );
13 //nError = 1;
14 }
15 else
16 {
17 buildDoc();
18 }
19}
20
21XmlFileReader::~XmlFileReader()
22{
23}
24
25char XmlFileReader::getChar( int nIndex )
26{
27 // Make sure we always have a little data left in the buffer
28 if( fbDataIn.getLength() <= nIndex+1 && fh )
29 {
30 int nBytes = fbDataIn.getCapacity()-1;
31 char *buf = new char[nBytes];
32 int nRead = fread( buf, 1, nBytes, fh );
33 fbDataIn.appendData( buf, nRead );
34 delete[] buf;
35
36 if( nRead < nBytes )
37 {
38 fclose( fh );
39 fh = NULL;
40 }
41 }
42 if( fbDataIn.getLength() >= nIndex+1 )
43 {
44 return fbDataIn.getData()[nIndex];
45 }
46 else
47 {
48 throw XmlException("End of XML stream read.");
49 }
50}
51
52void XmlFileReader::usedChar( int nAmnt )
53{
54 if( fbDataIn.getLength()-nAmnt >= 0 )
55 {
56 fbDataIn.usedData( nAmnt );
57 }
58}