From f4b191f0ea396b58465bfba40749977780a3af58 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 11 Feb 2009 05:29:41 +0000 Subject: Just removing some things that are cluttering up the source tree. --- src/inprogress/xmldocument.cpp | 16 --- src/inprogress/xmldocument.h | 29 ----- src/inprogress/xmlnode.cpp | 16 --- src/inprogress/xmlnode.h | 29 ----- src/inprogress/xmlreader.cpp | 274 ----------------------------------------- src/inprogress/xmlreader.h | 128 ------------------- src/inprogress/xmlwriter.cpp | 16 --- src/inprogress/xmlwriter.h | 29 ----- 8 files changed, 537 deletions(-) delete mode 100644 src/inprogress/xmldocument.cpp delete mode 100644 src/inprogress/xmldocument.h delete mode 100644 src/inprogress/xmlnode.cpp delete mode 100644 src/inprogress/xmlnode.h delete mode 100644 src/inprogress/xmlreader.cpp delete mode 100644 src/inprogress/xmlreader.h delete mode 100644 src/inprogress/xmlwriter.cpp delete mode 100644 src/inprogress/xmlwriter.h (limited to 'src/inprogress') diff --git a/src/inprogress/xmldocument.cpp b/src/inprogress/xmldocument.cpp deleted file mode 100644 index c3114d6..0000000 --- a/src/inprogress/xmldocument.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#include "xmldocument.h" - -Bu::XmlDocument::XmlDocument() -{ -} - -Bu::XmlDocument::~XmlDocument() -{ -} diff --git a/src/inprogress/xmldocument.h b/src/inprogress/xmldocument.h deleted file mode 100644 index b4fdc9d..0000000 --- a/src/inprogress/xmldocument.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#ifndef XML_DOCUMENT_H -#define XML_DOCUMENT_H - -#include - -namespace Bu -{ - /** - * - */ - class XmlDocument - { - public: - XmlDocument(); - virtual ~XmlDocument(); - - private: - - }; -} - -#endif diff --git a/src/inprogress/xmlnode.cpp b/src/inprogress/xmlnode.cpp deleted file mode 100644 index f31d4ae..0000000 --- a/src/inprogress/xmlnode.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#include "xmlnode.h" - -Bu::XmlNode::XmlNode() -{ -} - -Bu::XmlNode::~XmlNode() -{ -} diff --git a/src/inprogress/xmlnode.h b/src/inprogress/xmlnode.h deleted file mode 100644 index ed52f32..0000000 --- a/src/inprogress/xmlnode.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#ifndef XML_NODE_H -#define XML_NODE_H - -#include - -namespace Bu -{ - /** - * - */ - class XmlNode - { - public: - XmlNode(); - virtual ~XmlNode(); - - private: - - }; -} - -#endif diff --git a/src/inprogress/xmlreader.cpp b/src/inprogress/xmlreader.cpp deleted file mode 100644 index 5c755bb..0000000 --- a/src/inprogress/xmlreader.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#include "xmlreader.h" - -Bu::XmlReader::XmlReader( Bu::Stream &sIn ) : - sIn( sIn ) -{ -} - -Bu::XmlReader::~XmlReader() -{ -} - -const char *Bu::XmlReader::lookahead( int nAmnt ) -{ - if( sBuf.getSize() >= nAmnt ) - return sBuf.getStr(); - - int nNew = nAmnt - sBuf.getSize(); - char *buf = new char[nNew]; - sIn.read( buf, nNew ); - sBuf.append( buf ); - - return sBuf.getStr(); -} - -void Bu::XmlReader::burn( int nAmnt ) -{ - if( sBuf.getSize() < nAmnt ) - { - lookahead( nAmnt ); - } - - //sBuf.remove( nAmnt ); -} - -void Bu::XmlReader::checkString( const char *str, int nLen ) -{ - if( !strncmp( str, lookahead( nLen ), nLen ) ) - { - burn( nLen ); - return; - } - - throw Bu::ExceptionBase("Expected string '%s'", str ); -} - -Bu::XmlNode *Bu::XmlReader::read() -{ - prolog(); -} - -void Bu::XmlReader::prolog() -{ - XMLDecl(); - Misc(); -} - -void Bu::XmlReader::XMLDecl() -{ - checkString("", 2 ); -} - -void Bu::XmlReader::Misc() -{ - for(;;) - { - S(); - if( !strncmp("", 3 ); - return; - } - } - burn( 1 ); - } -} - -void Bu::XmlReader::PI() -{ - checkString("", lookahead(j+2)+j, 2 ) ) - { - burn( j+2 ); - return; - } - } -} - -void Bu::XmlReader::S() -{ - for( int j = 0;; j++ ) - { - char c = *lookahead( 1 ); - if( c == 0x20 || c == 0x9 || c == 0xD || c == 0xA ) - continue; - if( j == 0 ) - throw ExceptionBase("Expected whitespace."); - return; - } -} - -void Bu::XmlReader::Sq() -{ - for(;;) - { - char c = *lookahead( 1 ); - if( c == 0x20 || c == 0x9 || c == 0xD || c == 0xA ) - continue; - return; - } -} - -void Bu::XmlReader::VersionInfo() -{ - try - { - S(); - checkString("version", 7 ); - } - catch( ExceptionBase &e ) - { - return; - } - Eq(); - Bu::FString ver = AttValue(); - if( ver != "1.1" ) - throw ExceptionBase("Currently we only support xml version 1.1\n"); -} - -void Bu::XmlReader::Eq() -{ - Sq(); - checkString("=", 1 ); - Sq(); -} - -void Bu::XmlReader::EncodingDecl() -{ - S(); - try - { - checkString("encoding", 8 ); - } - catch( ExceptionBase &e ) - { - return; - } - - Eq(); - AttValue(); -} - -void Bu::XmlReader::SDDecl() -{ - S(); - try - { - checkString("standalone", 10 ); - } - catch( ExceptionBase &e ) - { - return; - } - - Eq(); - AttValue(); -} - -Bu::FString Bu::XmlReader::AttValue() -{ - char q = *lookahead(1); - if( q == '\"' ) - { - for( int j = 2;; j++ ) - { - if( lookahead(j)[j-1] == '\"' ) - { - Bu::FString ret( lookahead(j)+1, j-2 ); - burn( j ); - return ret; - } - } - } - else if( q == '\'' ) - { - for( int j = 2;; j++ ) - { - if( lookahead(j)[j-1] == '\'' ) - { - Bu::FString ret( lookahead(j)+1, j-2 ); - burn( j ); - return ret; - } - } - } - - throw ExceptionBase("Excpected either \' or \".\n"); -} - -Bu::FString Bu::XmlReader::Name() -{ - unsigned char c = *lookahead( 1 ); - if( c != ':' && c != '_' && - (c < 'A' || c > 'Z') && - (c < 'a' || c > 'z') && - (c < 0xC0 || c > 0xD6 ) && - (c < 0xD8 || c > 0xF6 ) && - (c < 0xF8)) - { - throw ExceptionBase("Invalid entity name starting character."); - } - - for( int j = 1;; j++ ) - { - unsigned char c = lookahead(j+1)[j]; - if( isS( c ) ) - { - FString ret( lookahead(j+1), j+1 ); - burn( j+1 ); - return ret; - } - if( c != ':' && c != '_' && c != '-' && c != '.' && c != 0xB7 && - (c < 'A' || c > 'Z') && - (c < 'a' || c > 'z') && - (c < '0' || c > '9') && - (c < 0xC0 || c > 0xD6 ) && - (c < 0xD8 || c > 0xF6 ) && - (c < 0xF8)) - { - throw ExceptionBase("Invalid character in name."); - } - } -} - diff --git a/src/inprogress/xmlreader.h b/src/inprogress/xmlreader.h deleted file mode 100644 index 0219b0e..0000000 --- a/src/inprogress/xmlreader.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#ifndef XML_READER_H -#define XML_READER_H - -#include -#include "bu/stream.h" -#include "bu/fstring.h" -#include "bu/xmlnode.h" - -namespace Bu -{ - /** - * An Xml 1.1 reader. I've decided to write this, this time, based on the - * official W3C reccomendation, now included with the source code. I've - * named the productions in the parser states the same as in that document, - * which may make them easier to find, etc, although possibly slightly less - * optimized than writing my own reduced grammer. - * - * Below I will list differences between my parser and the official standard - * as I come up with them. - * - Encoding and Standalone headings are ignored for the moment. (4.3.3, - * 2.9) - * - The standalone heading attribute can have any standard whitespace - * before it (the specs say only spaces, no newlines). (2.9) - * - Since standalone is ignored, it is currently allowed to have any - * value (should be restricted to "yes" or "no"). (2.9) - * - Currently only UTF-8 / ascii are parsed. - * - [optional] The content of comments is thrown away. (2.5) - * - The content of processing instruction blocks is parsed properly, but - * thrown away. (2.6) - */ - class XmlReader - { - public: - XmlReader( Bu::Stream &sIn ); - virtual ~XmlReader(); - - XmlNode *read(); - - private: - Bu::Stream &sIn; - Bu::FString sBuf; - - private: // Helpers - const char *lookahead( int nAmnt ); - void burn( int nAmnt ); - void checkString( const char *str, int nLen ); - - private: // States - /** - * The headers, etc. - */ - void prolog(); - - /** - * The xml decleration (version, encoding, etc). - */ - void XMLDecl(); - - /** - * Misc things, Includes Comments and PIData (Processing Instructions). - */ - void Misc(); - - /** - * Comments - */ - void Comment(); - - /** - * Processing Instructions - */ - void PI(); - - /** - * Whitespace eater. - */ - void S(); - - /** - * Optional whitespace eater. - */ - void Sq(); - - /** - * XML Version spec - */ - void VersionInfo(); - - /** - * Your basic equals sign with surrounding whitespace. - */ - void Eq(); - - /** - * Read in an attribute value. - */ - FString AttValue(); - - /** - * Read in the name of something. - */ - FString Name(); - - /** - * Encoding decleration in the header - */ - void EncodingDecl(); - - /** - * Standalone decleration in the header - */ - void SDDecl(); - - bool isS( unsigned char c ) - { - return ( c == 0x20 || c == 0x9 || c == 0xD || c == 0xA ); - } - }; -} - -#endif diff --git a/src/inprogress/xmlwriter.cpp b/src/inprogress/xmlwriter.cpp deleted file mode 100644 index 1489b28..0000000 --- a/src/inprogress/xmlwriter.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#include "xmlwriter.h" - -Bu::XmlWriter::XmlWriter() -{ -} - -Bu::XmlWriter::~XmlWriter() -{ -} diff --git a/src/inprogress/xmlwriter.h b/src/inprogress/xmlwriter.h deleted file mode 100644 index 45bc22e..0000000 --- a/src/inprogress/xmlwriter.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007-2008 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#ifndef XML_WRITER_H -#define XML_WRITER_H - -#include - -namespace Bu -{ - /** - * - */ - class XmlWriter - { - public: - XmlWriter(); - virtual ~XmlWriter(); - - private: - - }; -} - -#endif -- cgit v1.2.3