aboutsummaryrefslogtreecommitdiff
path: root/third_party/image_io/includes/image_io/xml/xml_pi_rule.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/image_io/includes/image_io/xml/xml_pi_rule.h')
-rw-r--r--third_party/image_io/includes/image_io/xml/xml_pi_rule.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/third_party/image_io/includes/image_io/xml/xml_pi_rule.h b/third_party/image_io/includes/image_io/xml/xml_pi_rule.h
new file mode 100644
index 0000000..674a3fa
--- /dev/null
+++ b/third_party/image_io/includes/image_io/xml/xml_pi_rule.h
@@ -0,0 +1,32 @@
+#ifndef IMAGE_IO_XML_XML_PI_RULE_H_ // NOLINT
+#define IMAGE_IO_XML_XML_PI_RULE_H_ // NOLINT
+
+#include "image_io/xml/xml_rule.h"
+
+namespace photos_editing_formats {
+namespace image_io {
+
+/// The XmlPiRule parses the processing information syntax: "<?...?>". This
+/// syntax is considerably simplified from the official XML specification. As
+/// documented in the comments for the XmlHandler Pi() function, The leading
+/// "<?" syntax is never sent to the handler, while the trailing "?>" literal
+/// is always sent as part of the processing content token. This approach makes
+/// it much easier to parse XML syntax. The alternate start point constructor
+/// is used by the XmlElementContentRule.
+class XmlPiRule : public XmlRule {
+ public:
+ XmlPiRule();
+ explicit XmlPiRule(StartPoint start_point);
+
+ private:
+ /// Builds an XmlTokenContext from the XmlActionContext and calls the
+ /// handler's Pi() function.
+ /// @param context The action context from the rule's terminal.
+ /// @return The result value from the handler's function.
+ DataMatchResult HandlePiValue(const XmlActionContext& context);
+};
+
+} // namespace image_io
+} // namespace photos_editing_formats
+
+#endif // IMAGE_IO_XML_XML_PI_RULE_H_ // NOLINT