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


C++ CFX_WideString::GetAt方法代码示例

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


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

示例1: InsertText

CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
                                             const FX_WCHAR* text) {
  CFX_WideString swText = text;
  CPVT_WordPlace wp = place;
  for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
    CPVT_WordPlace oldwp = wp;
    uint16_t word = swText.GetAt(i);
    switch (word) {
      case 0x0D:
        if (m_bMultiLine) {
          if (swText.GetAt(i + 1) == 0x0A)
            i += 1;

          wp = InsertSection(wp, nullptr, nullptr);
        }
        break;
      case 0x0A:
        if (m_bMultiLine) {
          if (swText.GetAt(i + 1) == 0x0D)
            i += 1;

          wp = InsertSection(wp, nullptr, nullptr);
        }
        break;
      case 0x09:
        word = 0x20;
      default:
        wp = InsertWord(wp, word, FXFONT_DEFAULT_CHARSET, nullptr);
        break;
    }
    if (wp == oldwp)
      break;
  }
  return wp;
}
开发者ID:gradescope,项目名称:pdfium,代码行数:35,代码来源:cpdf_variabletext.cpp

示例2: encodeToCodewords

CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb,
                                                     int32_t startPos,
                                                     int32_t& e) {
  int32_t len = sb.GetLength() - startPos;
  if (len == 0) {
    e = BCExceptionNoContents;
    return (FX_WCHAR*)"";
  }
  FX_WCHAR c1 = sb.GetAt(startPos);
  FX_WCHAR c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0;
  FX_WCHAR c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0;
  FX_WCHAR c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0;
  int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
  FX_WCHAR cw1 = (FX_WCHAR)((v >> 16) & 255);
  FX_WCHAR cw2 = (FX_WCHAR)((v >> 8) & 255);
  FX_WCHAR cw3 = (FX_WCHAR)(v & 255);
  CFX_WideString res;
  res += cw1;
  if (len >= 2) {
    res += cw2;
  }
  if (len >= 3) {
    res += cw3;
  }
  return res;
}
开发者ID:andoma,项目名称:pdfium,代码行数:26,代码来源:BC_EdifactEncoder.cpp

示例3: while

int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
    CFX_WideString msg,
    int32_t startpos) {
  int32_t len = msg.GetLength();
  int32_t idx = startpos;
  while (idx < len) {
    FX_WCHAR ch = msg.GetAt(idx);
    int32_t numericCount = 0;
    while (numericCount < 13 && isDigit(ch) && idx < len) {
      numericCount++;
      idx++;
      if (idx < len) {
        ch = msg.GetAt(idx);
      }
    }
    if (numericCount >= 13) {
      return idx - startpos - numericCount;
    }
    if (numericCount > 0) {
      continue;
    }
    ch = msg.GetAt(idx);
    if (!isText(ch)) {
      break;
    }
    idx++;
  }
  return idx - startpos;
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:29,代码来源:BC_PDF417HighLevelEncoder.cpp

示例4: ResolveNodes_CreateNode

FX_BOOL CXFA_NodeHelper::ResolveNodes_CreateNode(
    CFX_WideString wsName,
    CFX_WideString wsCondition,
    FX_BOOL bLastNode,
    CXFA_ScriptContext* pScriptContext) {
  if (!m_pCreateParent) {
    return FALSE;
  }
  FX_BOOL bIsClassName = FALSE;
  FX_BOOL bResult = FALSE;
  if (wsName.GetAt(0) == '!') {
    wsName = wsName.Right(wsName.GetLength() - 1);
    m_pCreateParent = ToNode(
        pScriptContext->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
  }
  if (wsName.GetAt(0) == '#') {
    bIsClassName = TRUE;
    wsName = wsName.Right(wsName.GetLength() - 1);
  }
  if (m_iCreateCount == 0) {
    CreateNode_ForCondition(wsCondition);
  }
  if (bIsClassName) {
    XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringC());
    if (eType == XFA_Element::Unknown)
      return FALSE;

    for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) {
      CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eType);
      if (pNewNode) {
        m_pCreateParent->InsertChild(pNewNode);
        if (iIndex == m_iCreateCount - 1) {
          m_pCreateParent = pNewNode;
        }
        bResult = TRUE;
      }
    }
  } else {
    XFA_Element eClassType = XFA_Element::DataGroup;
    if (bLastNode) {
      eClassType = m_eLastCreateType;
    }
    for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) {
      CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType);
      if (pNewNode) {
        pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsStringC());
        pNewNode->CreateXMLMappingNode();
        m_pCreateParent->InsertChild(pNewNode);
        if (iIndex == m_iCreateCount - 1) {
          m_pCreateParent = pNewNode;
        }
        bResult = TRUE;
      }
    }
  }
  if (!bResult) {
    m_pCreateParent = nullptr;
  }
  return bResult;
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:60,代码来源:cxfa_nodehelper.cpp

示例5: SetText

void CPDF_VariableText::SetText(const FX_WCHAR* text,
                                int32_t charset,
                                const CPVT_SecProps* pSecProps,
                                const CPVT_WordProps* pWordProps) {
  DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
  CFX_WideString swText = text;
  CPVT_WordPlace wp(0, 0, -1);
  CPVT_SectionInfo secinfo;
  if (m_bRichText) {
    if (pSecProps)
      secinfo.pSecProps = new CPVT_SecProps(*pSecProps);
    if (pWordProps)
      secinfo.pWordProps = new CPVT_WordProps(*pWordProps);
  }
  if (CSection* pSection = m_SectionArray.GetAt(0))
    pSection->m_SecInfo = secinfo;

  int32_t nCharCount = 0;
  for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
    if (m_nLimitChar > 0 && nCharCount >= m_nLimitChar)
      break;
    if (m_nCharArray > 0 && nCharCount >= m_nCharArray)
      break;

    uint16_t word = swText.GetAt(i);
    switch (word) {
      case 0x0D:
        if (m_bMultiLine) {
          if (swText.GetAt(i + 1) == 0x0A)
            i += 1;

          wp.nSecIndex++;
          wp.nLineIndex = 0;
          wp.nWordIndex = -1;
          AddSection(wp, secinfo);
        }
        break;
      case 0x0A:
        if (m_bMultiLine) {
          if (swText.GetAt(i + 1) == 0x0D)
            i += 1;

          wp.nSecIndex++;
          wp.nLineIndex = 0;
          wp.nWordIndex = -1;
          AddSection(wp, secinfo);
        }
        break;
      case 0x09:
        word = 0x20;
      default:
        wp = InsertWord(wp, word, charset, pWordProps);
        break;
    }
    nCharCount++;
  }
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:57,代码来源:cpdf_variabletext.cpp

示例6: FPDFText_ProcessInterObj

int FPDFText_ProcessInterObj(const CPDF_TextObject* pPrevObj, const CPDF_TextObject* pObj)
{
    if(FPDFText_IsSameTextObject(pPrevObj, pObj)) {
        return -1;
    }
    CPDF_TextObjectItem item;
    int nItem = pPrevObj->CountItems();
    pPrevObj->GetItemInfo(nItem - 1, &item);
    FX_WCHAR preChar = 0, curChar = 0;
    CFX_WideString wstr = pPrevObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
    if(wstr.GetLength()) {
        preChar = wstr.GetAt(0);
    }
    FX_FLOAT last_pos = item.m_OriginX;
    int nLastWidth = GetCharWidth(item.m_CharCode, pPrevObj->GetFont());
    FX_FLOAT last_width = nLastWidth * pPrevObj->GetFontSize() / 1000;
    last_width = FXSYS_fabs(last_width);
    pObj->GetItemInfo(0, &item);
    wstr = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
    if(wstr.GetLength()) {
        curChar = wstr.GetAt(0);
    }
    int nThisWidth = GetCharWidth(item.m_CharCode, pObj->GetFont());
    FX_FLOAT this_width = nThisWidth * pObj->GetFontSize() / 1000;
    this_width = FXSYS_fabs(this_width);
    FX_FLOAT threshold = last_width > this_width ? last_width / 4 : this_width / 4;
    CFX_AffineMatrix prev_matrix, prev_reverse;
    pPrevObj->GetTextMatrix(&prev_matrix);
    prev_reverse.SetReverse(prev_matrix);
    FX_FLOAT x = pObj->GetPosX(), y = pObj->GetPosY();
    prev_reverse.Transform(x, y);
    if (FXSYS_fabs(y) > threshold * 2) {
        return 2;
    }
    threshold = (FX_FLOAT)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth);
    threshold = threshold > 400 ? (threshold < 700 ? threshold / 4 :  threshold / 5) : (threshold / 2);
    threshold *= nLastWidth > nThisWidth ? FXSYS_fabs(pPrevObj->GetFontSize()) : FXSYS_fabs(pObj->GetFontSize());
    threshold /= 1000;
    if (FXSYS_fabs(last_pos + last_width - x) > threshold && curChar != L' ' && preChar != L' ')
        if(curChar != L' ' && preChar != L' ') {
            if((x - last_pos - last_width) > threshold || (last_pos - x - last_width) > threshold) {
                return 1;
            }
            if(x < 0 && (last_pos - x - last_width) > threshold) {
                return 1;
            }
            if((x - last_pos - last_width) > this_width || (x - last_pos - this_width) > last_width ) {
                return 1;
            }
        }
    if(last_pos + last_width > x + this_width && curChar == L' ') {
        return 3;
    }
    return 0;
}
开发者ID:151706061,项目名称:PDFium,代码行数:55,代码来源:fpdf_text_search.cpp

示例7:

CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb,
                                                 int32_t startPos) {
  FX_WCHAR c1 = sb.GetAt(startPos);
  FX_WCHAR c2 = sb.GetAt(startPos + 1);
  FX_WCHAR c3 = sb.GetAt(startPos + 2);
  int32_t v = (1600 * c1) + (40 * c2) + c3 + 1;
  FX_WCHAR cw1 = (FX_WCHAR)(v / 256);
  FX_WCHAR cw2 = (FX_WCHAR)(v % 256);
  CFX_WideString b1(cw1);
  CFX_WideString b2(cw2);
  return b1 + b2;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:12,代码来源:BC_C40Encoder.cpp

示例8: XFA_ResolveNodes_AnyChild

int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild(
    CXFA_ResolveNodesData& rnd) {
  CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
  CFX_WideString wsCondition = rnd.m_wsCondition;
  CXFA_Node* findNode = NULL;
  CXFA_NodeArray siblings;
  FX_BOOL bClassName = FALSE;
  if (wsName.GetAt(0) == '#') {
    bClassName = TRUE;
    wsName = wsName.Right(wsName.GetLength() - 1);
  }
  findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild(ToNode(rnd.m_CurNode),
                                                         wsName, bClassName);
  if (findNode == NULL) {
    return 0;
  }
  if (wsCondition.IsEmpty()) {
    rnd.m_Nodes.Add(findNode);
    return rnd.m_Nodes.GetSize();
  }
  m_pNodeHelper->XFA_CountSiblings(findNode, XFA_LOGIC_Transparent,
                                   (CXFA_NodeArray*)&rnd.m_Nodes, bClassName);
  XFA_ResolveNode_FilterCondition(rnd, wsCondition);
  return rnd.m_Nodes.GetSize();
}
开发者ID:andoma,项目名称:pdfium,代码行数:25,代码来源:xfa_script_resolveprocessor.cpp

示例9: getErrorCorrectionCodewordCount

CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(
    CFX_WideString dataCodewords,
    int32_t errorCorrectionLevel,
    int32_t& e) {
  int32_t k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e);
  if (e != BCExceptionNO)
    return L" ";
  FX_WCHAR* ech = FX_Alloc(FX_WCHAR, k);
  FXSYS_memset(ech, 0, k * sizeof(FX_WCHAR));
  int32_t sld = dataCodewords.GetLength();
  for (int32_t i = 0; i < sld; i++) {
    int32_t t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929;
    int32_t t2;
    int32_t t3;
    for (int32_t j = k - 1; j >= 1; j--) {
      t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929;
      t3 = 929 - t2;
      ech[j] = (FX_WCHAR)((ech[j - 1] + t3) % 929);
    }
    t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929;
    t3 = 929 - t2;
    ech[0] = (FX_WCHAR)(t3 % 929);
  }
  CFX_WideString sb;
  for (int32_t j = k - 1; j >= 0; j--) {
    if (ech[j] != 0) {
      ech[j] = (FX_WCHAR)(929 - ech[j]);
    }
    sb += (FX_WCHAR)ech[j];
  }
  FX_Free(ech);
  return sb;
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:33,代码来源:BC_PDF417ErrorCorrection.cpp

示例10: return

CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
                                                 CBC_SymbolInfo* symbolInfo,
                                                 int32_t& e) {
  if (codewords.GetLength() != symbolInfo->m_dataCapacity) {
    e = BCExceptionIllegalArgument;
    return (FX_WCHAR*)"";
  }
  CFX_WideString sb;
  sb += codewords;
  int32_t blockCount = symbolInfo->getInterleavedBlockCount();
  if (blockCount == 1) {
    CFX_WideString ecc =
        createECCBlock(codewords, symbolInfo->m_errorCodewords, e);
    BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)"");
    sb += ecc;
  } else {
    CFX_Int32Array dataSizes;
    dataSizes.SetSize(blockCount);
    CFX_Int32Array errorSizes;
    errorSizes.SetSize(blockCount);
    CFX_Int32Array startPos;
    startPos.SetSize(blockCount);
    for (int32_t i = 0; i < blockCount; i++) {
      dataSizes[i] = symbolInfo->getDataLengthForInterleavedBlock(i + 1);
      errorSizes[i] = symbolInfo->getErrorLengthForInterleavedBlock(i + 1);
      startPos[i] = 0;
      if (i > 0) {
        startPos[i] = startPos[i - 1] + dataSizes[i];
      }
    }
    for (int32_t block = 0; block < blockCount; block++) {
      CFX_WideString temp;
      for (int32_t d = block; d < symbolInfo->m_dataCapacity; d += blockCount) {
        temp += (FX_WCHAR)codewords.GetAt(d);
      }
      CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
      BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)"");
      int32_t pos = 0;
      for (int32_t l = block; l < errorSizes[block] * blockCount;
           l += blockCount) {
        sb.SetAt(symbolInfo->m_dataCapacity + l, ecc.GetAt(pos++));
      }
    }
  }
  return sb;
}
开发者ID:JinAirsOs,项目名称:pdfium,代码行数:46,代码来源:BC_ErrorCorrection.cpp

示例11: determineConsecutiveDigitCount

int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg,
                                                             int32_t startpos) {
  int32_t count = 0;
  int32_t len = msg.GetLength();
  int32_t idx = startpos;
  if (idx < len) {
    FX_WCHAR ch = msg.GetAt(idx);
    while (isDigit(ch) && idx < len) {
      count++;
      idx++;
      if (idx < len) {
        ch = msg.GetAt(idx);
      }
    }
  }
  return count;
}
开发者ID:JinAirsOs,项目名称:pdfium,代码行数:17,代码来源:BC_HighLevelEncoder.cpp

示例12: MakeReverse

CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) {
  CFX_WideString str2;
  str2.clear();
  int nlen = str.GetLength();
  for (int i = nlen - 1; i >= 0; i--)
    str2 += str.GetAt(i);
  return str2;
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:8,代码来源:cpdf_textpagefind.cpp

示例13: documentFileName

FX_BOOL Document::documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
	if (vp.IsSetting()) {
		CJS_Context* pContext = static_cast<CJS_Context*>(cc);
		sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY);
		return FALSE;
	}
	CFX_WideString wsFilePath = m_pDocument->GetPath();
	FX_INT32 i = wsFilePath.GetLength() - 1;
	for ( ; i >= 0; i-- )
	{
		if ( wsFilePath.GetAt( i ) == L'\\' || wsFilePath.GetAt( i ) == L'/' )
			break;
	}
	if ( i >= 0 && i < wsFilePath.GetLength() - 1 )
	{
		vp << ( wsFilePath.GetBuffer( wsFilePath.GetLength() ) + i + 1 );
	}else{
		vp << L"";
	}
	return TRUE;
}
开发者ID:mcanthony,项目名称:libpdf,代码行数:22,代码来源:Document.cpp

示例14: NormalPropertySetter

void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue,
                                              const CFX_ByteStringC& szPropName,
                                              CFXJSE_Value* pReturnValue) {
  CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr);
  if (!pOriginalObject)
    return;

  CXFA_ScriptContext* lpScriptContext =
      pOriginalObject->GetDocument()->GetScriptContext();
  CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject);
  CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
  const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(
      pObject->GetElementType(), wsPropName.AsStringC());
  if (lpAttributeInfo) {
    (pObject->*(lpAttributeInfo->lpfnCallback))(
        pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
  } else {
    if (pObject->IsNode()) {
      if (wsPropName.GetAt(0) == '#') {
        wsPropName = wsPropName.Right(wsPropName.GetLength() - 1);
      }
      CXFA_Node* pNode = ToNode(pObject);
      CXFA_Node* pPropOrChild = nullptr;
      XFA_Element eType = XFA_GetElementTypeForName(wsPropName.AsStringC());
      if (eType != XFA_Element::Unknown)
        pPropOrChild = pNode->GetProperty(0, eType);
      else
        pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringC());

      if (pPropOrChild) {
        CFX_WideString wsDefaultName(L"{default}");
        const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo =
            XFA_GetScriptAttributeByName(pPropOrChild->GetElementType(),
                                         wsDefaultName.AsStringC());
        if (lpAttrInfo) {
          (pPropOrChild->*(lpAttrInfo->lpfnCallback))(
              pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute);
          return;
        }
      }
    }
    CXFA_Object* pScriptObject =
        lpScriptContext->GetVariablesThis(pOriginalObject, TRUE);
    if (pScriptObject) {
      lpScriptContext->QueryVariableValue(ToNode(pScriptObject), szPropName,
                                          pReturnValue, FALSE);
    }
  }
}
开发者ID:gradescope,项目名称:pdfium,代码行数:49,代码来源:cxfa_scriptcontext.cpp

示例15: if

CFX_WideString CBC_OnedCode128Writer::FilterContents(
    const CFX_WideStringC& contents) {
  CFX_WideString filterChineseChar;
  FX_WCHAR ch;
  for (int32_t i = 0; i < contents.GetLength(); i++) {
    ch = contents.GetAt(i);
    if (ch > 175) {
      i++;
      continue;
    }
    filterChineseChar += ch;
  }
  CFX_WideString filtercontents;
  if (m_codeFormat == BC_CODE128_B) {
    for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
      ch = filterChineseChar.GetAt(i);
      if (ch >= 32 && ch <= 126) {
        filtercontents += ch;
      } else {
        continue;
      }
    }
  } else if (m_codeFormat == BC_CODE128_C) {
    for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
      ch = filterChineseChar.GetAt(i);
      if (ch >= 32 && ch <= 106) {
        filtercontents += ch;
      } else {
        continue;
      }
    }
  } else {
    filtercontents = contents;
  }
  return filtercontents;
}
开发者ID:andoma,项目名称:pdfium,代码行数:36,代码来源:BC_OnedCode128Writer.cpp


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