summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_xmllocale.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2018-04-13 16:44:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-13 16:44:05 +0000
commit27e364389e507f69ee9dc256cd4dbe558d05f887 (patch)
treee4da5ff121e54da5c3beeba7a047799536beb4d6 /xfa/fxfa/parser/cxfa_xmllocale.cpp
parente04b66cc759c2cf0ceafae47340fdf9588ca2e23 (diff)
downloadpdfium-27e364389e507f69ee9dc256cd4dbe558d05f887.tar.xz
Hide XML parsing inside CXFA_XMLLocale
This CL moves the parsing of the XML document into a static method of CXFA_XMLLocale. This removes the need for CXFA_LocaleMgr to care about the XML parser used. Change-Id: I04d14d78f458bfb37f0370fac2eb752e9840bfd6 Reviewed-on: https://pdfium-review.googlesource.com/30390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_xmllocale.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_xmllocale.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp
index 659c7bbefe..ce68c71e19 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.cpp
+++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -16,6 +16,15 @@
#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
#include "xfa/fxfa/parser/xfa_utils.h"
+// static
+std::unique_ptr<CXFA_XMLLocale> CXFA_XMLLocale::Create(
+ pdfium::span<uint8_t> data) {
+ std::unique_ptr<CXML_Element> pLocale =
+ CXML_Element::Parse(data.data(), data.size());
+ return pLocale ? pdfium::MakeUnique<CXFA_XMLLocale>(std::move(pLocale))
+ : nullptr;
+}
+
CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData)
: m_pLocaleData(std::move(pLocaleData)) {}