本文整理汇总了C++中wtf::String::characters方法的典型用法代码示例。如果您正苦于以下问题:C++ String::characters方法的具体用法?C++ String::characters怎么用?C++ String::characters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtf::String
的用法示例。
在下文中一共展示了String::characters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDataToClipBoard
void setDataToClipBoard(WTF::String& format , WTF::String& data){
LOGD(" setDataToClipBoard : Enter");
JNIEnv* env = JSC::Bindings::getJNIEnv();
if(env == NULL || format.isEmpty() || data.isEmpty())
return;
jstring jFormat = env->NewString((jchar*) format.characters(), format.length());
jstring jData = env->NewString((jchar*) data.characters(), data.length());
if((m_javaGlueForPasteBoard.object(env).get() == NULL )||(m_javaGlueForPasteBoard.m_setDataToClipBoard == 0 ))
{
LOGD(" setDataToClipBoard : return with out copy");
return;
}
env->CallVoidMethod(m_javaGlueForPasteBoard.object(env).get(),
m_javaGlueForPasteBoard.m_setDataToClipBoard , jFormat , jData);
env->DeleteLocalRef(jFormat);
env->DeleteLocalRef(jData);
checkException(env);
}
开发者ID:johnwpoliver,项目名称:Samsung-GT-P3113-AOSP-CM-Kernel-and-Ramdisk,代码行数:25,代码来源:PasteBoardAndroid.cpp
示例2: writeString
static void writeString(WTF::Vector<char>& vector, const WTF::String& str)
{
unsigned strLen = str.length();
// Only do work if the string has data.
if (strLen) {
// Determine how much to grow the vector. Use the worst case for utf8 to
// avoid reading the string twice. Add sizeof(unsigned) to hold the
// string length in utf8.
unsigned vectorLen = vector.size() + sizeof(unsigned);
unsigned length = (strLen << 2) + vectorLen;
// Grow the vector. This will change the value of v.size() but we
// remember the original size above.
vector.grow(length);
// Grab the position to write to.
char* data = vector.begin() + vectorLen;
// Write the actual string
int l = SkUTF16_ToUTF8(str.characters(), strLen, data);
ALOGV("Writing string %d %.*s", l, l, data);
// Go back and write the utf8 length. Subtract sizeof(unsigned) from
// data to get the position to write the length.
memcpy(data - sizeof(unsigned), (char*)&l, sizeof(unsigned));
// Shrink the internal state of the vector so we match what was
// actually written.
vector.shrink(vectorLen + l);
} else
vector.append((char*)&strLen, sizeof(unsigned));
}
示例3: exceededDatabaseQuota
void ChromeClientBlackBerry::exceededDatabaseQuota(Frame* frame, const WTF::String& name)
{
#if ENABLE(DATABASE)
Document* document = frame->document();
if (!document)
return;
SecurityOrigin* origin = document->securityOrigin();
if (m_webPage->d->m_dumpRenderTree) {
m_webPage->d->m_dumpRenderTree->exceededDatabaseQuota(origin, name);
return;
}
DatabaseTracker& tracker = DatabaseTracker::tracker(document->groupName());
unsigned long long totalUsage = tracker.totalDatabaseUsage();
unsigned long long originUsage = tracker.usageForOrigin(origin);
DatabaseDetails details = tracker.detailsForNameAndOrigin(name, origin);
unsigned long long estimatedSize = details.expectedUsage();
const WTF::String& nameStr = details.displayName();
WTF::String originStr = origin->databaseIdentifier();
unsigned long long quota = m_webPage->client()->databaseQuota(originStr.characters(), originStr.length(),
nameStr.characters(), nameStr.length(), totalUsage, originUsage, estimatedSize);
tracker.setQuota(origin, quota);
#endif
}
示例4: method
HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method(
/* [retval][out] */ BSTR* result)
{
ASSERT(m_element && m_element->hasTagName(formTag));
WTF::String methodString = static_cast<HTMLFormElement*>(m_element)->method();
*result = BString(methodString.characters(), methodString.length()).release();
return S_OK;
}
示例5: innerText
HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerText(
/* [retval][out] */ BSTR* result)
{
ASSERT(m_element && m_element->isHTMLElement());
WTF::String innerTextString = static_cast<HTMLElement*>(m_element)->innerText();
*result = BString(innerTextString.characters(), innerTextString.length()).release();
return S_OK;
}
示例6: method
HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method(
/* [retval][out] */ BSTR* result)
{
ASSERT(m_element && isHTMLFormElement(m_element));
WTF::String methodString = toHTMLFormElement(m_element)->method();
*result = BString(methodString.characters(), methodString.length()).release();
return S_OK;
}
示例7: runJavaScriptConfirm
bool ChromeClientBlackBerry::runJavaScriptConfirm(Frame* frame, const WTF::String& message)
{
if (m_webPage->d->m_dumpRenderTree)
return m_webPage->d->m_dumpRenderTree->runJavaScriptConfirm(message);
TimerBase::fireTimersInNestedEventLoop();
CString latinOrigin = frameOrigin(frame);
return m_webPage->client()->runJavaScriptConfirm(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length());
}
示例8: nodeValue
HRESULT STDMETHODCALLTYPE DOMNode::nodeValue(
/* [retval][out] */ BSTR* result)
{
if (!m_node)
return E_FAIL;
WTF::String nodeValueStr = m_node->nodeValue();
*result = SysAllocStringLen(nodeValueStr.characters(), nodeValueStr.length());
if (nodeValueStr.length() && !*result)
return E_OUTOFMEMORY;
return S_OK;
}
示例9: value
HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value(
/* [retval][out] */ BSTR* result)
{
ASSERT(m_element && m_element->hasTagName(textareaTag));
HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
WTF::String valueString = textareaElement->value();
*result = BString(valueString.characters(), valueString.length()).release();
if (valueString.length() && !*result)
return E_OUTOFMEMORY;
return S_OK;
}
示例10: getPropertyValue
HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::getPropertyValue(
/* [in] */ BSTR propertyName,
/* [retval][out] */ BSTR* result)
{
WTF::String propertyNameString(propertyName);
WTF::String value = m_style->getPropertyValue(propertyNameString);
*result = SysAllocStringLen(value.characters(), value.length());
if (value.length() && !*result)
return E_OUTOFMEMORY;
return S_OK;
}
示例11: value
HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::value(
/* [retval][out] */ BSTR* result)
{
ASSERT(m_element && isHTMLInputElement(m_element));
HTMLInputElement* inputElement = toHTMLInputElement(m_element);
WTF::String valueString = inputElement->value();
*result = BString(valueString.characters(), valueString.length()).release();
if (valueString.length() && !*result)
return E_OUTOFMEMORY;
return S_OK;
}
示例12: printWebCoreString
static void printWebCoreString(const char* label,
const WTF::String& string) {
char scratch[256];
size_t index = snprintf(scratch, sizeof(scratch), label);
const UChar* ch = string.characters();
while (ch && *ch && index < sizeof(scratch)) {
UChar c = *ch++;
if (c < ' ' || c >= 0x7f) c = ' ';
scratch[index++] = c;
}
DUMP_NAV_LOGD("%.*s\"\n", index, scratch);
}
示例13: runJavaScriptPrompt
bool ChromeClientBlackBerry::runJavaScriptPrompt(Frame* frame, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result)
{
WebString clientResult;
if (m_webPage->d->m_dumpRenderTree) {
result = m_webPage->d->m_dumpRenderTree->runJavaScriptPrompt(message, defaultValue);
return true;
}
TimerBase::fireTimersInNestedEventLoop();
CString latinOrigin = frameOrigin(frame);
if (m_webPage->client()->runJavaScriptPrompt(message.characters(), message.length(), defaultValue.characters(), defaultValue.length(), latinOrigin.data(), latinOrigin.length(), clientResult)) {
result = clientResult;
return true;
}
return false;
}
示例14: SquirrelPrecompil
static PBEcode SquirrelPrecompil(WTF::String& code, Vector<UChar>& codeCache) {
PBEcode rt = EnumPBSuccess;
Vector<UChar> codeFake;
wcsncpy((wchar_t *)&codeCache[0], (const wchar_t *)code.characters(), code.length());
int x1 = wcslen((const wchar_t *)&codeCache[0]);
rt = StrReplaceCase_0((wchar_t *)&codeCache[0], code.length()); // 去掉注释
if ( rt != EnumPBSuccess )
goto Exit0;
codeFake = codeCache;
OutputDebugStringW((wchar_t *)&codeCache[0]);
int xx = wcslen((const wchar_t *)&codeFake[0]);
rt = StrReplaceCase_1((const wchar_t *)codeFake.data(), code.length(), (wchar_t *)codeCache.data(), codeCache.size()); // 识别class
if ( rt != EnumPBSuccess )
goto Exit0;
OutputDebugStringW((wchar_t *)&codeCache[0]);
rt = StrReplaceCase_2((wchar_t *)&codeCache[0], codeCache.size()); // 识别.prototype.
if ( rt != EnumPBSuccess )
goto Exit0;
OutputDebugStringW((wchar_t *)&codeCache[0]);
rt = StrReplaceCase_3((wchar_t *)&codeCache[0], codeCache.size()); // 去掉new
if ( rt != EnumPBSuccess )
goto Exit0;
rt = StrReplaceCase_4((wchar_t *)&codeCache[0], codeCache.size()); // for in
if ( rt != EnumPBSuccess )
goto Exit0;
OutputDebugStringW((wchar_t *)&codeCache[0]);
Exit0:
return rt;
}
示例15:
void DebuggerAgentManager::sendCommandToV8(const WTF::String& cmd, v8::Debug::ClientData* data)
{
v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), data);
}