本文整理汇总了C++中StrAnsi::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ StrAnsi::Length方法的具体用法?C++ StrAnsi::Length怎么用?C++ StrAnsi::Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StrAnsi
的用法示例。
在下文中一共展示了StrAnsi::Length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
/*----------------------------------------------------------------------------------------------
Crawl through the database and rename/delete the given styles.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwDbMergeStyles::Process(DWORD hWnd)
{
BEGIN_COM_METHOD;
Assert(m_vstuOldNames.Size() == m_vstuNewNames.Size());
if (!m_hvoRoot)
return E_UNEXPECTED;
if (!m_pclsidApp)
return E_UNEXPECTED;
if (LogFile())
{
ULONG cbLog;
StrAnsi staLog;
staLog.Format("Changing style names in %S (%S)%n",
DbName().Chars(), ServerName().Chars());
LogFile()->Write(staLog.Chars(), staLog.Length(), &cbLog);
}
m_qprog->DoModeless((HWND)hWnd);
StrUni stuMsg(kstidChgStyleLabel);
m_qprog->put_Title(stuMsg.Bstr());
ResetConnection();
BeginTrans();
CreateCommand();
SetPercentComplete(0);
// We want to affect only a subset of the formatting and style information in the database,
// based on which program is currently running, since different programs may be using
// different sets of styles. This information is derived from m_hvoRoot and m_pclsidApp.
// (Unfortunately, there's no way to derive one of these values from the other one.) The
// current scheme works for Data Notebook, List Editor, TE, and LexText. Additional
// programs may introduce even more complexities.
// 1. Find all the owners of StStyle objects. This should match up to LangProject (Data
// Notebook and List Editor), Scripture (TE), or LexDb (LexText).
// 2. If an owner equals m_hvoRoot, then only those objects owned by m_hvoRoot have the
// string and paragraph formatting fixed. Except that LexText also wants to fix all the
// Text objects owned by the LangProject in addition to all the objects owned by the
// LexDb, so those have to be added to the collection of objects.
// 3. If none of the owners equals m_hvoRoot, we must be dealing with Data Notebook or List
// Editor, which share a common set of styles owned by the LangProject itself. In
// this case, we want all the objects owned by the LangProject except those owned by
// another owner of styles (or the LangProject Text objects, since those use the
// LexText styles even though they're not owned by the root object). (This isn't quite
// right if either TE or LexText does not actually own any styles yet, but we won't worry
// about this nicety.)
// 4. After creating a temp table containing just the ids of those objects of interest, we
// can then process all the relevant string formatting (via a string crawler) and
// paragraph StyleRules (later in this method)
// 5. Finally, we may need to fix the Style fields of the relevant UserViewField objects.
// These are limited by the psclsidApp argument, since the UserView objects are specific
// to specific applications. If pssclidApp indicates either Data Notebook or List
// Editor, then UserViewField objects belonging to both of those programs are fixed.
// Otherwise, only those UserViewField objects belonging to the specific program
// identified by psclsidApp are fixed.
ComBool fMoreRows;
UINT cbSpaceTaken;
ComBool fIsNull;
int hobj = 0;
int clid = 0;
bool fFixOwned = false;
int clidOwned = 0;
int hvoLangProj = 0;
Vector<int> vhvoOwners;
Vector<int> vclidOwners;
Vector<int> vhvoTexts;
StrUni stuCmd;
stuCmd.Format(L"SELECT DISTINCT c.Owner$, co.Class$ "
L"FROM CmObject c "
L"JOIN CmObject co on co.Id = c.Owner$ "
L"WHERE c.Class$ = %d",
kclidStStyle);
CheckHr(GetOleDbCommand()->ExecCommand(stuCmd.Bstr(), knSqlStmtSelectWithOneRowset));
CheckHr(GetOleDbCommand()->GetRowset(0));
CheckHr(GetOleDbCommand()->NextRow(&fMoreRows));
while (fMoreRows)
{
CheckHr(GetOleDbCommand()->GetColValue(1, reinterpret_cast <BYTE *>(&hobj),
isizeof(hobj), &cbSpaceTaken, &fIsNull, 0));
CheckHr(GetOleDbCommand()->GetColValue(2, reinterpret_cast <BYTE *>(&clid),
isizeof(clid), &cbSpaceTaken, &fIsNull, 0));
if (hobj == m_hvoRoot)
{
fFixOwned = true;
clidOwned = clid;
}
else if (clid == kclidLangProject)
{
hvoLangProj = hobj;
}
else
{
vhvoOwners.Push(hobj);
vclidOwners.Push(clid);
//.........这里部分代码省略.........
示例2: PreCompileFeatures
bool GdlRenderer::PreCompileFeatures(GrcManager * pcman, GrcFont * pfont, int * pfxdFeatVersion)
{
*pfxdFeatVersion = 0x00010000;
int nInternalID = 0;
Set<unsigned int> setID;
for (int ipfeat = 0; ipfeat < m_vpfeat.Size(); ipfeat++)
{
GdlFeatureDefn * pfeat = m_vpfeat[ipfeat];
unsigned int nID = pfeat->ID();
if (setID.IsMember(nID))
{
char rgch[20];
if (nID > 0x00FFFFFF)
{
char rgchID[5];
memcpy(rgch, &nID, 4);
rgchID[0] = rgch[3]; rgchID[1] = rgch[2]; rgchID[2] = rgch[1]; rgchID[3] = rgch[0];
rgchID[4] = 0;
StrAnsi staTmp = "'";
staTmp.Append(rgchID);
staTmp.Append("'");
memcpy(rgch, staTmp.Chars(), staTmp.Length() + 1);
}
else
itoa(nID, rgch, 10);
g_errorList.AddError(3152, pfeat, "Duplicate feature ID: ", rgch);
}
else
setID.Insert(nID);
if (pfeat->ErrorCheck())
{
pfeat->SetStdStyleFlag();
pfeat->FillInBoolean(pcman->SymbolTable());
pfeat->ErrorCheckContd();
pfeat->CalculateDefault();
pfeat->AssignInternalID(nInternalID);
pfeat->RecordDebugInfo();
}
if (nID > 0x0000FFFF)
*pfxdFeatVersion = 0x00020000;
nInternalID++;
}
if (m_vpfeat.Size() > kMaxFeatures)
{
char rgchMax[20];
itoa(kMaxFeatures, rgchMax, 10);
char rgchCount[20];
itoa(m_vpfeat.Size(), rgchCount, 10);
g_errorList.AddError(3153, NULL,
"Number of features (",
rgchCount,
") exceeds maximum of ",
rgchMax);
}
return true;
}
示例3: WriteBulNumFontInfo
/*----------------------------------------------------------------------------------------------
Write the given FontInfo string text property value in readable XML format.
@param pstrm Pointer to an IStream for output.
@param bstrVal
----------------------------------------------------------------------------------------------*/
void FwXml::WriteBulNumFontInfo(IStream * pstrm, BSTR bstrVal, int cchIndent)
{
AssertPtr(pstrm);
Assert(cchIndent >= 0);
int cchProps = ::SysStringLen(bstrVal);
if (!cchProps)
return;
Vector<char> vchIndent;
vchIndent.Resize(cchIndent + 1);
memset(vchIndent.Begin(), ' ', cchIndent);
const OLECHAR * pchProps = bstrVal;
const OLECHAR * pchPropsLim = pchProps + cchProps;
FormatToStream(pstrm, "%s<BulNumFontInfo", vchIndent.Begin());
StrAnsi staItalic;
StrAnsi staBold;
StrAnsi staSuperscript;
StrAnsi staUnderline;
StrAnsi staFontsize;
StrAnsi staOffset;
StrAnsi staForecolor;
StrAnsi staBackcolor;
StrAnsi staUndercolor;
StrAnsi staXXX;
int tpt;
while (pchProps < pchPropsLim)
{
tpt = *pchProps++;
if (tpt == ktptFontFamily)
break;
int nVal = *pchProps + ((*(pchProps + 1)) << 16);
pchProps += 2;
switch (tpt)
{
case ktptItalic:
staItalic.Format(" italic=\"%s\"", ToggleValueName((byte)nVal));
break;
case ktptBold:
staBold.Format(" bold=\"%s\"", ToggleValueName((byte)nVal));
break;
case ktptSuperscript:
staSuperscript.Format(" superscript=\"%s\"", SuperscriptValName((byte)nVal));
break;
case ktptUnderline:
staUnderline.Format(" underline=\"%s\"", UnderlineTypeName((byte)nVal));
break;
case ktptFontSize:
staFontsize.Format(" fontsize=\"%dmpt\"", nVal);
break;
case ktptOffset:
staOffset.Format(" offset=\"%dmpt\"", nVal);
break;
case ktptForeColor:
staForecolor.Format(" forecolor=\"%s\"", ColorName(nVal));
break;
case ktptBackColor:
staBackcolor.Format(" backcolor=\"%s\"", ColorName(nVal));
break;
case ktptUnderColor:
staUndercolor.Format(" undercolor=\"%s\"", ColorName(nVal));
break;
default:
staXXX.FormatAppend(" prop_%u=\"%d\"", tpt, nVal);
break;
}
}
ULONG cb;
// Write the integer valued properties in alphabetical order.
if (staBackcolor.Length())
pstrm->Write(staBackcolor.Chars(), staBackcolor.Length(), &cb);
if (staBold.Length())
pstrm->Write(staBold.Chars(), staBold.Length(), &cb);
if (staFontsize.Length())
pstrm->Write(staFontsize.Chars(), staFontsize.Length(), &cb);
if (staForecolor.Length())
pstrm->Write(staForecolor.Chars(), staForecolor.Length(), &cb);
if (staItalic.Length())
pstrm->Write(staItalic.Chars(), staItalic.Length(), &cb);
if (staOffset.Length())
pstrm->Write(staOffset.Chars(), staOffset.Length(), &cb);
if (staSuperscript.Length())
pstrm->Write(staSuperscript.Chars(), staSuperscript.Length(), &cb);
if (staUndercolor.Length())
pstrm->Write(staUndercolor.Chars(), staUndercolor.Length(), &cb);
if (staUnderline.Length())
pstrm->Write(staUnderline.Chars(), staUnderline.Length(), &cb);
if (staXXX.Length())
pstrm->Write(staXXX.Chars(), staXXX.Length(), &cb);
// Write the string valued property (if it exists).
if (tpt == ktptFontFamily && pchProps < pchPropsLim)
{
//.........这里部分代码省略.........