本文整理汇总了C++中CFX_WideString::TrimLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_WideString::TrimLeft方法的具体用法?C++ CFX_WideString::TrimLeft怎么用?C++ CFX_WideString::TrimLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_WideString
的用法示例。
在下文中一共展示了CFX_WideString::TrimLeft方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression,
int32_t nStart,
CFX_WideString& wsFilter) {
FXSYS_assert(nStart > -1);
int32_t iLength = wsExpression.GetLength();
if (nStart >= iLength) {
return iLength;
}
FX_WCHAR* pBuf = wsFilter.GetBuffer(iLength - nStart);
int32_t nCount = 0;
const FX_WCHAR* pSrc = wsExpression.GetPtr();
FX_WCHAR wCur;
while (nStart < iLength) {
wCur = pSrc[nStart++];
if (wCur == ',') {
break;
}
pBuf[nCount++] = wCur;
}
wsFilter.ReleaseBuffer(nCount);
wsFilter.TrimLeft();
wsFilter.TrimRight();
return nStart;
}
示例2: XFA_ResolveNode_FilterCondition
void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition(
CXFA_ResolveNodesData& rnd,
CFX_WideString wsCondition) {
CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes;
int32_t iCurrIndex = 0;
const CXFA_NodeArray& array = rnd.m_pSC->GetUpObjectArray();
int32_t iSize = array.GetSize();
if (iSize) {
CXFA_Node* curNode = array[iSize - 1];
FX_BOOL bIsProperty = m_pNodeHelper->XFA_NodeIsProperty(curNode);
if (curNode->IsUnnamed() ||
(bIsProperty && curNode->GetClassID() != XFA_ELEMENT_PageSet)) {
iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent,
bIsProperty, TRUE);
} else {
iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent,
bIsProperty, FALSE);
}
}
int32_t iFoundCount = findNodes.GetSize();
wsCondition.TrimLeft();
wsCondition.TrimRight();
int32_t iLen = wsCondition.GetLength();
if (!iLen) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_ALL) {
return;
}
if (iFoundCount == 1) {
return;
}
if (iFoundCount <= iCurrIndex) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) {
m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode);
m_pNodeHelper->m_iCreateCount = iCurrIndex - iFoundCount + 1;
}
findNodes.RemoveAll();
return;
} else {
CXFA_Node* ret = findNodes[iCurrIndex];
findNodes.RemoveAll();
findNodes.Add(ret);
return;
}
}
FX_WCHAR wTypeChar = wsCondition[0];
switch (wTypeChar) {
case '[':
XFA_ResolveNode_ConditionArray(iCurrIndex, wsCondition, iFoundCount, rnd);
return;
case '(':
return;
case '"':
return;
case '.':
if (iLen > 1 && (wsCondition[1] == '[' || wsCondition[1] == '(')) {
XFA_ResolveNode_DoPredicateFilter(iCurrIndex, wsCondition, iFoundCount,
rnd);
}
default:
return;
}
}
示例3: getPageNthWord
FX_BOOL Document::getPageNthWord(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE;
int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0;
int nWordNo = params.GetSize() > 1 ? params[1].ToInt() : 0;
bool bStrip = params.GetSize() > 2 ? params[2].ToBool() : true;
CPDF_Document* pDocument = m_pDocument->GetDocument();
if (!pDocument) return FALSE;
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount())
{
sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR);
return FALSE;
}
CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo);
if (!pPageDict) return FALSE;
CPDF_Page page;
page.Load(pDocument, pPageDict);
page.StartParse();
page.ParseContent();
FX_POSITION pos = page.GetFirstObjectPosition();
int nWords = 0;
CFX_WideString swRet;
while (pos)
{
if (CPDF_PageObject* pPageObj = page.GetNextObject(pos))
{
if (pPageObj->m_Type == PDFPAGE_TEXT)
{
int nObjWords = CountWords((CPDF_TextObject*)pPageObj);
if (nWords + nObjWords >= nWordNo)
{
swRet = GetObjWordStr((CPDF_TextObject*)pPageObj, nWordNo - nWords);
break;
}
nWords += nObjWords;
}
}
}
if (bStrip)
{
swRet.TrimLeft();
swRet.TrimRight();
}
vRet = swRet.c_str();
return TRUE;
}
示例4: SubmitDataInternal
bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
CXFA_Submit submit) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return false;
CFX_WideStringC csURLC;
submit.GetSubmitTarget(csURLC);
CFX_WideString csURL(csURLC);
if (csURL.IsEmpty()) {
CFX_WideString ws;
ws.FromLocal("Submit cancelled.");
CFX_ByteString bs = ws.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 4);
bs.ReleaseBuffer(len);
return false;
}
FPDF_FILEHANDLER* pFileHandler = nullptr;
int fileFlag = -1;
switch (submit.GetSubmitFormat()) {
case XFA_ATTRIBUTEENUM_Xdp: {
CFX_WideStringC csContentC;
submit.GetSubmitXDPContent(csContentC);
CFX_WideString csContent;
csContent = csContentC;
csContent.TrimLeft();
csContent.TrimRight();
CFX_WideString space;
space.FromLocal(" ");
csContent = space + csContent + space;
FPDF_DWORD flag = 0;
if (submit.IsSubmitEmbedPDF())
flag |= FXFA_PDF;
ToXFAContentFlags(csContent, flag);
pFileHandler = pFormFillEnv->OpenFile(FXFA_SAVEAS_XDP, nullptr, "wb");
fileFlag = FXFA_SAVEAS_XDP;
ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XDP, 0, flag);
break;
}
case XFA_ATTRIBUTEENUM_Xml:
pFileHandler = pFormFillEnv->OpenFile(FXFA_SAVEAS_XML, nullptr, "wb");
fileFlag = FXFA_SAVEAS_XML;
ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0, FXFA_XFA_ALL);
break;
case XFA_ATTRIBUTEENUM_Pdf:
break;
case XFA_ATTRIBUTEENUM_Urlencoded:
pFileHandler = pFormFillEnv->OpenFile(FXFA_SAVEAS_XML, nullptr, "wb");
fileFlag = FXFA_SAVEAS_XML;
ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0, FXFA_XFA_ALL);
break;
default:
return false;
}
if (!pFileHandler)
return false;
if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) {
CFX_WideString csToAddress;
CFX_WideString csCCAddress;
CFX_WideString csBCCAddress;
CFX_WideString csSubject;
CFX_WideString csMsg;
if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject,
csMsg)) {
return false;
}
CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode();
CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode();
CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode();
CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode();
CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode();
FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
FPDF_WIDESTRING pSubject =
(FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());
FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
pFormFillEnv->EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg);
bsTo.ReleaseBuffer();
bsCC.ReleaseBuffer();
bsBcc.ReleaseBuffer();
bsSubject.ReleaseBuffer();
bsMsg.ReleaseBuffer();
} else {
// HTTP or FTP
CFX_WideString ws;
CFX_ByteString bs = csURL.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->UploadTo(pFileHandler, fileFlag,
(FPDF_WIDESTRING)bs.GetBuffer(len));
bs.ReleaseBuffer(len);
}
return true;
}
示例5: MailToInfo
bool CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
CFX_WideString& csToAddress,
CFX_WideString& csCCAddress,
CFX_WideString& csBCCAddress,
CFX_WideString& csSubject,
CFX_WideString& csMsg) {
CFX_WideString srcURL = csURL;
srcURL.TrimLeft();
if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0)
return false;
int pos = srcURL.Find(L'?', 0);
CFX_WideString tmp;
if (pos == -1) {
pos = srcURL.Find(L'@', 0);
if (pos == -1)
return false;
tmp = srcURL.Right(csURL.GetLength() - 7);
} else {
tmp = srcURL.Left(pos);
tmp = tmp.Right(tmp.GetLength() - 7);
}
tmp.TrimLeft();
tmp.TrimRight();
csToAddress = tmp;
srcURL = srcURL.Right(srcURL.GetLength() - (pos + 1));
while (!srcURL.IsEmpty()) {
srcURL.TrimLeft();
srcURL.TrimRight();
pos = srcURL.Find(L'&', 0);
tmp = (pos == -1) ? srcURL : srcURL.Left(pos);
tmp.TrimLeft();
tmp.TrimRight();
if (tmp.GetLength() >= 3 && tmp.Left(3).CompareNoCase(L"cc=") == 0) {
tmp = tmp.Right(tmp.GetLength() - 3);
if (!csCCAddress.IsEmpty())
csCCAddress += L';';
csCCAddress += tmp;
} else if (tmp.GetLength() >= 4 &&
tmp.Left(4).CompareNoCase(L"bcc=") == 0) {
tmp = tmp.Right(tmp.GetLength() - 4);
if (!csBCCAddress.IsEmpty())
csBCCAddress += L';';
csBCCAddress += tmp;
} else if (tmp.GetLength() >= 8 &&
tmp.Left(8).CompareNoCase(L"subject=") == 0) {
tmp = tmp.Right(tmp.GetLength() - 8);
csSubject += tmp;
} else if (tmp.GetLength() >= 5 &&
tmp.Left(5).CompareNoCase(L"body=") == 0) {
tmp = tmp.Right(tmp.GetLength() - 5);
csMsg += tmp;
}
srcURL = (pos == -1) ? L"" : srcURL.Right(csURL.GetLength() - (pos + 1));
}
csToAddress.Replace(L",", L";");
csCCAddress.Replace(L",", L";");
csBCCAddress.Replace(L",", L";");
return true;
}
示例6: XFA_WideStringToDouble
FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) {
CFX_WideString wsValue = wsStringVal;
wsValue.TrimLeft();
wsValue.TrimRight();
int64_t nIntegral = 0;
FX_DWORD dwFractional = 0;
int32_t nExponent = 0;
int32_t cc = 0;
FX_BOOL bNegative = FALSE, bExpSign = FALSE;
const FX_WCHAR* str = (const FX_WCHAR*)wsValue;
int32_t len = wsValue.GetLength();
if (str[0] == '+') {
cc++;
} else if (str[0] == '-') {
bNegative = TRUE;
cc++;
}
int32_t nIntegralLen = 0;
while (cc < len) {
if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' ||
nIntegralLen > 17) {
break;
}
if (!XFA_IsDigit(str[cc])) {
return 0;
}
nIntegral = nIntegral * 10 + str[cc] - '0';
cc++;
nIntegralLen++;
}
nIntegral = bNegative ? -nIntegral : nIntegral;
int32_t scale = 0;
FX_DOUBLE fraction = 0.0;
if (cc < len && str[cc] == '.') {
cc++;
while (cc < len) {
fraction += fraction_scales[scale] * (str[cc] - '0');
scale++;
cc++;
if (cc == len) {
break;
}
if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) ||
str[cc] == 'E' || str[cc] == 'e') {
break;
}
if (!XFA_IsDigit(str[cc])) {
return 0;
}
}
dwFractional = (FX_DWORD)(fraction * 4294967296.0);
}
if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
cc++;
if (cc < len) {
if (str[cc] == '+') {
cc++;
} else if (str[cc] == '-') {
bExpSign = TRUE;
cc++;
}
}
while (cc < len) {
if (str[cc] == '.' || !XFA_IsDigit(str[cc])) {
return 0;
}
nExponent = nExponent * 10 + str[cc] - '0';
cc++;
}
nExponent = bExpSign ? -nExponent : nExponent;
}
FX_DOUBLE dValue = (dwFractional / 4294967296.0);
dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue);
if (nExponent != 0) {
dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent);
}
return dValue;
}