Convert to absl::optional, part 1.
Search and replace. Then clang-format. Leave the headers alone for now.
Bug: pdfium:1726
Change-Id: I14612c871e16dd2fc0c69555171a55b71fa937cd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85517
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cfx_globaldata.cpp b/fxjs/cfx_globaldata.cpp
index 26e30bf..cc1084f 100644
--- a/fxjs/cfx_globaldata.cpp
+++ b/fxjs/cfx_globaldata.cpp
@@ -257,7 +257,7 @@
bool ret;
{
// Span can't outlive call to BufferDone().
- Optional<pdfium::span<uint8_t>> buffer = m_pDelegate->LoadBuffer();
+ absl::optional<pdfium::span<uint8_t>> buffer = m_pDelegate->LoadBuffer();
if (!buffer.has_value() || buffer.value().empty())
return false;
diff --git a/fxjs/cfx_globaldata.h b/fxjs/cfx_globaldata.h
index 5d260c7..40e5548 100644
--- a/fxjs/cfx_globaldata.h
+++ b/fxjs/cfx_globaldata.h
@@ -23,7 +23,7 @@
virtual ~Delegate() = default;
virtual bool StoreBuffer(pdfium::span<const uint8_t> pBuffer) = 0;
- virtual Optional<pdfium::span<uint8_t>> LoadBuffer() = 0;
+ virtual absl::optional<pdfium::span<uint8_t>> LoadBuffer() = 0;
virtual void BufferDone() = 0;
};
diff --git a/fxjs/cfx_globaldata_unittest.cpp b/fxjs/cfx_globaldata_unittest.cpp
index 24c080a..99dbccf 100644
--- a/fxjs/cfx_globaldata_unittest.cpp
+++ b/fxjs/cfx_globaldata_unittest.cpp
@@ -21,7 +21,7 @@
buffer.begin(), buffer.end());
return true;
}
- Optional<pdfium::span<uint8_t>> LoadBuffer() override {
+ absl::optional<pdfium::span<uint8_t>> LoadBuffer() override {
return pdfium::span<uint8_t>(last_buffer_);
}
void BufferDone() override {
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index af68a2e..9f15613 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -562,7 +562,7 @@
GetIsolate()->SetData(g_embedderDataSlot, nullptr);
}
-Optional<IJS_Runtime::JS_Error> CFXJS_Engine::Execute(
+absl::optional<IJS_Runtime::JS_Error> CFXJS_Engine::Execute(
const WideString& script) {
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::TryCatch try_catch(GetIsolate());
diff --git a/fxjs/cfxjs_engine.h b/fxjs/cfxjs_engine.h
index 4f1c08e..45dc664 100644
--- a/fxjs/cfxjs_engine.h
+++ b/fxjs/cfxjs_engine.h
@@ -120,7 +120,7 @@
void ReleaseEngine();
// Called after FXJS_InitializeEngine call made.
- Optional<IJS_Runtime::JS_Error> Execute(const WideString& script);
+ absl::optional<IJS_Runtime::JS_Error> Execute(const WideString& script);
v8::Local<v8::Object> GetThisObj();
v8::Local<v8::Object> NewFXJSBoundObject(uint32_t nObjDefnID,
diff --git a/fxjs/cfxjs_engine_embeddertest.cpp b/fxjs/cfxjs_engine_embeddertest.cpp
index abeb64d..5763f4d 100644
--- a/fxjs/cfxjs_engine_embeddertest.cpp
+++ b/fxjs/cfxjs_engine_embeddertest.cpp
@@ -35,7 +35,8 @@
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- Optional<IJS_Runtime::JS_Error> err = engine()->Execute(WideString(kScript1));
+ absl::optional<IJS_Runtime::JS_Error> err =
+ engine()->Execute(WideString(kScript1));
EXPECT_FALSE(err);
CheckAssignmentInEngineContext(engine(), kExpected1);
}
@@ -52,7 +53,7 @@
v8::Context::Scope context_scope(GetV8Context());
{
- Optional<IJS_Runtime::JS_Error> err =
+ absl::optional<IJS_Runtime::JS_Error> err =
engine()->Execute(WideString(kScript0));
EXPECT_FALSE(err);
CheckAssignmentInEngineContext(engine(), kExpected0);
@@ -60,7 +61,8 @@
{
// engine1 executing in engine1's context doesn't affect main.
v8::Context::Scope context_scope1(engine1.GetV8Context());
- Optional<IJS_Runtime::JS_Error> err = engine1.Execute(WideString(kScript1));
+ absl::optional<IJS_Runtime::JS_Error> err =
+ engine1.Execute(WideString(kScript1));
EXPECT_FALSE(err);
CheckAssignmentInEngineContext(engine(), kExpected0);
CheckAssignmentInEngineContext(&engine1, kExpected1);
@@ -68,7 +70,8 @@
{
// engine1 executing in engine2's context doesn't affect engine1.
v8::Context::Scope context_scope2(engine2.GetV8Context());
- Optional<IJS_Runtime::JS_Error> err = engine1.Execute(WideString(kScript2));
+ absl::optional<IJS_Runtime::JS_Error> err =
+ engine1.Execute(WideString(kScript2));
EXPECT_FALSE(err);
CheckAssignmentInEngineContext(engine(), kExpected0);
CheckAssignmentInEngineContext(&engine1, kExpected1);
@@ -83,7 +86,7 @@
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- Optional<IJS_Runtime::JS_Error> err =
+ absl::optional<IJS_Runtime::JS_Error> err =
engine()->Execute(L"functoon(x) { return x+1; }");
EXPECT_TRUE(err);
EXPECT_STREQ(L"SyntaxError: Unexpected token '{'", err->exception.c_str());
@@ -96,7 +99,7 @@
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- Optional<IJS_Runtime::JS_Error> err =
+ absl::optional<IJS_Runtime::JS_Error> err =
engine()->Execute(L"let a = 3;\nundefined.colour");
EXPECT_TRUE(err);
EXPECT_EQ(
diff --git a/fxjs/cfxjs_engine_unittest.cpp b/fxjs/cfxjs_engine_unittest.cpp
index 0470a78..496aead 100644
--- a/fxjs/cfxjs_engine_unittest.cpp
+++ b/fxjs/cfxjs_engine_unittest.cpp
@@ -84,7 +84,7 @@
EXPECT_FALSE(temp_destroyed);
}
- Optional<IJS_Runtime::JS_Error> err = engine()->Execute(L"gc();");
+ absl::optional<IJS_Runtime::JS_Error> err = engine()->Execute(L"gc();");
EXPECT_FALSE(err);
EXPECT_TRUE(perm_created);
diff --git a/fxjs/cjs_event_context.cpp b/fxjs/cjs_event_context.cpp
index da8b8ee..888d429 100644
--- a/fxjs/cjs_event_context.cpp
+++ b/fxjs/cjs_event_context.cpp
@@ -22,7 +22,7 @@
CJS_EventContext::~CJS_EventContext() = default;
-Optional<IJS_Runtime::JS_Error> CJS_EventContext::RunScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_EventContext::RunScript(
const WideString& script) {
v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
@@ -44,7 +44,7 @@
1, 1, JSGetStringFromID(JSMessage::kDuplicateEventError));
}
- Optional<IJS_Runtime::JS_Error> err;
+ absl::optional<IJS_Runtime::JS_Error> err;
if (script.GetLength() > 0)
err = m_pRuntime->ExecuteScript(script);
diff --git a/fxjs/cjs_event_context.h b/fxjs/cjs_event_context.h
index b911fc2..6c07e44 100644
--- a/fxjs/cjs_event_context.h
+++ b/fxjs/cjs_event_context.h
@@ -47,7 +47,8 @@
~CJS_EventContext() override;
// IJS_EventContext
- Optional<IJS_Runtime::JS_Error> RunScript(const WideString& script) override;
+ absl::optional<IJS_Runtime::JS_Error> RunScript(
+ const WideString& script) override;
void OnDoc_Open(const WideString& strTargetName) override;
void OnDoc_WillPrint() override;
void OnDoc_DidPrint() override;
diff --git a/fxjs/cjs_event_context_stub.cpp b/fxjs/cjs_event_context_stub.cpp
index d19c6eb..e5b6f30 100644
--- a/fxjs/cjs_event_context_stub.cpp
+++ b/fxjs/cjs_event_context_stub.cpp
@@ -10,7 +10,7 @@
CJS_EventContextStub::~CJS_EventContextStub() = default;
-Optional<IJS_Runtime::JS_Error> CJS_EventContextStub::RunScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_EventContextStub::RunScript(
const WideString& script) {
return IJS_Runtime::JS_Error(1, 1, L"JavaScript support not present");
}
diff --git a/fxjs/cjs_event_context_stub.h b/fxjs/cjs_event_context_stub.h
index 44d4a85..72d9613 100644
--- a/fxjs/cjs_event_context_stub.h
+++ b/fxjs/cjs_event_context_stub.h
@@ -15,7 +15,8 @@
~CJS_EventContextStub() override;
// IJS_EventContext:
- Optional<IJS_Runtime::JS_Error> RunScript(const WideString& script) override;
+ absl::optional<IJS_Runtime::JS_Error> RunScript(
+ const WideString& script) override;
void OnDoc_Open(const WideString& strTargetName) override {}
void OnDoc_WillPrint() override {}
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index a2974e4..ba447b1 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -63,7 +63,7 @@
if (IsComboBoxOrTextField(pFormField)) {
for (auto& pObserved : widgets) {
if (pObserved) {
- Optional<WideString> sValue =
+ absl::optional<WideString> sValue =
ToCPDFSDKWidget(pObserved.Get())->OnFormat();
if (pObserved) { // Not redundant, may be clobbered by OnFormat.
auto* pWidget = ToCPDFSDKWidget(pObserved.Get());
@@ -121,7 +121,7 @@
FormFieldType fieldType = pWidget->GetFieldType();
if (fieldType == FormFieldType::kComboBox ||
fieldType == FormFieldType::kTextField) {
- Optional<WideString> sValue = pWidget->OnFormat();
+ absl::optional<WideString> sValue = pWidget->OnFormat();
if (!observed_widget)
return;
pWidget->ResetAppearance(sValue, CPDFSDK_Widget::kValueUnchanged);
@@ -151,7 +151,7 @@
int control_index;
};
-Optional<FieldNameData> ParseFieldName(const WideString& field_name) {
+absl::optional<FieldNameData> ParseFieldName(const WideString& field_name) {
auto reverse_it = field_name.rbegin();
while (reverse_it != field_name.rend()) {
if (*reverse_it == L'.')
@@ -655,7 +655,7 @@
swFieldNameTemp.Replace(L"..", L".");
if (pForm->CountFields(swFieldNameTemp) <= 0) {
- Optional<FieldNameData> parsed_data = ParseFieldName(swFieldNameTemp);
+ absl::optional<FieldNameData> parsed_data = ParseFieldName(swFieldNameTemp);
if (!parsed_data.has_value())
return false;
@@ -1918,7 +1918,7 @@
return CJS_Result::Failure(JSMessage::kBadObjectError);
CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance();
- Optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair =
+ absl::optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair =
FieldAppearance.GetColorARGB();
CFX_Color crRet;
@@ -1969,7 +1969,8 @@
return CJS_Result::Failure(JSMessage::kObjectTypeError);
}
- Optional<WideString> wsFontName = pFormControl->GetDefaultControlFontName();
+ absl::optional<WideString> wsFontName =
+ pFormControl->GetDefaultControlFontName();
if (!wsFontName.has_value())
return CJS_Result::Failure(JSMessage::kBadObjectError);
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index dc481c4..beb1bde 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -209,9 +209,9 @@
str->Replace(L",", L".");
}
-Optional<double> ApplyNamedOperation(const wchar_t* sFunction,
- double dValue1,
- double dValue2) {
+absl::optional<double> ApplyNamedOperation(const wchar_t* sFunction,
+ double dValue1,
+ double dValue2) {
if (FXSYS_wcsicmp(sFunction, L"AVG") == 0 ||
FXSYS_wcsicmp(sFunction, L"SUM") == 0) {
return dValue1 + dValue2;
@@ -840,7 +840,7 @@
strValue.ReleaseBuffer(szNewSize);
// for processing separator style
- Optional<size_t> mark_pos = strValue.Find('.');
+ absl::optional<size_t> mark_pos = strValue.Find('.');
if (mark_pos.has_value()) {
char mark = DecimalMarkForStyle(iSepStyle);
if (mark != '.')
@@ -1245,7 +1245,8 @@
if (isnan(arg1) || isnan(arg2))
return CJS_Result::Failure(JSMessage::kValueError);
- Optional<double> result = ApplyNamedOperation(sFunction.c_str(), arg1, arg2);
+ absl::optional<double> result =
+ ApplyNamedOperation(sFunction.c_str(), arg1, arg2);
if (!result.has_value())
return CJS_Result::Failure(JSMessage::kValueError);
@@ -1344,7 +1345,7 @@
wcscmp(sFunction.c_str(), L"MAX") == 0)) {
dValue = dTemp;
}
- Optional<double> dResult =
+ absl::optional<double> dResult =
ApplyNamedOperation(sFunction.c_str(), dValue, dTemp);
if (!dResult.has_value())
return CJS_Result::Failure(JSMessage::kValueError);
diff --git a/fxjs/cjs_result.h b/fxjs/cjs_result.h
index f639842..1f1a215 100644
--- a/fxjs/cjs_result.h
+++ b/fxjs/cjs_result.h
@@ -50,7 +50,7 @@
explicit CJS_Result(const WideString&); // Error with custom message.
explicit CJS_Result(JSMessage id); // Error with stock message.
- Optional<WideString> error_;
+ absl::optional<WideString> error_;
v8::Local<v8::Value> return_;
};
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index d73744c..91d2499 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -166,7 +166,7 @@
return m_pFormFillEnv.Get();
}
-Optional<IJS_Runtime::JS_Error> CJS_Runtime::ExecuteScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_Runtime::ExecuteScript(
const WideString& script) {
return Execute(script);
}
diff --git a/fxjs/cjs_runtime.h b/fxjs/cjs_runtime.h
index d95cb26..d36fe9f 100644
--- a/fxjs/cjs_runtime.h
+++ b/fxjs/cjs_runtime.h
@@ -34,7 +34,7 @@
IJS_EventContext* NewEventContext() override;
void ReleaseEventContext(IJS_EventContext* pContext) override;
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
- Optional<IJS_Runtime::JS_Error> ExecuteScript(
+ absl::optional<IJS_Runtime::JS_Error> ExecuteScript(
const WideString& script) override;
CJS_EventContext* GetCurrentEventContext() const;
diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp
index 39600fa..5ba2b9f 100644
--- a/fxjs/cjs_runtimestub.cpp
+++ b/fxjs/cjs_runtimestub.cpp
@@ -29,7 +29,7 @@
return nullptr;
}
-Optional<IJS_Runtime::JS_Error> CJS_RuntimeStub::ExecuteScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_RuntimeStub::ExecuteScript(
const WideString& script) {
return absl::nullopt;
}
diff --git a/fxjs/cjs_runtimestub.h b/fxjs/cjs_runtimestub.h
index 2b5e713..eda8a87 100644
--- a/fxjs/cjs_runtimestub.h
+++ b/fxjs/cjs_runtimestub.h
@@ -27,7 +27,7 @@
void ReleaseEventContext(IJS_EventContext* pContext) override;
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
- Optional<IJS_Runtime::JS_Error> ExecuteScript(
+ absl::optional<IJS_Runtime::JS_Error> ExecuteScript(
const WideString& script) override;
private:
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index 8a346d1..0a27b57 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -112,7 +112,8 @@
{
size_t offset = 0;
while (true) {
- Optional<size_t> offset_end = unsafe_fmt_string.Find(L"%", offset + 1);
+ absl::optional<size_t> offset_end =
+ unsafe_fmt_string.Find(L"%", offset + 1);
if (!offset_end.has_value()) {
unsafe_conversion_specifiers.push_back(
unsafe_fmt_string.Last(unsafe_fmt_string.GetLength() - offset));
diff --git a/fxjs/ijs_event_context.h b/fxjs/ijs_event_context.h
index f142ebc..7f4d7f3 100644
--- a/fxjs/ijs_event_context.h
+++ b/fxjs/ijs_event_context.h
@@ -20,7 +20,7 @@
public:
virtual ~IJS_EventContext() = default;
- virtual Optional<IJS_Runtime::JS_Error> RunScript(
+ virtual absl::optional<IJS_Runtime::JS_Error> RunScript(
const WideString& script) = 0;
virtual void OnDoc_Open(const WideString& strTargetName) = 0;
diff --git a/fxjs/ijs_runtime.h b/fxjs/ijs_runtime.h
index 4ce4acd..ed9b701 100644
--- a/fxjs/ijs_runtime.h
+++ b/fxjs/ijs_runtime.h
@@ -57,7 +57,7 @@
virtual IJS_EventContext* NewEventContext() = 0;
virtual void ReleaseEventContext(IJS_EventContext* pContext) = 0;
virtual CPDFSDK_FormFillEnvironment* GetFormFillEnv() const = 0;
- virtual Optional<JS_Error> ExecuteScript(const WideString& script) = 0;
+ virtual absl::optional<JS_Error> ExecuteScript(const WideString& script) = 0;
protected:
IJS_Runtime() = default;
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index 42c95da..82594ca 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -161,7 +161,7 @@
m_FM2JSContext = std::make_unique<CFXJSE_FormCalcContext>(
GetIsolate(), m_JsContext.get(), m_pDocument.Get());
}
- Optional<CFX_WideTextBuf> wsJavaScript =
+ absl::optional<CFX_WideTextBuf> wsJavaScript =
CFXJSE_FormCalcContext::Translate(m_pDocument->GetHeap(), wsScript);
if (!wsJavaScript.has_value()) {
hRetValue->SetUndefined(GetIsolate());
@@ -189,7 +189,7 @@
if (!refNode)
return false;
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
ResolveObjects(refNode, propname, dwFlag);
if (!maybeResult.has_value())
return false;
@@ -216,7 +216,7 @@
if (!refNode)
return false;
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
ResolveObjects(refNode, propname, dwFlag);
if (!maybeResult.has_value())
return false;
@@ -404,7 +404,7 @@
&pReturnValue)) {
return pReturnValue;
}
- Optional<XFA_SCRIPTATTRIBUTEINFO> info = XFA_GetScriptAttributeByName(
+ absl::optional<XFA_SCRIPTATTRIBUTEINFO> info = XFA_GetScriptAttributeByName(
pObject->GetElementType(), wsPropName.AsStringView());
if (info.has_value()) {
(*info.value().callback)(pIsolate, pObject->JSObject(), &pReturnValue,
@@ -442,7 +442,7 @@
CXFA_Object* pObject = pScriptContext->GetVariablesThis(pOriginalObject);
WideString wsPropName = WideString::FromUTF8(szPropName);
WideStringView wsPropNameView = wsPropName.AsStringView();
- Optional<XFA_SCRIPTATTRIBUTEINFO> info =
+ absl::optional<XFA_SCRIPTATTRIBUTEINFO> info =
XFA_GetScriptAttributeByName(pObject->GetElementType(), wsPropNameView);
if (info.has_value()) {
CJX_Object* jsObject = pObject->JSObject();
@@ -501,7 +501,7 @@
return FXJSE_ClassPropType::kMethod;
if (bQueryIn) {
- Optional<XFA_SCRIPTATTRIBUTEINFO> maybe_info =
+ absl::optional<XFA_SCRIPTATTRIBUTEINFO> maybe_info =
XFA_GetScriptAttributeByName(eType, wsPropName.AsStringView());
if (!maybe_info.has_value())
return FXJSE_ClassPropType::kNone;
@@ -580,7 +580,7 @@
if (!pTextNode)
return false;
- Optional<WideString> wsScript =
+ absl::optional<WideString> wsScript =
pTextNode->JSObject()->TryCData(XFA_Attribute::Value, true);
if (!wsScript.has_value())
return false;
@@ -657,14 +657,14 @@
fxv8::ReentrantDeleteObjectPropertyHelper(GetIsolate(), pObject, "Date");
}
-Optional<CFXJSE_Engine::ResolveResult> CFXJSE_Engine::ResolveObjects(
+absl::optional<CFXJSE_Engine::ResolveResult> CFXJSE_Engine::ResolveObjects(
CXFA_Object* refObject,
WideStringView wsExpression,
Mask<XFA_ResolveFlag> dwStyles) {
return ResolveObjectsWithBindNode(refObject, wsExpression, dwStyles, nullptr);
}
-Optional<CFXJSE_Engine::ResolveResult>
+absl::optional<CFXJSE_Engine::ResolveResult>
CFXJSE_Engine::ResolveObjectsWithBindNode(CXFA_Object* refObject,
WideStringView wsExpression,
Mask<XFA_ResolveFlag> dwStyles,
diff --git a/fxjs/xfa/cfxjse_engine.h b/fxjs/xfa/cfxjse_engine.h
index d07c799..acbddf6 100644
--- a/fxjs/xfa/cfxjse_engine.h
+++ b/fxjs/xfa/cfxjse_engine.h
@@ -116,11 +116,11 @@
CFXJSE_Value* pRetValue,
CXFA_Object* pThisObject);
- Optional<ResolveResult> ResolveObjects(CXFA_Object* refObject,
- WideStringView wsExpression,
- Mask<XFA_ResolveFlag> dwStyles);
+ absl::optional<ResolveResult> ResolveObjects(CXFA_Object* refObject,
+ WideStringView wsExpression,
+ Mask<XFA_ResolveFlag> dwStyles);
- Optional<ResolveResult> ResolveObjectsWithBindNode(
+ absl::optional<ResolveResult> ResolveObjectsWithBindNode(
CXFA_Object* refObject,
WideStringView wsExpression,
Mask<XFA_ResolveFlag> dwStyles,
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index e51d699..0569736 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -1447,8 +1447,8 @@
return fxv8::ReentrantToDoubleHelper(pIsolate, extracted);
}
-Optional<double> ExtractDouble(v8::Isolate* pIsolate,
- v8::Local<v8::Value> src) {
+absl::optional<double> ExtractDouble(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> src) {
if (src.IsEmpty())
return 0.0;
@@ -1559,7 +1559,7 @@
return v8::Local<v8::Value>();
CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(
pScriptContext->GetThisObject(),
WideString::FromUTF8(bsAccessorName).AsStringView(),
@@ -1575,7 +1575,7 @@
maybeResult.value().objects.front().Get());
}
-Optional<CFXJSE_Engine::ResolveResult> ResolveObjects(
+absl::optional<CFXJSE_Engine::ResolveResult> ResolveObjects(
CFXJSE_HostObject* pHostObject,
v8::Local<v8::Value> pRefValue,
ByteStringView bsSomExp,
@@ -1602,7 +1602,7 @@
if (bHasNoResolveName) {
WideString wsName;
if (CXFA_Node* pXFANode = pNode->AsNode()) {
- Optional<WideString> ret =
+ absl::optional<WideString> ret =
pXFANode->JSObject()->TryAttribute(XFA_Attribute::Name, false);
if (ret.has_value())
wsName = ret.value();
@@ -1829,8 +1829,10 @@
return;
}
- Optional<double> maybe_dividend = ExtractDouble(info.GetIsolate(), info[0]);
- Optional<double> maybe_divisor = ExtractDouble(info.GetIsolate(), info[1]);
+ absl::optional<double> maybe_dividend =
+ ExtractDouble(info.GetIsolate(), info[0]);
+ absl::optional<double> maybe_divisor =
+ ExtractDouble(info.GetIsolate(), info[1]);
if (!maybe_dividend.has_value() || !maybe_divisor.has_value()) {
pContext->ThrowArgumentMismatchException();
return;
@@ -1863,7 +1865,8 @@
return;
}
- Optional<double> maybe_value = ExtractDouble(info.GetIsolate(), info[0]);
+ absl::optional<double> maybe_value =
+ ExtractDouble(info.GetIsolate(), info[0]);
if (!maybe_value.has_value()) {
pContext->ThrowArgumentMismatchException();
return;
@@ -1876,7 +1879,7 @@
info.GetReturnValue().SetNull();
return;
}
- Optional<double> maybe_precision =
+ absl::optional<double> maybe_precision =
ExtractDouble(info.GetIsolate(), info[1]);
if (!maybe_precision.has_value()) {
pContext->ThrowArgumentMismatchException();
@@ -3301,8 +3304,9 @@
}
WideString wsCalcScript = WideString::FromUTF8(bsUtf8Script.AsStringView());
- Optional<CFX_WideTextBuf> wsJavaScriptBuf = CFXJSE_FormCalcContext::Translate(
- pContext->GetDocument()->GetHeap(), wsCalcScript.AsStringView());
+ absl::optional<CFX_WideTextBuf> wsJavaScriptBuf =
+ CFXJSE_FormCalcContext::Translate(pContext->GetDocument()->GetHeap(),
+ wsCalcScript.AsStringView());
if (!wsJavaScriptBuf.has_value()) {
pContext->ThrowCompilerErrorException();
return;
@@ -5110,8 +5114,9 @@
}
WideString wsCalcScript = WideString::FromUTF8(bsArg.AsStringView());
- Optional<CFX_WideTextBuf> wsJavaScriptBuf = CFXJSE_FormCalcContext::Translate(
- pContext->GetDocument()->GetHeap(), wsCalcScript.AsStringView());
+ absl::optional<CFX_WideTextBuf> wsJavaScriptBuf =
+ CFXJSE_FormCalcContext::Translate(pContext->GetDocument()->GetHeap(),
+ wsCalcScript.AsStringView());
if (!wsJavaScriptBuf.has_value()) {
pContext->ThrowCompilerErrorException();
return;
@@ -5291,7 +5296,7 @@
return bsSomExp;
}
-Optional<CFX_WideTextBuf> CFXJSE_FormCalcContext::Translate(
+absl::optional<CFX_WideTextBuf> CFXJSE_FormCalcContext::Translate(
cppgc::Heap* pHeap,
WideStringView wsFormcalc) {
if (wsFormcalc.IsEmpty())
@@ -5304,7 +5309,7 @@
return absl::nullopt;
CXFA_FMToJavaScriptDepth::Reset();
- Optional<CFX_WideTextBuf> wsJavaScript = ast->ToJavaScript();
+ absl::optional<CFX_WideTextBuf> wsJavaScript = ast->ToJavaScript();
if (!wsJavaScript.has_value())
return absl::nullopt;
@@ -5379,7 +5384,7 @@
for (uint32_t i = 2; i < iLength; i++) {
v8::Local<v8::Value> hJSObjValue =
fxv8::ReentrantGetArrayElementHelper(info.GetIsolate(), arr, i);
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
ResolveObjects(pThis, hJSObjValue, bsSomExp.AsStringView(),
bDotAccessor, bHasNoResolveName);
if (maybeResult.has_value()) {
@@ -5409,7 +5414,7 @@
return;
}
- Optional<CFXJSE_Engine::ResolveResult> maybeResult;
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult;
ByteString bsAccessorName =
fxv8::ReentrantToByteStringHelper(info.GetIsolate(), info[1]);
if (fxv8::IsObject(argAccessor) ||
diff --git a/fxjs/xfa/cfxjse_formcalc_context.h b/fxjs/xfa/cfxjse_formcalc_context.h
index ba79645..304359a 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.h
+++ b/fxjs/xfa/cfxjse_formcalc_context.h
@@ -270,8 +270,8 @@
int32_t iIndexFlags,
int32_t iIndexValue,
bool bIsStar);
- static Optional<CFX_WideTextBuf> Translate(cppgc::Heap* pHeap,
- WideStringView wsFormcalc);
+ static absl::optional<CFX_WideTextBuf> Translate(cppgc::Heap* pHeap,
+ WideStringView wsFormcalc);
v8::Local<v8::Value> GlobalPropertyGetter();
v8::Isolate* GetIsolate() const { return m_pIsolate.Get(); }
diff --git a/fxjs/xfa/cfxjse_mapmodule.cpp b/fxjs/xfa/cfxjse_mapmodule.cpp
index e2344082..dbd6fed 100644
--- a/fxjs/xfa/cfxjse_mapmodule.cpp
+++ b/fxjs/xfa/cfxjse_mapmodule.cpp
@@ -32,21 +32,21 @@
m_MeasurementMap[key] = measurement;
}
-Optional<int32_t> CFXJSE_MapModule::GetValue(uint32_t key) const {
+absl::optional<int32_t> CFXJSE_MapModule::GetValue(uint32_t key) const {
auto it = m_ValueMap.find(key);
if (it == m_ValueMap.end())
return absl::nullopt;
return it->second;
}
-Optional<WideString> CFXJSE_MapModule::GetString(uint32_t key) const {
+absl::optional<WideString> CFXJSE_MapModule::GetString(uint32_t key) const {
auto it = m_StringMap.find(key);
if (it == m_StringMap.end())
return absl::nullopt;
return it->second;
}
-Optional<CXFA_Measurement> CFXJSE_MapModule::GetMeasurement(
+absl::optional<CXFA_Measurement> CFXJSE_MapModule::GetMeasurement(
uint32_t key) const {
auto it = m_MeasurementMap.find(key);
if (it == m_MeasurementMap.end())
diff --git a/fxjs/xfa/cfxjse_mapmodule.h b/fxjs/xfa/cfxjse_mapmodule.h
index ce8fa07..ff641c5 100644
--- a/fxjs/xfa/cfxjse_mapmodule.h
+++ b/fxjs/xfa/cfxjse_mapmodule.h
@@ -27,9 +27,9 @@
void SetValue(uint32_t key, int32_t value);
void SetString(uint32_t key, const WideString& wsString);
void SetMeasurement(uint32_t key, const CXFA_Measurement& measurement);
- Optional<int32_t> GetValue(uint32_t key) const;
- Optional<WideString> GetString(uint32_t key) const;
- Optional<CXFA_Measurement> GetMeasurement(uint32_t key) const;
+ absl::optional<int32_t> GetValue(uint32_t key) const;
+ absl::optional<WideString> GetString(uint32_t key) const;
+ absl::optional<CXFA_Measurement> GetMeasurement(uint32_t key) const;
bool HasKey(uint32_t key) const;
void RemoveKey(uint32_t key);
void MergeDataFrom(const CFXJSE_MapModule* pSrc);
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.cpp b/fxjs/xfa/cfxjse_resolveprocessor.cpp
index 3bcf9f3..243cb9e 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.cpp
+++ b/fxjs/xfa/cfxjse_resolveprocessor.cpp
@@ -241,7 +241,7 @@
CXFA_Object* curNode,
CFXJSE_Engine::ResolveResult* rnd,
WideStringView strAttr) {
- Optional<XFA_SCRIPTATTRIBUTEINFO> info =
+ absl::optional<XFA_SCRIPTATTRIBUTEINFO> info =
XFA_GetScriptAttributeByName(curNode->GetElementType(), strAttr);
if (!info.has_value())
return false;
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index 4ebf524..20634e1 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -111,7 +111,7 @@
if (!node->IsWidgetReady())
return CJS_Result::Success(runtime->NewNull());
- Optional<WideString> value = node->GetChoiceListItem(iIndex, true);
+ absl::optional<WideString> value = node->GetChoiceListItem(iIndex, true);
if (!value.has_value())
return CJS_Result::Success(runtime->NewNull());
@@ -177,7 +177,7 @@
if (!node->IsWidgetReady())
return CJS_Result::Success(runtime->NewNull());
- Optional<WideString> value = node->GetChoiceListItem(iIndex, false);
+ absl::optional<WideString> value = node->GetChoiceListItem(iIndex, false);
if (!value.has_value())
return CJS_Result::Success(runtime->NewNull());
diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp
index ace4931..972b6dc 100644
--- a/fxjs/xfa/cjx_form.cpp
+++ b/fxjs/xfa/cjx_form.cpp
@@ -142,7 +142,8 @@
return;
}
- Optional<WideString> checksum = TryAttribute(XFA_Attribute::Checksum, false);
+ absl::optional<WideString> checksum =
+ TryAttribute(XFA_Attribute::Checksum, false);
*pValue = fxv8::NewStringHelper(
pIsolate,
checksum.has_value() ? checksum.value().ToUTF8().AsStringView() : "");
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index 8fec287..3a24157 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -295,7 +295,7 @@
constexpr Mask<XFA_ResolveFlag> kFlags = {XFA_ResolveFlag::kChildren,
XFA_ResolveFlag::kParent,
XFA_ResolveFlag::kSiblings};
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(
pObject, runtime->ToWideString(params[0]).AsStringView(), kFlags);
if (!maybeResult.has_value() ||
@@ -381,7 +381,7 @@
constexpr Mask<XFA_ResolveFlag> kFlags = {XFA_ResolveFlag::kChildren,
XFA_ResolveFlag::kParent,
XFA_ResolveFlag::kSiblings};
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(pObject, wsName.AsStringView(), kFlags);
if (!maybeResult.has_value() ||
!maybeResult.value().objects.front()->IsNode())
@@ -444,7 +444,7 @@
constexpr Mask<XFA_ResolveFlag> kFlags = {XFA_ResolveFlag::kChildren,
XFA_ResolveFlag::kParent,
XFA_ResolveFlag::kSiblings};
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(
pObject, runtime->ToWideString(params[0]).AsStringView(), kFlags);
if (!maybeResult.has_value() ||
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index f6ac5e7..e7a263d 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -181,7 +181,7 @@
return CJS_Result::Failure(JSMessage::kParamError);
WideString expression = runtime->ToWideString(params[0]);
- Optional<XFA_ATTRIBUTEINFO> attr =
+ absl::optional<XFA_ATTRIBUTEINFO> attr =
XFA_GetAttributeByName(expression.AsStringView());
if (attr.has_value() && HasAttribute(attr.value().attribute))
return CJS_Result::Success(runtime->NewBoolean(true));
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 0c8e5fe..ef3051f 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -209,7 +209,7 @@
bool bNotify) {
switch (GetXFANode()->GetAttributeType(eAttr)) {
case XFA_AttributeType::Enum: {
- Optional<XFA_AttributeValue> item =
+ absl::optional<XFA_AttributeValue> item =
XFA_GetAttributeValueByName(wsValue.AsStringView());
SetEnum(eAttr,
item.has_value() ? item.value()
@@ -239,7 +239,7 @@
void CJX_Object::SetAttributeByString(WideStringView wsAttr,
const WideString& wsValue) {
- Optional<XFA_ATTRIBUTEINFO> attr = XFA_GetAttributeByName(wsAttr);
+ absl::optional<XFA_ATTRIBUTEINFO> attr = XFA_GetAttributeByName(wsAttr);
if (attr.has_value()) {
SetAttributeByEnum(attr.value().attribute, wsValue, true);
return;
@@ -249,8 +249,8 @@
}
WideString CJX_Object::GetAttributeByString(WideStringView attr) const {
- Optional<WideString> result;
- Optional<XFA_ATTRIBUTEINFO> enum_attr = XFA_GetAttributeByName(attr);
+ absl::optional<WideString> result;
+ absl::optional<XFA_ATTRIBUTEINFO> enum_attr = XFA_GetAttributeByName(attr);
if (enum_attr.has_value())
result = TryAttribute(enum_attr.value().attribute, true);
else
@@ -262,11 +262,11 @@
return TryAttribute(attr, true).value_or(WideString());
}
-Optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
- bool bUseDefault) const {
+absl::optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
+ bool bUseDefault) const {
switch (GetXFANode()->GetAttributeType(eAttr)) {
case XFA_AttributeType::Enum: {
- Optional<XFA_AttributeValue> value = TryEnum(eAttr, bUseDefault);
+ absl::optional<XFA_AttributeValue> value = TryEnum(eAttr, bUseDefault);
if (!value.has_value())
return absl::nullopt;
return WideString::FromASCII(XFA_AttributeValueToName(value.value()));
@@ -275,19 +275,19 @@
return TryCData(eAttr, bUseDefault);
case XFA_AttributeType::Boolean: {
- Optional<bool> value = TryBoolean(eAttr, bUseDefault);
+ absl::optional<bool> value = TryBoolean(eAttr, bUseDefault);
if (!value.has_value())
return absl::nullopt;
return WideString(value.value() ? L"1" : L"0");
}
case XFA_AttributeType::Integer: {
- Optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
+ absl::optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
if (!iValue.has_value())
return absl::nullopt;
return WideString::Format(L"%d", iValue.value());
}
case XFA_AttributeType::Measure: {
- Optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
+ absl::optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
if (!value.has_value())
return absl::nullopt;
return value->ToString();
@@ -302,10 +302,10 @@
RemoveMapModuleKey(GetMapKey_Custom(wsAttr));
}
-Optional<bool> CJX_Object::TryBoolean(XFA_Attribute eAttr,
- bool bUseDefault) const {
+absl::optional<bool> CJX_Object::TryBoolean(XFA_Attribute eAttr,
+ bool bUseDefault) const {
uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
- Optional<int32_t> value = GetMapModuleValueFollowingChain(key);
+ absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
if (value.has_value())
return !!value.value();
if (!bUseDefault)
@@ -337,10 +337,10 @@
return TryInteger(eAttr, true).value_or(0);
}
-Optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
- bool bUseDefault) const {
+absl::optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
+ bool bUseDefault) const {
uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
- Optional<int32_t> value = GetMapModuleValueFollowingChain(key);
+ absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
if (value.has_value())
return value.value();
if (!bUseDefault)
@@ -348,10 +348,10 @@
return GetXFANode()->GetDefaultInteger(eAttr);
}
-Optional<XFA_AttributeValue> CJX_Object::TryEnum(XFA_Attribute eAttr,
- bool bUseDefault) const {
+absl::optional<XFA_AttributeValue> CJX_Object::TryEnum(XFA_Attribute eAttr,
+ bool bUseDefault) const {
uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
- Optional<int32_t> value = GetMapModuleValueFollowingChain(key);
+ absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
if (value.has_value())
return static_cast<XFA_AttributeValue>(value.value());
if (!bUseDefault)
@@ -386,10 +386,11 @@
OnChanged(eAttr, false);
}
-Optional<CXFA_Measurement> CJX_Object::TryMeasure(XFA_Attribute eAttr,
- bool bUseDefault) const {
+absl::optional<CXFA_Measurement> CJX_Object::TryMeasure(
+ XFA_Attribute eAttr,
+ bool bUseDefault) const {
uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
- Optional<CXFA_Measurement> result =
+ absl::optional<CXFA_Measurement> result =
GetMapModuleMeasurementFollowingChain(key);
if (result.has_value())
return result.value();
@@ -398,8 +399,8 @@
return GetXFANode()->GetDefaultMeasurement(eAttr);
}
-Optional<float> CJX_Object::TryMeasureAsFloat(XFA_Attribute attr) const {
- Optional<CXFA_Measurement> measure = TryMeasure(attr, false);
+absl::optional<float> CJX_Object::TryMeasureAsFloat(XFA_Attribute attr) const {
+ absl::optional<CXFA_Measurement> measure = TryMeasure(attr, false);
if (!measure.has_value())
return absl::nullopt;
return measure->ToUnit(XFA_Unit::Pt);
@@ -427,7 +428,7 @@
bool bScriptModify) {
CXFA_Node* xfaObj = GetXFANode();
uint32_t key = GetMapKey_Element(xfaObj->GetElementType(), eAttr);
- Optional<WideString> old_value = GetMapModuleString(key);
+ absl::optional<WideString> old_value = GetMapModuleString(key);
if (!old_value.has_value() || old_value.value() != wsValue) {
if (bNotify)
OnChanging(eAttr);
@@ -475,7 +476,7 @@
auto* xfaObj = GetXFANode();
uint32_t key =
GetMapKey_Element(xfaObj->GetElementType(), XFA_Attribute::Value);
- Optional<WideString> old_value = GetMapModuleString(key);
+ absl::optional<WideString> old_value = GetMapModuleString(key);
if (!old_value.has_value() || old_value.value() != wsValue) {
if (bNotify)
OnChanging(XFA_Attribute::Value);
@@ -487,10 +488,10 @@
}
}
-Optional<WideString> CJX_Object::TryCData(XFA_Attribute eAttr,
- bool bUseDefault) const {
+absl::optional<WideString> CJX_Object::TryCData(XFA_Attribute eAttr,
+ bool bUseDefault) const {
uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
- Optional<WideString> value = GetMapModuleStringFollowingChain(key);
+ absl::optional<WideString> value = GetMapModuleStringFollowingChain(key);
if (value.has_value())
return value;
@@ -504,7 +505,7 @@
int32_t value,
bool bNotify) {
uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
- Optional<int32_t> old_value = GetMapModuleValue(key);
+ absl::optional<int32_t> old_value = GetMapModuleValue(key);
if (!old_value.has_value() || old_value.value() != value) {
if (bNotify)
OnChanging(eAttr);
@@ -614,7 +615,7 @@
case XFA_ObjectType::ContentNode: {
WideString wsContentType;
if (GetXFANode()->GetElementType() == XFA_Element::ExData) {
- Optional<WideString> ret =
+ absl::optional<WideString> ret =
TryAttribute(XFA_Attribute::ContentType, false);
if (ret.has_value())
wsContentType = ret.value();
@@ -681,8 +682,8 @@
return TryContent(bScriptModify, true).value_or(WideString());
}
-Optional<WideString> CJX_Object::TryContent(bool bScriptModify,
- bool bProto) const {
+absl::optional<WideString> CJX_Object::TryContent(bool bScriptModify,
+ bool bProto) const {
CXFA_Node* pNode = nullptr;
switch (GetXFANode()->GetObjectType()) {
case XFA_ObjectType::ContainerNode:
@@ -709,7 +710,7 @@
if (!pContentRawDataNode) {
XFA_Element element = XFA_Element::Sharptext;
if (GetXFANode()->GetElementType() == XFA_Element::ExData) {
- Optional<WideString> contentType =
+ absl::optional<WideString> contentType =
TryAttribute(XFA_Attribute::ContentType, false);
if (contentType.has_value()) {
if (contentType.value().EqualsASCII("text/html"))
@@ -743,7 +744,7 @@
return absl::nullopt;
}
-Optional<WideString> CJX_Object::TryNamespace() const {
+absl::optional<WideString> CJX_Object::TryNamespace() const {
if (GetXFANode()->IsModelNode() ||
GetXFANode()->GetElementType() == XFA_Element::Packet) {
CFX_XMLNode* pXMLNode = GetXFANode()->GetXMLMappingNode();
@@ -808,21 +809,21 @@
CreateMapModule()->SetMeasurement(key, value);
}
-Optional<int32_t> CJX_Object::GetMapModuleValue(uint32_t key) const {
+absl::optional<int32_t> CJX_Object::GetMapModuleValue(uint32_t key) const {
CFXJSE_MapModule* pModule = GetMapModule();
if (!pModule)
return absl::nullopt;
return pModule->GetValue(key);
}
-Optional<WideString> CJX_Object::GetMapModuleString(uint32_t key) const {
+absl::optional<WideString> CJX_Object::GetMapModuleString(uint32_t key) const {
CFXJSE_MapModule* pModule = GetMapModule();
if (!pModule)
return absl::nullopt;
return pModule->GetString(key);
}
-Optional<CXFA_Measurement> CJX_Object::GetMapModuleMeasurement(
+absl::optional<CXFA_Measurement> CJX_Object::GetMapModuleMeasurement(
uint32_t key) const {
CFXJSE_MapModule* pModule = GetMapModule();
if (!pModule)
@@ -830,7 +831,7 @@
return pModule->GetMeasurement(key);
}
-Optional<int32_t> CJX_Object::GetMapModuleValueFollowingChain(
+absl::optional<int32_t> CJX_Object::GetMapModuleValueFollowingChain(
uint32_t key) const {
std::set<const CXFA_Node*> visited;
for (const CXFA_Node* pNode = GetXFANode(); pNode;
@@ -838,7 +839,7 @@
if (!visited.insert(pNode).second)
break;
- Optional<int32_t> result = pNode->JSObject()->GetMapModuleValue(key);
+ absl::optional<int32_t> result = pNode->JSObject()->GetMapModuleValue(key);
if (result.has_value())
return result;
@@ -848,7 +849,7 @@
return absl::nullopt;
}
-Optional<WideString> CJX_Object::GetMapModuleStringFollowingChain(
+absl::optional<WideString> CJX_Object::GetMapModuleStringFollowingChain(
uint32_t key) const {
std::set<const CXFA_Node*> visited;
for (const CXFA_Node* pNode = GetXFANode(); pNode;
@@ -856,7 +857,8 @@
if (!visited.insert(pNode).second)
break;
- Optional<WideString> result = pNode->JSObject()->GetMapModuleString(key);
+ absl::optional<WideString> result =
+ pNode->JSObject()->GetMapModuleString(key);
if (result.has_value())
return result;
@@ -866,15 +868,15 @@
return absl::nullopt;
}
-Optional<CXFA_Measurement> CJX_Object::GetMapModuleMeasurementFollowingChain(
- uint32_t key) const {
+absl::optional<CXFA_Measurement>
+CJX_Object::GetMapModuleMeasurementFollowingChain(uint32_t key) const {
std::set<const CXFA_Node*> visited;
for (const CXFA_Node* pNode = GetXFANode(); pNode;
pNode = pNode->GetTemplateNodeIfExists()) {
if (!visited.insert(pNode).second)
break;
- Optional<CXFA_Measurement> result =
+ absl::optional<CXFA_Measurement> result =
pNode->JSObject()->GetMapModuleMeasurement(key);
if (result.has_value())
return result;
@@ -1006,7 +1008,7 @@
CXFA_Node* pProtoNode = nullptr;
if (!wsSOM.IsEmpty()) {
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
GetDocument()->GetScriptContext()->ResolveObjects(
pProtoRoot, wsSOM.AsStringView(),
Mask<XFA_ResolveFlag>{
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index 4034f1d..a68ed0e 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -125,8 +125,8 @@
bool HasAttribute(XFA_Attribute eAttr) const;
WideString GetAttributeByString(WideStringView attr) const;
WideString GetAttributeByEnum(XFA_Attribute attr) const;
- Optional<WideString> TryAttribute(XFA_Attribute eAttr,
- bool bUseDefault) const;
+ absl::optional<WideString> TryAttribute(XFA_Attribute eAttr,
+ bool bUseDefault) const;
void SetAttributeByEnum(XFA_Attribute eAttr,
const WideString& wsValue,
bool bNotify);
@@ -134,7 +134,7 @@
void RemoveAttribute(WideStringView wsAttr);
WideString GetContent(bool bScriptModify) const;
- Optional<WideString> TryContent(bool bScriptModify, bool bProto) const;
+ absl::optional<WideString> TryContent(bool bScriptModify, bool bProto) const;
void SetContent(const WideString& wsContent,
const WideString& wsXMLValue,
bool bNotify,
@@ -174,30 +174,32 @@
JSE_PROP(ScriptSomInstanceIndex);
JSE_PROP(ScriptSubmitFormatMode);
- Optional<WideString> TryNamespace() const;
+ absl::optional<WideString> TryNamespace() const;
int32_t GetInteger(XFA_Attribute eAttr) const;
- Optional<int32_t> TryInteger(XFA_Attribute eAttr, bool bUseDefault) const;
+ absl::optional<int32_t> TryInteger(XFA_Attribute eAttr,
+ bool bUseDefault) const;
void SetInteger(XFA_Attribute eAttr, int32_t iValue, bool bNotify);
WideString GetCData(XFA_Attribute eAttr) const;
- Optional<WideString> TryCData(XFA_Attribute eAttr, bool bUseDefault) const;
+ absl::optional<WideString> TryCData(XFA_Attribute eAttr,
+ bool bUseDefault) const;
void SetCData(XFA_Attribute eAttr, const WideString& wsValue);
XFA_AttributeValue GetEnum(XFA_Attribute eAttr) const;
- Optional<XFA_AttributeValue> TryEnum(XFA_Attribute eAttr,
- bool bUseDefault) const;
+ absl::optional<XFA_AttributeValue> TryEnum(XFA_Attribute eAttr,
+ bool bUseDefault) const;
void SetEnum(XFA_Attribute eAttr, XFA_AttributeValue eValue, bool bNotify);
bool GetBoolean(XFA_Attribute eAttr) const;
- Optional<bool> TryBoolean(XFA_Attribute eAttr, bool bUseDefault) const;
+ absl::optional<bool> TryBoolean(XFA_Attribute eAttr, bool bUseDefault) const;
void SetBoolean(XFA_Attribute eAttr, bool bValue, bool bNotify);
CXFA_Measurement GetMeasure(XFA_Attribute eAttr) const;
float GetMeasureInUnit(XFA_Attribute eAttr, XFA_Unit unit) const;
- Optional<CXFA_Measurement> TryMeasure(XFA_Attribute eAttr,
- bool bUseDefault) const;
- Optional<float> TryMeasureAsFloat(XFA_Attribute attr) const;
+ absl::optional<CXFA_Measurement> TryMeasure(XFA_Attribute eAttr,
+ bool bUseDefault) const;
+ absl::optional<float> TryMeasureAsFloat(XFA_Attribute attr) const;
void SetMeasure(XFA_Attribute eAttr,
const CXFA_Measurement& mValue,
bool bNotify);
@@ -260,12 +262,13 @@
void SetMapModuleValue(uint32_t key, int32_t value);
void SetMapModuleString(uint32_t key, const WideString& wsValue);
void SetMapModuleMeasurement(uint32_t key, const CXFA_Measurement& value);
- Optional<int32_t> GetMapModuleValue(uint32_t key) const;
- Optional<WideString> GetMapModuleString(uint32_t key) const;
- Optional<CXFA_Measurement> GetMapModuleMeasurement(uint32_t key) const;
- Optional<int32_t> GetMapModuleValueFollowingChain(uint32_t key) const;
- Optional<WideString> GetMapModuleStringFollowingChain(uint32_t key) const;
- Optional<CXFA_Measurement> GetMapModuleMeasurementFollowingChain(
+ absl::optional<int32_t> GetMapModuleValue(uint32_t key) const;
+ absl::optional<WideString> GetMapModuleString(uint32_t key) const;
+ absl::optional<CXFA_Measurement> GetMapModuleMeasurement(uint32_t key) const;
+ absl::optional<int32_t> GetMapModuleValueFollowingChain(uint32_t key) const;
+ absl::optional<WideString> GetMapModuleStringFollowingChain(
+ uint32_t key) const;
+ absl::optional<CXFA_Measurement> GetMapModuleMeasurementFollowingChain(
uint32_t key) const;
bool HasMapModuleKey(uint32_t key) const;
void RemoveMapModuleKey(uint32_t key);
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index 006a096..8e402b2 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -48,7 +48,7 @@
if (pRefNode->GetElementType() == XFA_Element::Xfa)
pRefNode = pScriptContext->GetThisObject();
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(
ToNode(pRefNode), wsExpression.AsStringView(),
Mask<XFA_ResolveFlag>{
@@ -220,7 +220,7 @@
pDoc->GetNodeOwner()->PersistList(pNodeList);
CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
- Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+ absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(),
dwFlag);