Convert string class names
Automated using git grep & sed.
Replace StringC classes with StringView classes.
Remove the CFX_ prefix and put string classes in fxcrt namespace.
Change AsStringC() to AsStringView().
Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*,
Foo).
Couple of tests needed to have their names regularlized.
BUG=pdfium:894
Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d
Reviewed-on: https://pdfium-review.googlesource.com/14151
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/fxjs/cfxjse_arguments.cpp b/fxjs/cfxjse_arguments.cpp
index 363f39c..f390cef 100644
--- a/fxjs/cfxjse_arguments.cpp
+++ b/fxjs/cfxjse_arguments.cpp
@@ -39,10 +39,10 @@
return static_cast<float>((*m_pInfo)[index]->NumberValue());
}
-CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
+ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString();
v8::String::Utf8Value szStringVal(hString);
- return CFX_ByteString(*szStringVal);
+ return ByteString(*szStringVal);
}
CFXJSE_HostObject* CFXJSE_Arguments::GetObject(int32_t index,
diff --git a/fxjs/cfxjse_arguments.h b/fxjs/cfxjse_arguments.h
index 9317d70..0553335 100644
--- a/fxjs/cfxjse_arguments.h
+++ b/fxjs/cfxjse_arguments.h
@@ -24,7 +24,7 @@
bool GetBoolean(int32_t index) const;
int32_t GetInt32(int32_t index) const;
float GetFloat(int32_t index) const;
- CFX_ByteString GetUTF8String(int32_t index) const;
+ ByteString GetUTF8String(int32_t index) const;
CFXJSE_HostObject* GetObject(int32_t index,
CFXJSE_Class* pClass = nullptr) const;
CFXJSE_Value* GetReturnValue() const;
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp
index 3dba0ab..8f4334f 100644
--- a/fxjs/cfxjse_class.cpp
+++ b/fxjs/cfxjse_class.cpp
@@ -24,7 +24,7 @@
if (!lpFunctionInfo)
return;
- CFX_ByteStringC szFunctionName(lpFunctionInfo->name);
+ ByteStringView szFunctionName(lpFunctionInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -42,7 +42,7 @@
if (!lpClassDefinition)
return;
- CFX_ByteStringC szFunctionName(lpClassDefinition->name);
+ ByteStringView szFunctionName(lpClassDefinition->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -60,7 +60,7 @@
if (!lpPropertyInfo)
return;
- CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
+ ByteStringView szPropertyName(lpPropertyInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
@@ -77,7 +77,7 @@
if (!lpPropertyInfo)
return;
- CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
+ ByteStringView szPropertyName(lpPropertyInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
@@ -108,7 +108,7 @@
return;
if (info.This() == info.Holder() && lpClass->name) {
- CFX_ByteString szStringVal;
+ ByteString szStringVal;
szStringVal.Format("[object %s]", lpClass->name);
info.GetReturnValue().Set(v8::String::NewFromUtf8(
info.GetIsolate(), szStringVal.c_str(), v8::String::kNormalString,
@@ -131,7 +131,7 @@
hCallBackInfo->GetInternalField(1).As<v8::String>();
ASSERT(lpClass && !hPropName.IsEmpty());
v8::String::Utf8Value szPropName(hPropName);
- CFX_ByteStringC szFxPropName = *szPropName;
+ ByteStringView szFxPropName = *szPropName;
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -143,7 +143,7 @@
void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
@@ -179,7 +179,7 @@
void DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
@@ -194,7 +194,7 @@
bool DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName) {
+ const ByteStringView& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
@@ -205,7 +205,7 @@
bool DynPropDeleterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName) {
+ const ByteStringView& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
@@ -228,7 +228,7 @@
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
if (DynPropQueryAdapter(lpClass, lpThisValue.get(), szFxPropName)) {
@@ -248,7 +248,7 @@
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
info.GetReturnValue().Set(
@@ -262,7 +262,7 @@
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
auto lpNewValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -279,7 +279,7 @@
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
diff --git a/fxjs/cfxjse_class.h b/fxjs/cfxjse_class.h
index c3a5c84..01becfc 100644
--- a/fxjs/cfxjse_class.h
+++ b/fxjs/cfxjse_class.h
@@ -32,7 +32,7 @@
v8::Global<v8::FunctionTemplate>& GetTemplate() { return m_hTemplate; }
protected:
- CFX_ByteString m_szClassName;
+ ByteString m_szClassName;
CFX_UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> m_lpClassDefinition;
CFX_UnownedPtr<CFXJSE_Context> m_pContext;
v8::Global<v8::FunctionTemplate> m_hTemplate;
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 87ec30f..bef7597 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -213,7 +213,7 @@
}
CFXJSE_Class* CFXJSE_Context::GetClassByName(
- const CFX_ByteStringC& szName) const {
+ const ByteStringView& szName) const {
auto pClass =
std::find_if(m_rgClasses.begin(), m_rgClasses.end(),
[szName](const std::unique_ptr<CFXJSE_Class>& item) {
diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h
index c00b76b..8ed8760 100644
--- a/fxjs/cfxjse_context.h
+++ b/fxjs/cfxjse_context.h
@@ -31,7 +31,7 @@
v8::Local<v8::Context> GetContext();
std::unique_ptr<CFXJSE_Value> GetGlobalObject();
void AddClass(std::unique_ptr<CFXJSE_Class> pClass);
- CFXJSE_Class* GetClassByName(const CFX_ByteStringC& szName) const;
+ CFXJSE_Class* GetClassByName(const ByteStringView& szName) const;
void EnableCompatibleMode();
bool ExecuteScript(const char* szScript,
CFXJSE_Value* lpRetValue,
diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp
index c2eaa40..93e568c 100644
--- a/fxjs/cfxjse_value.cpp
+++ b/fxjs/cfxjse_value.cpp
@@ -52,7 +52,7 @@
} // namespace
-void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message) {
+void FXJSE_ThrowMessage(const ByteStringView& utf8Message) {
v8::Isolate* pIsolate = v8::Isolate::GetCurrent();
ASSERT(pIsolate);
@@ -126,7 +126,7 @@
m_hValue.Reset(m_pIsolate, pValue);
}
-bool CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::SetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -144,7 +144,7 @@
hPropValue);
}
-bool CFXJSE_Value::GetObjectProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::GetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -187,7 +187,7 @@
return true;
}
-bool CFXJSE_Value::DeleteObjectProperty(const CFX_ByteStringC& szPropName) {
+bool CFXJSE_Value::DeleteObjectProperty(const ByteStringView& szPropName) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
@@ -200,7 +200,7 @@
return true;
}
-bool CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::HasObjectOwnProperty(const ByteStringView& szPropName,
bool bUseTypeGetter) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
@@ -218,7 +218,7 @@
.FromMaybe(false));
}
-bool CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::SetObjectOwnProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -463,13 +463,13 @@
return static_cast<int32_t>(hValue->NumberValue());
}
-CFX_ByteString CFXJSE_Value::ToString() const {
+ByteString CFXJSE_Value::ToString() const {
ASSERT(!m_hValue.IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
v8::Local<v8::String> hString = hValue->ToString();
v8::String::Utf8Value hStringVal(hString);
- return CFX_ByteString(*hStringVal);
+ return ByteString(*hStringVal);
}
void CFXJSE_Value::SetUndefined() {
@@ -502,7 +502,7 @@
m_hValue.Reset(m_pIsolate, hValue);
}
-void CFXJSE_Value::SetString(const CFX_ByteStringC& szString) {
+void CFXJSE_Value::SetString(const ByteStringView& szString) {
CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate);
v8::Local<v8::Value> hValue = v8::String::NewFromUtf8(
m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()),
diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h
index 31b751d..f506857 100644
--- a/fxjs/cfxjse_value.h
+++ b/fxjs/cfxjse_value.h
@@ -38,9 +38,9 @@
float ToFloat() const;
double ToDouble() const;
int32_t ToInteger() const;
- CFX_ByteString ToString() const;
- CFX_WideString ToWideString() const {
- return CFX_WideString::FromUTF8(ToString().AsStringC());
+ ByteString ToString() const;
+ WideString ToWideString() const {
+ return WideString::FromUTF8(ToString().AsStringView());
}
CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const;
@@ -49,7 +49,7 @@
void SetBoolean(bool bBoolean);
void SetInteger(int32_t nInteger);
void SetDouble(double dDouble);
- void SetString(const CFX_ByteStringC& szString);
+ void SetString(const ByteStringView& szString);
void SetFloat(float fFloat);
void SetJSObject();
@@ -58,16 +58,16 @@
void SetArray(const std::vector<std::unique_ptr<CFXJSE_Value>>& values);
void SetDate(double dDouble);
- bool GetObjectProperty(const CFX_ByteStringC& szPropName,
+ bool GetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
- bool SetObjectProperty(const CFX_ByteStringC& szPropName,
+ bool SetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
bool GetObjectPropertyByIdx(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
bool SetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
- bool DeleteObjectProperty(const CFX_ByteStringC& szPropName);
- bool HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
+ bool DeleteObjectProperty(const ByteStringView& szPropName);
+ bool HasObjectOwnProperty(const ByteStringView& szPropName,
bool bUseTypeGetter);
- bool SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
+ bool SetObjectOwnProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
bool SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis);
bool Call(CFXJSE_Value* lpReceiver,
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index 219ad51..4c63988 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -460,12 +460,12 @@
m_isolate->SetData(g_embedderDataSlot, nullptr);
}
-int CFXJS_Engine::Execute(const CFX_WideString& script, FXJSErr* pError) {
+int CFXJS_Engine::Execute(const WideString& script, FXJSErr* pError) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::TryCatch try_catch(m_isolate);
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
v8::Local<v8::Script> compiled_script;
- if (!v8::Script::Compile(context, NewString(script.AsStringC()))
+ if (!v8::Script::Compile(context, NewString(script.AsStringView()))
.ToLocal(&compiled_script)) {
v8::String::Utf8Value error(try_catch.Exception());
// TODO(tsepez): return error via pError->message.
@@ -527,8 +527,8 @@
return context->Global()->GetPrototype()->ToObject(context).ToLocalChecked();
}
-void CFXJS_Engine::Error(const CFX_WideString& message) {
- m_isolate->ThrowException(NewString(message.AsStringC()));
+void CFXJS_Engine::Error(const WideString& message) {
+ m_isolate->ThrowException(NewString(message.AsStringView()));
}
void CFXJS_Engine::SetObjectPrivate(v8::Local<v8::Object> pObj, void* p) {
@@ -555,28 +555,28 @@
v8::Local<v8::Value> CFXJS_Engine::GetObjectProperty(
v8::Local<v8::Object> pObj,
- const CFX_WideString& wsPropertyName) {
+ const WideString& wsPropertyName) {
if (pObj.IsEmpty())
return v8::Local<v8::Value>();
v8::Local<v8::Value> val;
if (!pObj->Get(m_isolate->GetCurrentContext(),
- NewString(wsPropertyName.AsStringC()))
+ NewString(wsPropertyName.AsStringView()))
.ToLocal(&val))
return v8::Local<v8::Value>();
return val;
}
-std::vector<CFX_WideString> CFXJS_Engine::GetObjectPropertyNames(
+std::vector<WideString> CFXJS_Engine::GetObjectPropertyNames(
v8::Local<v8::Object> pObj) {
if (pObj.IsEmpty())
- return std::vector<CFX_WideString>();
+ return std::vector<WideString>();
v8::Local<v8::Array> val;
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
if (!pObj->GetPropertyNames(context).ToLocal(&val))
- return std::vector<CFX_WideString>();
+ return std::vector<WideString>();
- std::vector<CFX_WideString> result;
+ std::vector<WideString> result;
for (uint32_t i = 0; i < val->Length(); ++i) {
result.push_back(ToWideString(val->Get(context, i).ToLocalChecked()));
}
@@ -585,12 +585,12 @@
}
void CFXJS_Engine::PutObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& wsPropertyName,
+ const WideString& wsPropertyName,
v8::Local<v8::Value> pPut) {
if (pObj.IsEmpty())
return;
pObj->Set(m_isolate->GetCurrentContext(),
- NewString(wsPropertyName.AsStringC()), pPut)
+ NewString(wsPropertyName.AsStringView()), pPut)
.FromJust();
}
@@ -649,18 +649,18 @@
return v8::Boolean::New(m_isolate, b);
}
-v8::Local<v8::String> CFXJS_Engine::NewString(const CFX_ByteStringC& str) {
+v8::Local<v8::String> CFXJS_Engine::NewString(const ByteStringView& str) {
v8::Isolate* pIsolate = m_isolate ? m_isolate : v8::Isolate::GetCurrent();
return v8::String::NewFromUtf8(pIsolate, str.unterminated_c_str(),
v8::NewStringType::kNormal, str.GetLength())
.ToLocalChecked();
}
-v8::Local<v8::String> CFXJS_Engine::NewString(const CFX_WideStringC& str) {
+v8::Local<v8::String> CFXJS_Engine::NewString(const WideStringView& str) {
// Conversion from pdfium's wchar_t wide-strings to v8's uint16_t
// wide-strings isn't handled by v8, so use UTF8 as a common
// intermediate format.
- return NewString(FX_UTF8Encode(str).AsStringC());
+ return NewString(FX_UTF8Encode(str).AsStringView());
}
v8::Local<v8::Value> CFXJS_Engine::NewNull() {
@@ -703,15 +703,15 @@
return maybe_number.ToLocalChecked()->Value();
}
-CFX_WideString CFXJS_Engine::ToWideString(v8::Local<v8::Value> pValue) {
+WideString CFXJS_Engine::ToWideString(v8::Local<v8::Value> pValue) {
if (pValue.IsEmpty())
- return CFX_WideString();
+ return WideString();
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
v8::MaybeLocal<v8::String> maybe_string = pValue->ToString(context);
if (maybe_string.IsEmpty())
- return CFX_WideString();
+ return WideString();
v8::String::Utf8Value s(maybe_string.ToLocalChecked());
- return CFX_WideString::FromUTF8(CFX_ByteStringC(*s, s.length()));
+ return WideString::FromUTF8(ByteStringView(*s, s.length()));
}
v8::Local<v8::Object> CFXJS_Engine::ToObject(v8::Local<v8::Value> pValue) {
@@ -728,11 +728,11 @@
return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
}
-void CFXJS_Engine::SetConstArray(const CFX_WideString& name,
+void CFXJS_Engine::SetConstArray(const WideString& name,
v8::Local<v8::Array> array) {
m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array);
}
-v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) {
+v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const WideString& name) {
return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]);
}
diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h
index cdec942..457843f 100644
--- a/fxjs/fxjs_v8.h
+++ b/fxjs/fxjs_v8.h
@@ -174,7 +174,7 @@
void ReleaseEngine();
// Called after FXJS_InitializeEngine call made.
- int Execute(const CFX_WideString& script, FXJSErr* perror);
+ int Execute(const WideString& script, FXJSErr* perror);
v8::Local<v8::Context> NewLocalContext();
v8::Local<v8::Context> GetPersistentContext();
@@ -186,15 +186,15 @@
v8::Local<v8::Number> NewNumber(double number);
v8::Local<v8::Number> NewNumber(float number);
v8::Local<v8::Boolean> NewBoolean(bool b);
- v8::Local<v8::String> NewString(const CFX_ByteStringC& str);
- v8::Local<v8::String> NewString(const CFX_WideStringC& str);
+ v8::Local<v8::String> NewString(const ByteStringView& str);
+ v8::Local<v8::String> NewString(const WideStringView& str);
v8::Local<v8::Date> NewDate(double d);
v8::Local<v8::Object> NewFxDynamicObj(int nObjDefnID, bool bStatic = false);
int ToInt32(v8::Local<v8::Value> pValue);
bool ToBoolean(v8::Local<v8::Value> pValue);
double ToDouble(v8::Local<v8::Value> pValue);
- CFX_WideString ToWideString(v8::Local<v8::Value> pValue);
+ WideString ToWideString(v8::Local<v8::Value> pValue);
v8::Local<v8::Object> ToObject(v8::Local<v8::Value> pValue);
v8::Local<v8::Array> ToArray(v8::Local<v8::Value> pValue);
@@ -207,12 +207,11 @@
v8::Local<v8::Value> pValue);
// Objects.
- std::vector<CFX_WideString> GetObjectPropertyNames(
- v8::Local<v8::Object> pObj);
+ std::vector<WideString> GetObjectPropertyNames(v8::Local<v8::Object> pObj);
v8::Local<v8::Value> GetObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& PropertyName);
+ const WideString& PropertyName);
void PutObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& PropertyName,
+ const WideString& PropertyName,
v8::Local<v8::Value> pValue);
// Native object binding.
@@ -221,10 +220,10 @@
static void FreeObjectPrivate(void* p);
static void FreeObjectPrivate(v8::Local<v8::Object> pObj);
- void SetConstArray(const CFX_WideString& name, v8::Local<v8::Array> array);
- v8::Local<v8::Array> GetConstArray(const CFX_WideString& name);
+ void SetConstArray(const WideString& name, v8::Local<v8::Array> array);
+ v8::Local<v8::Array> GetConstArray(const WideString& name);
- void Error(const CFX_WideString& message);
+ void Error(const WideString& message);
protected:
CFXJS_Engine();
@@ -235,7 +234,7 @@
v8::Isolate* m_isolate;
v8::Global<v8::Context> m_V8PersistentContext;
std::vector<v8::Global<v8::Object>*> m_StaticObjects;
- std::map<CFX_WideString, v8::Global<v8::Array>> m_ConstArrays;
+ std::map<WideString, v8::Global<v8::Array>> m_ConstArrays;
};
#endif // FXJS_FXJS_V8_H_
diff --git a/fxjs/fxjs_v8_embeddertest.cpp b/fxjs/fxjs_v8_embeddertest.cpp
index 5a8ee63..53fe8f2 100644
--- a/fxjs/fxjs_v8_embeddertest.cpp
+++ b/fxjs/fxjs_v8_embeddertest.cpp
@@ -19,7 +19,7 @@
class FXJSV8EmbedderTest : public JSEmbedderTest {
public:
- void ExecuteInCurrentContext(const CFX_WideString& script) {
+ void ExecuteInCurrentContext(const WideString& script) {
FXJSErr error;
int sts = engine()->Execute(script, &error);
EXPECT_EQ(0, sts);
@@ -37,7 +37,7 @@
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- ExecuteInCurrentContext(CFX_WideString(kScript1));
+ ExecuteInCurrentContext(WideString(kScript1));
CheckAssignmentInCurrentContext(kExpected1);
}
@@ -52,13 +52,13 @@
engine2.InitializeEngine();
v8::Context::Scope context_scope(GetV8Context());
- ExecuteInCurrentContext(CFX_WideString(kScript0));
+ ExecuteInCurrentContext(WideString(kScript0));
CheckAssignmentInCurrentContext(kExpected0);
{
v8::Local<v8::Context> context1 = engine1.NewLocalContext();
v8::Context::Scope context_scope1(context1);
- ExecuteInCurrentContext(CFX_WideString(kScript1));
+ ExecuteInCurrentContext(WideString(kScript1));
CheckAssignmentInCurrentContext(kExpected1);
}
@@ -67,7 +67,7 @@
{
v8::Local<v8::Context> context2 = engine2.NewLocalContext();
v8::Context::Scope context_scope2(context2);
- ExecuteInCurrentContext(CFX_WideString(kScript2));
+ ExecuteInCurrentContext(WideString(kScript2));
CheckAssignmentInCurrentContext(kExpected2);
}
diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h
index 8fc514b..4864813 100644
--- a/fxjs/fxjse.h
+++ b/fxjs/fxjse.h
@@ -31,16 +31,16 @@
};
typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue);
typedef int32_t (*FXJSE_PropTypeGetter)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
bool bQueryIn);
typedef bool (*FXJSE_PropDeleter)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName);
+ const ByteStringView& szPropName);
enum FXJSE_ClassPropTypes {
FXJSE_ClassPropType_None,
@@ -79,6 +79,6 @@
v8::Isolate* FXJSE_Runtime_Create_Own();
void FXJSE_Runtime_Release(v8::Isolate* pIsolate);
-void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message);
+void FXJSE_ThrowMessage(const ByteStringView& utf8Message);
#endif // FXJS_FXJSE_H_