libhext: C++ Library Documentation 1.0.13-b24695d
Loading...
Searching...
No Matches
ParseHext.h
Go to the documentation of this file.
1// Copyright 2015, 2016 Thomas Trapp
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef HEXT_PARSE_HEXT_H_INCLUDED
16#define HEXT_PARSE_HEXT_H_INCLUDED
17
18/// @file
19/// Declares hext::ParseHext
20
21#include "hext/Rule.h"
22#include "hext/SyntaxError.h"
23#include "hext/Visibility.h"
24
25#include <cstddef>
26
27
28namespace hext {
29
30
31/// Parses a null-terminated string containing hext rule definitions.
32/// Throws SyntaxError with a detailed error message on invalid input.
33///
34/// @par Example:
35/// ~~~~~~~~~~~~~
36/// try {
37/// Rule rule = ParseHext("<a href:link />");
38/// } catch( SyntaxError& e ) {
39/// // e.what() will contain a detailed error message.
40/// }
41/// ~~~~~~~~~~~~~
42///
43/// @throws SyntaxError
44///
45/// @param hext: A null-terminated string containing hext rule definitions.
46/// @returns The parsed Rule.
48
49/// Parses a buffer containing hext rule definitions.
50/// Throws SyntaxError with a detailed error message on invalid input.
51///
52/// @par Example:
53/// ~~~~~~~~~~~~~
54/// std::string hext_str("<a href:link />");
55/// try {
56/// Rule rule = ParseHext(hext_str.c_str(), hext_str.size());
57/// // ... do sth. with rule ...
58/// } catch( SyntaxError& e ) {
59/// // e.what() will contain a detailed error message.
60/// }
61/// ~~~~~~~~~~~~~
62///
63/// @throws SyntaxError
64///
65/// @param hext: A string containing hext rule definitions.
66/// @param size: The length of the string.
67/// @returns The parsed Rule.
68HEXT_PUBLIC Rule ParseHext(const char * hext, std::size_t size);
69
70
71} // namespace hext
72
73
74#endif // HEXT_PARSE_HEXT_H_INCLUDED
75
Declares hext::Rule.
Declares hext::SyntaxError.
Defines HEXT_PUBLIC and HEXT_PRIVATE.
#define HEXT_PUBLIC
Definition Visibility.h:26
Extracts values from HTML.
Definition Rule.h:90
HEXT_PUBLIC Rule ParseHext(const char *hext)
Parses a null-terminated string containing hext rule definitions.