本文整理汇总了C++中CStringArray::at方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray::at方法的具体用法?C++ CStringArray::at怎么用?C++ CStringArray::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringArray
的用法示例。
在下文中一共展示了CStringArray::at方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HasDateRef
//----------------------------------------
bool CUnit::HasDateRef(CDate* dateRef /*= NULL*/, CStringArray* array /*= NULL*/) const
{
if (!IsDate())
{
return false;
}
CStringArray ar;
ar.ExtractStrings(GetText().c_str(), ' ');
size_t len = ar.size();
if (len <= 2)
{
return false;
}
int32_t index = ar.FindIndex("since");
if (index < 0)
{
return false;
}
CDate dateTmp;
int32_t result = BRATHL_ERROR;
std::string strDate;
for (uint32_t i = index + 1 ; i < ar.size() ; i++)
{
strDate.append(ar.at(i));
strDate.append(" ");
}
strDate = CTools::StringTrim(strDate);
result = dateTmp.SetDate(strDate.c_str());
if (result == BRATHL_SUCCESS)
{
if (dateRef != NULL)
{
*dateRef = dateTmp;
}
}
if (array != NULL)
{
array->Insert(ar);
}
return (result == BRATHL_SUCCESS);
}
示例2: RenderLine
void
ESSimpleRenderView::AddText(_string sStyleName, _string sText, bool bLineBreak, COLORREF crText, _Size szText, float fCX, float fPosX /*= 0.0f*/, int nVAlign, int nHAlign, bool bRedraw){
ESSimpleRenderView_TextStyle* pStyle = (ESSimpleRenderView_TextStyle*)GetTextStyleByName(sStyleName.c_str());
if( !pStyle ) return;
/*
if( !m_pLastLine ){
m_pLastLine = new RenderLine();
m_pRootLine->m_pNextLine = m_pLastLine;
m_pLastLine->m_bLineBreak = bLineBreak;
bLineBreak = false;
}*/
CStringArray arrStrings;
StringHelper::Split(&sText, _T("\r\n"), arrStrings);
RenderItemText* pItemNew = NULL;
RenderItem* pItemPrev = NULL;
RenderLine* pLine = m_pLastLine;
bool bNewLine = false;
if( !pLine || pLine->m_bLineBreak ){
RenderLine* pNewLine = new RenderLine();
pNewLine->m_pPrevLine = pLine;
if( !pLine ){
m_pLastLine = pNewLine;
m_pRootLine->m_pNextLine = m_pLastLine;
m_pLastLine->m_bLineBreak = bLineBreak;
}
else{
pLine->m_pNextLine = pNewLine;
}
pLine = pNewLine;
bNewLine = true;
}
pItemPrev = pLine->m_pFirstItem;
if( pItemPrev ){
while(pItemPrev->m_pNext)
pItemPrev = pItemPrev->m_pNext;
}
int nHeightOld = pLine->m_szLine.cy;
for(int i=0; i<arrStrings.size(); i++){
RenderItemText* pItemNew = new RenderItemText();
pItemNew->m_pLine = pLine;
pItemNew->m_pStyle = pStyle;
pItemNew->m_sText = arrStrings.at(i);
pItemNew->m_sTextLocal = pItemNew->m_sText;
ESLocalizationMan::ParseText(pItemNew->m_sTextLocal);
pItemNew->m_nHAlign = nHAlign;
pItemNew->m_nVAlign = nVAlign;
pItemNew->m_crText = crText;
pItemNew->m_fPosX = fPosX;
pItemNew->m_fCX = fCX;
pStyle->m_font.GetTextSize(&pItemNew->m_sTextLocal, pItemNew->m_szText);
pItemNew->m_szItem = pItemNew->m_szText;
pItemNew->m_szItem.cy += 2*m_nTextMarginTopBottom;
if( i > 0 ){
// Break line on previous item.
pItemPrev->m_bBreakLine = true;
// Set offset of item.
pItemNew->m_ptOffset.SetPoint(0, pLine->m_szLine.cy);
// Set size of line height.
pLine->m_szLine.cy += pItemNew->m_szText.cy;
}
else{
pLine->m_szLine.cx += pItemNew->m_szItem.cx;
pLine->m_szLine.cy = std::max(pLine->m_szLine.cy, pItemNew->m_szItem.cy);
}
if( pItemPrev )
pItemPrev->m_pNext = pItemNew;
else
pLine->m_pFirstItem = pItemNew;
pItemNew->m_pPrev = pItemPrev;
pItemPrev = pItemNew;
}
CalcLineSize(pLine);
if( bNewLine ){
m_nContentHeight += pLine->m_szLine.cy;
m_pLastLine = pLine;
}
else
m_nContentHeight += (pLine->m_szLine.cy - nHeightOld);
m_nTopFullOffsetY = 0;
if( m_szView.cy != m_nContentHeight ){
m_szView.cy = m_nContentHeight;
if( IsCreated() )
AdjustScrollBarPos(bRedraw);
}
pLine->m_bLineBreak = bLineBreak;
if( bRedraw ){
_Rect rcLine;
//.........这里部分代码省略.........
示例3: GetInfo
//----------------------------------------
void CPlot::GetInfo()
{
CUnit unitXRead;
CUnit unitYRead;
string unitXStr;
string unitYStr;
bool assignYUnit = true;
bool assignYTitle = true;
bool assignXUnit = true;
bool assignXTitle = true;
CObArray allInternalFiles(false);
GetAllInternalFiles(allInternalFiles);
int32_t nrFiles = allInternalFiles.size();
//int32_t iField = 0;
int32_t nrFields = m_fields.size();
CObArray::iterator itField;
CObArray::iterator itFile;
CStringArray plotFieldNames;
for (itField = m_fields.begin() ; itField != m_fields.end() ; itField++)
{
CPlotField* field = CPlotField::GetPlotField(*itField);
string fieldName = (const char *)(field->m_name);
plotFieldNames.InsertUnique(fieldName);
if ((field->m_xyProps != NULL) && (m_title.IsEmpty()) )
{
m_title = field->m_xyProps->GetTitle();
}
for (itFile = field->m_internalFiles.begin() ; itFile != field->m_internalFiles.end() ; itFile++)
{
CInternalFiles* yfx = CPlot::GetInternalFiles(*itFile);
//-----------------------------------
// Get plot Title --> title of the first file
//-----------------------------------
if (m_title.IsEmpty())
{
m_title = yfx->GetTitle("").c_str();
}
//-----------------------------------
// Get and control unit of X axis
//-----------------------------------
string varXName;
GetAxisX(yfx, NULL, NULL, &varXName);
unitXRead = yfx->GetUnit(varXName);
if (assignXUnit)
{
m_unitX = unitXRead;
unitXStr = m_unitX.AsString();
m_unitXLabel = "\nUnit:\t" + wxString(m_unitX.GetText().c_str());
assignXUnit = false;
}
else
{
string unitXReadStr = unitXRead.AsString();
if (m_unitX.IsCompatible(unitXRead) == false)
{
string msg = CTools::Format("CPlot::CkeckUnits - In group field number %d, X field unit are not in the same way (not compatible)"
"- Expected unit '%s' and found '%s' for axis X - File name is '%s'",
m_groupNumber,
unitXStr.c_str(),
unitXReadStr.c_str(),
yfx->GetName().c_str());
CException e(msg, BRATHL_INCONSISTENCY_ERROR);
CTrace::Tracer("%s", e.what());
throw (e);
}
if (unitXStr.compare(unitXReadStr) != 0)
{
m_unitXConv = true;
}
}
//-----------------------------------
// Get title of X axis
//-----------------------------------
string titleX;
if (m_titleX.IsEmpty())
{
titleX = yfx->GetTitle(varXName);
if (titleX.empty())
{
titleX = varXName;
//.........这里部分代码省略.........