本文整理汇总了C++中CFX_ByteStringC::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteStringC::c_str方法的具体用法?C++ CFX_ByteStringC::c_str怎么用?C++ CFX_ByteStringC::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ByteStringC
的用法示例。
在下文中一共展示了CFX_ByteStringC::c_str方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1,
const CFX_ByteStringC& str2) {
int nNewLen = str1.GetLength() + str2.GetLength();
if (nNewLen == 0)
return;
m_pData.Reset(StringData::Create(nNewLen));
m_pData->CopyContents(str1.c_str(), str1.GetLength());
m_pData->CopyContentsAt(str1.GetLength(), str2.c_str(), str2.GetLength());
}
示例2: GetValueByName
FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
CFXJSE_Value* pValue) {
const FX_CHAR* name = utf8Name.c_str();
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
v8::Local<v8::Context> old_context = GetIsolate()->GetCurrentContext();
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(GetIsolate(), m_context);
v8::Context::Scope context_scope(context);
// Caution: We're about to hand to XFA an object that in order to invoke
// methods will require that the current v8::Context always has a pointer
// to a CJS_Runtime in its embedder data slot. Unfortunately, XFA creates
// its own v8::Context which has not initialized the embedder data slot.
// Do so now.
// TODO(tsepez): redesign PDF-side objects to not rely on v8::Context's
// embedder data slots, and/or to always use the right context.
FXJS_SetRuntimeForV8Context(old_context, this);
v8::Local<v8::Value> propvalue =
context->Global()->Get(v8::String::NewFromUtf8(
GetIsolate(), name, v8::String::kNormalString, utf8Name.GetLength()));
if (propvalue.IsEmpty()) {
pValue->SetUndefined();
return FALSE;
}
pValue->ForceSetValue(propvalue);
return TRUE;
}
示例3: Open
FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
uint32_t dwMode) {
if (m_nFD > -1) {
return FALSE;
}
int32_t nFlags, nMasks;
FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks);
m_nFD = open(fileName.c_str(), nFlags, nMasks);
return m_nFD > -1;
}
示例4: FXJSE_ThrowMessage
void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message) {
v8::Isolate* pIsolate = v8::Isolate::GetCurrent();
ASSERT(pIsolate);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
v8::Local<v8::String> hMessage = v8::String::NewFromUtf8(
pIsolate, utf8Message.c_str(), v8::String::kNormalString,
utf8Message.GetLength());
v8::Local<v8::Value> hError = v8::Exception::Error(hMessage);
pIsolate->ThrowException(hError);
}
示例5: DeleteObjectProperty
FX_BOOL CFXJSE_Value::DeleteObjectProperty(const CFX_ByteStringC& szPropName) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
if (!hObject->IsObject())
return FALSE;
hObject.As<v8::Object>()->Delete(v8::String::NewFromUtf8(
m_pIsolate, szPropName.c_str(), v8::String::kNormalString,
szPropName.GetLength()));
return TRUE;
}
示例6:
static uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) {
uint32_t dwHash = 0;
int32_t iLength = bsfamily.GetLength();
const FX_CHAR* pBuffer = bsfamily.c_str();
for (int32_t i = 0; i < iLength; i++) {
FX_CHAR ch = pBuffer[i];
if (ch == ' ' || ch == '-' || ch == ',') {
continue;
}
dwHash = 31 * dwHash + FXSYS_tolower(ch);
}
return dwHash;
}
示例7:
FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
uint32_t dwMode) {
if (m_hFile) {
return FALSE;
}
uint32_t dwAccess, dwShare, dwCreation;
FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, nullptr,
dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr);
if (m_hFile == INVALID_HANDLE_VALUE)
m_hFile = nullptr;
return !!m_hFile;
}
示例8: GetObjectProperty
FX_BOOL CFXJSE_Value::GetObjectProperty(const CFX_ByteStringC& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
if (!hObject->IsObject())
return FALSE;
v8::Local<v8::Value> hPropValue =
hObject.As<v8::Object>()->Get(v8::String::NewFromUtf8(
m_pIsolate, szPropName.c_str(), v8::String::kNormalString,
szPropName.GetLength()));
lpPropValue->ForceSetValue(hPropValue);
return TRUE;
}
示例9: parser
TEST(SimpleParserTest, GetWord) {
pdfium::StrFuncTestData test_data[] = {
// Empty src string.
STR_IN_OUT_CASE("", ""),
// Content with whitespaces only.
STR_IN_OUT_CASE(" \t \0 \n", ""),
// Content with comments only.
STR_IN_OUT_CASE("%this is a test case\r\n%2nd line", ""),
// Mixed whitespaces and comments.
STR_IN_OUT_CASE(" \t \0%try()%haha\n %another line \aa", ""),
// Name.
STR_IN_OUT_CASE(" /Tester ", "/Tester"),
// String.
STR_IN_OUT_CASE("\t(nice day)!\n ", "(nice day)"),
// String with nested braces.
STR_IN_OUT_CASE("\t(It is a (long) day)!\n ", "(It is a (long) day)"),
// String with escaped chars.
STR_IN_OUT_CASE("\t(It is a \\(long\\) day!)hi\n ",
"(It is a \\(long\\) day!)"),
// Hex string.
STR_IN_OUT_CASE(" \n<4545acdfedertt>abc ", "<4545acdfedertt>"),
STR_IN_OUT_CASE(" \n<4545a<ed>ertt>abc ", "<4545a<ed>"),
// Dictionary.
STR_IN_OUT_CASE("<</oc 234 /color 2 3 R>>", "<<"),
STR_IN_OUT_CASE("\t\t<< /abc>>", "<<"),
// Handling ending delimiters.
STR_IN_OUT_CASE("> little bear", ">"),
STR_IN_OUT_CASE(") another bear", ")"), STR_IN_OUT_CASE(">> end ", ">>"),
// No ending delimiters.
STR_IN_OUT_CASE("(sdfgfgbcv", "(sdfgfgbcv"),
// Regular cases.
STR_IN_OUT_CASE("apple pear", "apple"),
STR_IN_OUT_CASE(" pi=3.1415 ", "pi=3.1415"),
STR_IN_OUT_CASE(" p t x c ", "p"), STR_IN_OUT_CASE(" pt\0xc ", "pt"),
STR_IN_OUT_CASE(" $^&&*\t\0sdff ", "$^&&*"),
STR_IN_OUT_CASE("\n\r+3.5656 -11.0", "+3.5656"),
};
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
const pdfium::StrFuncTestData& data = test_data[i];
CPDF_SimpleParser parser(data.input, data.input_size);
CFX_ByteStringC word = parser.GetWord();
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data.expected),
data.expected_size),
std::string(word.c_str(), word.GetLength()))
<< " for case " << i;
}
}
示例10: HasObjectOwnProperty
FX_BOOL CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
FX_BOOL bUseTypeGetter) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
if (!hObject->IsObject())
return FALSE;
v8::Local<v8::String> hKey = v8::String::NewFromUtf8(
m_pIsolate, szPropName.c_str(), v8::String::kNormalString,
szPropName.GetLength());
return hObject.As<v8::Object>()->HasRealNamedProperty(hKey) ||
(bUseTypeGetter &&
hObject.As<v8::Object>()
->HasOwnProperty(m_pIsolate->GetCurrentContext(), hKey)
.FromMaybe(false));
}
示例11: GetFontFace
FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile,
int32_t iFaceIndex) {
if (bsFile.IsEmpty()) {
return nullptr;
}
if (iFaceIndex < 0) {
return nullptr;
}
FXFT_Open_Args args;
args.flags = FT_OPEN_PATHNAME;
args.pathname = const_cast<FT_String*>(bsFile.c_str());
FXFT_Face face;
if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) {
return FALSE;
}
FXFT_Set_Pixel_Sizes(face, 0, 64);
return face;
}
示例12: GetValueByName
bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
CFXJSE_Value* pValue) {
const FX_CHAR* name = utf8Name.c_str();
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
v8::Local<v8::Context> context = NewLocalContext();
v8::Context::Scope context_scope(context);
v8::Local<v8::Value> propvalue =
context->Global()->Get(v8::String::NewFromUtf8(
GetIsolate(), name, v8::String::kNormalString, utf8Name.GetLength()));
if (propvalue.IsEmpty()) {
pValue->SetUndefined();
return false;
}
pValue->ForceSetValue(propvalue);
return true;
}
示例13: SetObjectOwnProperty
FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
if (!hObject->IsObject())
return FALSE;
v8::Local<v8::Value> pValue =
v8::Local<v8::Value>::New(m_pIsolate, lpPropValue->m_hValue);
return hObject.As<v8::Object>()
->DefineOwnProperty(
m_pIsolate->GetCurrentContext(),
v8::String::NewFromUtf8(m_pIsolate, szPropName.c_str(),
v8::String::kNormalString,
szPropName.GetLength()),
pValue)
.FromMaybe(false);
}
示例14: SetValueByName
bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
CFXJSE_Value* pValue) {
if (utf8Name.IsEmpty() || !pValue)
return false;
const FX_CHAR* name = utf8Name.c_str();
v8::Isolate* pIsolate = GetIsolate();
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope handle_scope(pIsolate);
v8::Local<v8::Context> context = NewLocalContext();
v8::Context::Scope context_scope(context);
// v8::Local<v8::Context> tmpCotext =
// v8::Local<v8::Context>::New(GetIsolate(), m_context);
v8::Local<v8::Value> propvalue =
v8::Local<v8::Value>::New(GetIsolate(), pValue->DirectGetValue());
context->Global()->Set(
v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString,
utf8Name.GetLength()),
propvalue);
return true;
}