mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-13 20:37:12 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
92
vendor/POCO/PageCompiler/src/PageReader.h
vendored
Normal file
92
vendor/POCO/PageCompiler/src/PageReader.h
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
//
|
||||
// PageReader.h
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef PageReader_INCLUDED
|
||||
#define PageReader_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Poco.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
class Page;
|
||||
|
||||
|
||||
class PageReader
|
||||
/// This class implements the parser for reading page files
|
||||
/// containing JSP-style tags.
|
||||
{
|
||||
public:
|
||||
PageReader(Page& page, const std::string& path);
|
||||
/// Creates the PageReader, using the given Page.
|
||||
|
||||
PageReader(const PageReader& parent, const std::string& path);
|
||||
/// Creates the PageReader, using the given PageReader as parent.
|
||||
|
||||
~PageReader();
|
||||
/// Destroys the PageReader.
|
||||
|
||||
void parse(std::istream& pageStream);
|
||||
/// Parses a HTML file containing server page directives,
|
||||
/// converts the file into C++ code and adds the code
|
||||
/// to the reader's Page object. Also parses page
|
||||
/// attributes and include directives.
|
||||
|
||||
void emitLineDirectives(bool flag = true);
|
||||
/// Enables writing of #line directives to generated code.
|
||||
|
||||
protected:
|
||||
enum ParsingState
|
||||
{
|
||||
STATE_MARKUP,
|
||||
STATE_IMPLDECL,
|
||||
STATE_HDRDECL,
|
||||
STATE_PREHANDLER,
|
||||
STATE_BLOCK,
|
||||
STATE_EXPR,
|
||||
STATE_ESC_EXPR,
|
||||
STATE_COMMENT,
|
||||
STATE_ATTR
|
||||
};
|
||||
|
||||
static const std::string MARKUP_BEGIN;
|
||||
static const std::string MARKUP_END;
|
||||
static const std::string EXPR_BEGIN;
|
||||
static const std::string EXPR_END;
|
||||
static const std::string ESC_EXPR_BEGIN;
|
||||
static const std::string ESC_EXPR_END;
|
||||
|
||||
void include(const std::string& path);
|
||||
void parseAttributes();
|
||||
void nextToken(std::istream& istr, std::string& token);
|
||||
void handleAttribute(const std::string& name, const std::string& value);
|
||||
std::string where() const;
|
||||
bool escape() const;
|
||||
|
||||
protected:
|
||||
void generateLineDirective(std::ostream& ostr);
|
||||
|
||||
private:
|
||||
PageReader();
|
||||
PageReader(const PageReader&);
|
||||
PageReader& operator = (const PageReader&);
|
||||
|
||||
Page& _page;
|
||||
const PageReader* _pParent;
|
||||
std::string _path;
|
||||
std::string _attrs;
|
||||
std::streamsize _line;
|
||||
bool _emitLineDirectives;
|
||||
};
|
||||
|
||||
|
||||
#endif // PageReader_INCLUDED
|
Reference in New Issue
Block a user