当前位置: 首页>>代码示例>>C++>>正文


C++ CFX_ByteStringC::GetLength方法代码示例

本文整理汇总了C++中CFX_ByteStringC::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteStringC::GetLength方法的具体用法?C++ CFX_ByteStringC::GetLength怎么用?C++ CFX_ByteStringC::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFX_ByteStringC的用法示例。


在下文中一共展示了CFX_ByteStringC::GetLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FXJSE_ThrowMessage

void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name,
                        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.GetCStr(), v8::String::kNormalString,
      utf8Message.GetLength());
  v8::Local<v8::Value> hError;
  if (utf8Name == "RangeError") {
    hError = v8::Exception::RangeError(hMessage);
  } else if (utf8Name == "ReferenceError") {
    hError = v8::Exception::ReferenceError(hMessage);
  } else if (utf8Name == "SyntaxError") {
    hError = v8::Exception::SyntaxError(hMessage);
  } else if (utf8Name == "TypeError") {
    hError = v8::Exception::TypeError(hMessage);
  } else {
    hError = v8::Exception::Error(hMessage);
    if (utf8Name != "Error" && !utf8Name.IsEmpty()) {
      hError.As<v8::Object>()->Set(
          v8::String::NewFromUtf8(pIsolate, "name"),
          v8::String::NewFromUtf8(pIsolate, utf8Name.GetCStr(),
                                  v8::String::kNormalString,
                                  utf8Name.GetLength()));
    }
  }
  pIsolate->ThrowException(hError);
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:29,代码来源:value.cpp

示例2:

bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
  if (!m_pData)
    return str.IsEmpty();

  return m_pData->m_nDataLength == str.GetLength() &&
         FXSYS_memcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0;
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:7,代码来源:fx_basic_bstring.cpp

示例3: SetBlendMode

void CPDF_GeneralStateData::SetBlendMode(const CFX_ByteStringC& blend_mode) {
  if (blend_mode.GetLength() > 15) {
    return;
  }
  FXSYS_memcpy(m_BlendMode, blend_mode.raw_str(), blend_mode.GetLength());
  m_BlendMode[blend_mode.GetLength()] = 0;
  m_BlendType = GetBlendTypeInternal(blend_mode);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:8,代码来源:cpdf_generalstatedata.cpp

示例4: SetAt

void CFX_CMapByteStringToPtr::SetAt(const CFX_ByteStringC& key, void* value) {
  ASSERT(value != NULL);
  int index, key_len = key.GetLength();
  int size = m_Buffer.GetSize();
  for (index = 0; index < size; index++) {
    _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index);
    if (!_CompactStringSame(pKey, key.GetPtr(), key_len)) {
      continue;
    }
    *(void**)(pKey + 1) = value;
    return;
  }
  for (index = 0; index < size; index++) {
    _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index);
    if (pKey->m_CompactLen) {
      continue;
    }
    _CompactStringStore(pKey, key.GetPtr(), key_len);
    *(void**)(pKey + 1) = value;
    return;
  }
  _CompactString* pKey = (_CompactString*)m_Buffer.Add();
  _CompactStringStore(pKey, key.GetPtr(), key_len);
  *(void**)(pKey + 1) = value;
}
开发者ID:azunite,项目名称:libpdfium,代码行数:25,代码来源:fx_basic_maps.cpp

示例5: AddValue

void CFX_CMapByteStringToPtr::AddValue(const CFX_ByteStringC& key,
                                       void* value) {
  ASSERT(value != NULL);
  _CompactString* pKey = (_CompactString*)m_Buffer.Add();
  _CompactStringStore(pKey, key.GetPtr(), key.GetLength());
  *(void**)(pKey + 1) = value;
}
开发者ID:azunite,项目名称:libpdfium,代码行数:7,代码来源:fx_basic_maps.cpp

示例6: SkipLiterals

void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) {
  m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
  if (IsEOF()) {
    return;
  }
  int32_t i = 0, iLen = str.GetLength();
  do {
    while (m_dwIndex < m_dwBufferSize) {
      if (str.GetAt(i) != m_pBuffer[m_dwIndex++]) {
        i = 0;
      } else {
        i++;
        if (i == iLen) {
          break;
        }
      }
    }
    m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
    if (i == iLen) {
      return;
    }
    if (m_dwIndex < m_dwBufferSize || IsEOF()) {
      break;
    }
  } while (ReadNextBlock());
  while (!m_pDataAcc->IsEOF()) {
    ReadNextBlock();
    m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwBufferSize;
  }
  m_dwIndex = m_dwBufferSize;
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:31,代码来源:fx_xml_parser.cpp

示例7: SetString

void CFXJSE_Value::SetString(const CFX_ByteStringC& szString) {
  CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate);
  v8::Local<v8::Value> hValue = v8::String::NewFromUtf8(
      m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()),
      v8::String::kNormalString, szString.GetLength());
  m_hValue.Reset(m_pIsolate, hValue);
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:7,代码来源:cfxjse_value.cpp

示例8: FXJSE_DynPropGetterAdapter

static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass,
                                       FXJSE_HOBJECT hObject,
                                       const CFX_ByteStringC& szPropName,
                                       FXJSE_HVALUE hValue) {
  ASSERT(lpClass);
  int32_t nPropType =
      lpClass->dynPropTypeGetter == nullptr
          ? FXJSE_ClassPropType_Property
          : lpClass->dynPropTypeGetter(hObject, szPropName, FALSE);
  if (nPropType == FXJSE_ClassPropType_Property) {
    if (lpClass->dynPropGetter) {
      lpClass->dynPropGetter(hObject, szPropName, hValue);
    }
  } else if (nPropType == FXJSE_ClassPropType_Method) {
    if (lpClass->dynMethodCall && hValue) {
      CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
      v8::Isolate* pIsolate = lpValue->GetIsolate();
      v8::HandleScope hscope(pIsolate);
      v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate =
          v8::ObjectTemplate::New();
      hCallBackInfoTemplate->SetInternalFieldCount(2);
      v8::Local<v8::Object> hCallBackInfo =
          hCallBackInfoTemplate->NewInstance();
      hCallBackInfo->SetAlignedPointerInInternalField(
          0, const_cast<FXJSE_CLASS*>(lpClass));
      hCallBackInfo->SetInternalField(
          1, v8::String::NewFromUtf8(
                 pIsolate, reinterpret_cast<const char*>(szPropName.GetPtr()),
                 v8::String::kNormalString, szPropName.GetLength()));
      lpValue->ForceSetValue(v8::Function::New(
          lpValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback,
          hCallBackInfo));
    }
  }
}
开发者ID:andoma,项目名称:pdfium,代码行数:35,代码来源:dynprop.cpp

示例9: EqualNoCase

bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const {
  if (!m_pData)
    return str.IsEmpty();

  FX_STRSIZE len = str.GetLength();
  if (m_pData->m_nDataLength != len)
    return false;

  const uint8_t* pThis = (const uint8_t*)m_pData->m_String;
  const uint8_t* pThat = str.raw_str();
  for (FX_STRSIZE i = 0; i < len; i++) {
    if ((*pThis) != (*pThat)) {
      uint8_t bThis = *pThis;
      if (bThis >= 'A' && bThis <= 'Z')
        bThis += 'a' - 'A';

      uint8_t bThat = *pThat;
      if (bThat >= 'A' && bThat <= 'Z')
        bThat += 'a' - 'A';

      if (bThis != bThat)
        return false;
    }
    pThis++;
    pThat++;
  }
  return true;
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:28,代码来源:fx_basic_bstring.cpp

示例10: 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;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:31,代码来源:cjs_runtime.cpp

示例11: FX_atonum

bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
  if (strc.Find('.') != -1) {
    FX_FLOAT* pFloat = static_cast<FX_FLOAT*>(pData);
    *pFloat = FX_atof(strc);
    return false;
  }

  // Note, numbers in PDF are typically of the form 123, -123, etc. But,
  // for things like the Permissions on the encryption hash the number is
  // actually an unsigned value. We use a uint32_t so we can deal with the
  // unsigned and then check for overflow if the user actually signed the value.
  // The Permissions flag is listed in Table 3.20 PDF 1.7 spec.
  pdfium::base::CheckedNumeric<uint32_t> integer = 0;
  bool bNegative = false;
  bool bSigned = false;
  int cc = 0;
  if (strc[0] == '+') {
    cc++;
    bSigned = true;
  } else if (strc[0] == '-') {
    bNegative = true;
    bSigned = true;
    cc++;
  }

  while (cc < strc.GetLength() && std::isdigit(strc[cc])) {
    integer = integer * 10 + FXSYS_toDecimalDigit(strc.CharAt(cc));
    if (!integer.IsValid())
      break;
    cc++;
  }

  // We have a sign, and the value was greater then a regular integer
  // we've overflowed, reset to the default value.
  if (bSigned) {
    if (bNegative) {
      if (integer.ValueOrDefault(kDefaultIntValue) >
          static_cast<uint32_t>(std::numeric_limits<int>::max()) + 1) {
        integer = kDefaultIntValue;
      }
    } else if (integer.ValueOrDefault(kDefaultIntValue) >
               static_cast<uint32_t>(std::numeric_limits<int>::max())) {
      integer = kDefaultIntValue;
    }
  }

  // Switch back to the int space so we can flip to a negative if we need.
  int value = static_cast<int>(integer.ValueOrDefault(kDefaultIntValue));
  if (bNegative)
    value = -value;

  int* pInt = static_cast<int*>(pData);
  *pInt = value;
  return true;
}
开发者ID:gradescope,项目名称:pdfium,代码行数:55,代码来源:fx_basic_util.cpp

示例12: 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);
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:11,代码来源:cfxjse_value.cpp

示例13: FX_XML_SplitQualifiedName

void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
                               CFX_ByteStringC& bsSpace,
                               CFX_ByteStringC& bsName) {
  if (bsFullName.IsEmpty()) {
    return;
  }
  int32_t iStart = 0;
  for (; iStart < bsFullName.GetLength(); iStart++) {
    if (bsFullName.GetAt(iStart) == ':') {
      break;
    }
  }
  if (iStart >= bsFullName.GetLength()) {
    bsName = bsFullName;
  } else {
    bsSpace = CFX_ByteStringC(bsFullName.GetCStr(), iStart);
    iStart++;
    bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart,
                             bsFullName.GetLength() - iStart);
  }
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:21,代码来源:fx_xml_composer.cpp

示例14: 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.GetCStr(), v8::String::kNormalString,
      szPropName.GetLength()));
  return TRUE;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:12,代码来源:value.cpp

示例15:

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;
}
开发者ID:gradescope,项目名称:pdfium,代码行数:13,代码来源:fpf_skiafontmgr.cpp


注:本文中的CFX_ByteStringC::GetLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。