From 2462d03f322261bd616721c2b2065c4004b36c9c Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 11 May 2024 21:28:48 +0900 Subject: Initial import (as is) from Debian Snapshot's 'fbreader' source code (https://snapshot.debian.org/package/fbreader/0.99.4%2Bdfsg-6). The Debian code is provided under GPL2 license. Signed-off-by: Michele Calgaro --- fbreader/src/network/opds/OPDSXMLParser.h | 79 +++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 fbreader/src/network/opds/OPDSXMLParser.h (limited to 'fbreader/src/network/opds/OPDSXMLParser.h') diff --git a/fbreader/src/network/opds/OPDSXMLParser.h b/fbreader/src/network/opds/OPDSXMLParser.h new file mode 100644 index 0000000..82f0124 --- /dev/null +++ b/fbreader/src/network/opds/OPDSXMLParser.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2009-2012 Geometer Plus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#ifndef __OPDSXMLPARSER_H__ +#define __OPDSXMLPARSER_H__ + +#include + +#include "OPDSMetadata.h" +#include "OPDSFeedReader.h" + + +class OPDSXMLParser : public ZLXMLReader { + +public: + static const std::string KEY_PRICE; + static const std::string KEY_CURRENCY; + static const std::string KEY_FORMAT; + +public: + OPDSXMLParser(shared_ptr feedReader, bool readEntryNotFeed = false); + +protected: + void startElementHandler(const char *tag, const char **attributes); + void endElementHandler(const char *tag); + void characterDataHandler(const char *text, std::size_t len); + bool processNamespaces() const; + +protected: + enum State { + START, + FEED, F_ENTRY, F_ID, F_LINK, F_CATEGORY, F_TITLE, F_UPDATED, F_AUTHOR, F_SUBTITLE, F_ICON, F_SUMMARY, + FA_NAME, FA_URI, FA_EMAIL, + FE_AUTHOR, FE_ID, FE_CATEGORY, FE_LINK, FE_PUBLISHED, FE_SUMMARY, FE_CONTENT, FE_SUBTITLE, FE_TITLE, FE_ICON, FE_UPDATED, FE_DC_LANGUAGE, FE_DC_ISSUED, FE_DC_PUBLISHER, FE_CALIBRE_SERIES, FE_CALIBRE_SERIES_INDEX, + FEL_PRICE, FEL_FORMAT, + FEA_NAME, FEA_URI, FEA_EMAIL, + OPENSEARCH_TOTALRESULTS, OPENSEARCH_ITEMSPERPAGE, OPENSEARCH_STARTINDEX, + FEC_HACK_SPAN, + }; + +protected: + shared_ptr myFeedReader; + State myState; + +private: + std::string myBuffer; + shared_ptr myFeed; + shared_ptr myEntry; + + shared_ptr myAuthor; + shared_ptr myId; + shared_ptr myIcon; + shared_ptr myLink; + shared_ptr myCategory; + shared_ptr myUpdated; + shared_ptr myPublished; + + //shared_ptr myTitle; // TODO: implement ATOMTextConstruct & ATOMTitle + //shared_ptr mySummary; // TODO: implement ATOMTextConstruct & ATOMSummary + bool mySummaryTagFound; +}; + +#endif /* __OPDSXMLPARSER_H__ */ -- cgit v1.2.1