Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
RelaxNG.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef INCLUDED_RELAXNG
19#define INCLUDED_RELAXNG
20
21#include "lib/file/vfs/vfs.h"
22#include "maths/MD5.h"
23
24typedef struct _xmlRelaxNG xmlRelaxNG;
26typedef struct _xmlDoc xmlDoc;
28
30{
31public:
34
35 bool LoadGrammar(const std::string& grammar);
36
37 bool LoadGrammarFile(const PIVFS& vfs, const VfsPath& grammarPath);
38
39 MD5 GetGrammarHash() const { return m_Hash; }
40
41 bool Validate(const std::string& filename, const std::string& document) const;
42
43 bool ValidateEncoded(const std::string& filename, const std::string& document) const;
44
45 bool ValidateEncoded(xmlDocPtr doc) const;
46
47 bool CanValidate() const;
48
49private:
52};
53
54/**
55 * There should be no references to validators or schemas outside of the cache anymore when calling this.
56 */
57void ClearSchemaCache();
58
59#endif // INCLUDED_RELAXNG
void ClearSchemaCache()
There should be no references to validators or schemas outside of the cache anymore when calling this...
Definition: RelaxNG.cpp:45
xmlRelaxNG * xmlRelaxNGPtr
Definition: RelaxNG.h:25
xmlDoc * xmlDocPtr
Definition: RelaxNG.h:27
struct _xmlRelaxNG xmlRelaxNG
Definition: RelaxNG.h:24
xmlDoc * xmlDocPtr
Definition: XMBStorage.h:26
struct _xmlDoc xmlDoc
Definition: XMBStorage.h:25
MD5 hashing algorithm.
Definition: MD5.h:28
Definition: path.h:80
Definition: RelaxNG.h:30
bool LoadGrammar(const std::string &grammar)
Definition: RelaxNG.cpp:95
bool LoadGrammarFile(const PIVFS &vfs, const VfsPath &grammarPath)
Definition: RelaxNG.cpp:124
bool ValidateEncoded(const std::string &filename, const std::string &document) const
Definition: RelaxNG.cpp:140
RelaxNGValidator()
Definition: RelaxNG.cpp:86
xmlRelaxNGPtr m_Schema
Definition: RelaxNG.h:51
~RelaxNGValidator()
Definition: RelaxNG.cpp:91
MD5 GetGrammarHash() const
Definition: RelaxNG.h:39
MD5 m_Hash
Definition: RelaxNG.h:50
bool CanValidate() const
Definition: RelaxNG.cpp:185
bool Validate(const std::string &filename, const std::string &document) const
Definition: RelaxNG.cpp:133
Definition: vfs_util.cpp:39
std::shared_ptr< IVFS > PIVFS
Definition: vfs.h:220