本文整理汇总了C++中CStringArray类的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray类的具体用法?C++ CStringArray怎么用?C++ CStringArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CStringArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
//.........这里部分代码省略.........
COPY_DATA(pbyTemp, &(psTempBlock->m_unMsgCount), sizeof(UINT));
PSTXCANMSGLIST psTempCanList = psTempBlock->m_psTxCANMsgList;
while (psTempCanList != NULL)
{
COPY_DATA(pbyTemp, &(psTempCanList->m_sTxMsgDetails), sizeof (STXCANMSGDETAILS));
psTempCanList = psTempCanList->m_psNextMsgDetails;
}
psTempBlock = psTempBlock->m_psNextMsgBlocksList;
}
m_ouConfigDetails.vRelease(SEND_MULTI_MSGS, (LPVOID*)&psMsgBlockList);
//Get the Tx window placement
WINDOWPLACEMENT WndPlacement;
WINDOWPLACEMENT* pWndPlacement = &WndPlacement;
m_ouConfigDetails.bGetData(TX_WND_PLACEMENT, (void**)(&pWndPlacement));
COPY_DATA(pbyTemp, &WndPlacement, sizeof(WINDOWPLACEMENT));
//Get the Tx splitter position
STXMSGSPLITTERDATA sTxSpliiterData;
STXMSGSPLITTERDATA* psTxSpliiterData = &sTxSpliiterData;
m_ouConfigDetails.bGetData(TX_MSG_WND_SPLITTER_DATA, (void**)(&psTxSpliiterData));
COPY_DATA(pbyTemp, &sTxSpliiterData, sizeof(STXMSGSPLITTERDATA));
//Update the OUT PARAMETERS
lpData = pbyCfgData;
nStreamLength = unSize;
}
break;
case DATABASE_SECTION_ID:
{
BYTE* pbyCfgData = NULL;
UINT unSize = 0;
CStringArray* pomStrDBArray = NULL;
m_ouConfigDetails.bGetData(DATABASE_FILE_NAME, (void**)(&pomStrDBArray));
//FIRST CALC SIZE
unSize += sizeof(BYTE); //Configuration version
unSize += sizeof (UINT); // To store the count
if (pomStrDBArray != NULL)
{
//To store the stringd
unSize += (pomStrDBArray->GetSize()) * (sizeof(char) * MAX_PATH);
}
//ALLOCATE THE MEMORY
pbyCfgData = new BYTE[unSize];
BYTE* pbyTemp = pbyCfgData;
//UPDATE THE DATA
BYTE byVersion = 0x1;
COPY_DATA(pbyTemp, &byVersion, sizeof(BYTE));
UINT unCount = 0;
if (pomStrDBArray != NULL)
{
unCount = pomStrDBArray->GetSize();
}
COPY_DATA(pbyTemp, &unCount, sizeof(UINT));
for (UINT i =0; i < unCount; i++)
{
CString omName = pomStrDBArray->GetAt(i);
char acName[MAX_PATH] = {_T('\0')};
strcpy_s(acName, omName.GetBuffer(MAX_PATH));
COPY_DATA(pbyTemp, acName, (sizeof(char) * MAX_PATH));
示例2: OnInitDialog
BOOL CBusEventHandlerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CStringArray* pomStrArrayHandlerName = NULL;
CDialog::OnInitDialog();
if( m_pDoc != NULL )
{
CButton* pomButton = NULL;
CString omStrHandlerName = STR_EMPTY ;
CString omStrControl = STR_EMPTY ;
INT nCheck = 0;
// get the pointer to CStringArray of error handlers prototypes
pomStrArrayHandlerName = m_pDoc->pomStrGetBusEventHandlerPrototypes();
if(pomStrArrayHandlerName != NULL )
{
// Check for the handlers already added.
for(INT i = 0; i<defBUSEV_HANDLER_NUMBER; i++)
{
for(INT j =0; j<pomStrArrayHandlerName->GetSize(); j++)
{
pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER+i);
if(pomButton != NULL )
{
omStrHandlerName = pomStrArrayHandlerName->GetAt(j);
pomButton->GetWindowText(omStrControl);
omStrControl.Replace(' ','_');
omStrControl.Replace('-','_');
// The find the control text in added handlers text
if( omStrHandlerName.Find(omStrControl) != -1 )
{
// If the dialog box is invoked for delete, check
// the box of already added handlers else check and
// disable
if(m_bIsDelete == TRUE )
{
pomButton->SetCheck(TRUE);
}
else
{
pomButton->SetCheck(TRUE);
pomButton->EnableWindow(FALSE);
}
}
}
}
}
}
// Disable all other check box corresponding to which the handlers
// are not added and dialog box in invoked to delete the handlers
if(m_bIsDelete == TRUE )
{
for(INT i = 0; i<defBUSEV_HANDLER_NUMBER; i++)
{
pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER+i);
if(pomButton != NULL )
{
nCheck = pomButton->GetCheck();
if(nCheck == 0 )
{
pomButton->EnableWindow(FALSE);
}
}
}
// Set the dialog caption text to indicate user is deleting
// the handlers
SetWindowText(defBUSEV_HANDLER_TEXT_DEL);
}
else
{
// Set the dialog caption text to indicate user is adding
// the handlers
SetWindowText(defBUSEV_HANDLER_TEXT_ADD);
}
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例3: LoadTags
bool KSFLoader::LoadGlobalData( const CString &sPath, Song &out )
{
MsdFile msd;
if( !msd.ReadFile( sPath ) )
RageException::Throw( "Error opening file \"%s\": %s", sPath.c_str(), msd.GetError().c_str() );
float BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1;;
for( unsigned i=0; i < msd.GetNumValues(); i++ )
{
const MsdFile::value_t &sParams = msd.GetValue(i);
CString sValueName = sParams[0];
// handle the data
if( 0==stricmp(sValueName,"TITLE") )
LoadTags(sParams[1], out);
else if( 0==stricmp(sValueName,"BPM") )
out.AddBPMSegment( BPMSegment(0, strtof(sParams[1], NULL)) );
else if( 0==stricmp(sValueName,"BPM2") )
BPM2 = strtof( sParams[1], NULL );
else if( 0==stricmp(sValueName,"BPM3") )
BPM3 = strtof( sParams[1], NULL );
else if( 0==stricmp(sValueName,"BUNKI") )
BPMPos2 = strtof( sParams[1], NULL ) / 100.0f;
else if( 0==stricmp(sValueName,"BUNKI2") )
BPMPos3 = strtof( sParams[1], NULL ) / 100.0f;
else if( 0==stricmp(sValueName,"STARTTIME") )
out.m_Timing.m_fBeat0OffsetInSeconds = -strtof( sParams[1], NULL )/100;
else if( 0==stricmp(sValueName,"TICKCOUNT") ||
0==stricmp(sValueName,"STEP") ||
0==stricmp(sValueName,"DIFFICULTY"))
; /* Handled in LoadFromKSFFile; don't warn. */
else
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
}
/* This doesn't work yet: we also need to move the data around, I think, and
* we should handle more than one BPM change. */
if( BPM2 > 0 && BPMPos2 > 0 )
{
const float BeatsPerSecond = out.GetBPMAtBeat(0) / 60.0f;
const float beat = BPMPos2 * BeatsPerSecond;
LOG->Trace("BPM %f, BPS %f, BPMPos2 %f, beat %f",
out.GetBPMAtBeat(0), BeatsPerSecond, BPMPos2, beat);
out.AddBPMSegment( BPMSegment(beat, BPM2) );
}
if( BPM3 > 0 && BPMPos3 > 0 )
{
const float BeatsPerSecond = out.GetBPMAtBeat(0) / 60.0f;
const float beat = BPMPos3 * BeatsPerSecond;
LOG->Trace("BPM %f, BPS %f, BPMPos3 %f, beat %f",
out.GetBPMAtBeat(0), BeatsPerSecond, BPMPos3, beat);
out.AddBPMSegment( BPMSegment(beat, BPM3) );
}
/* Try to fill in missing bits of information from the pathname. */
{
CStringArray asBits;
split( sPath, "/", asBits, true);
ASSERT(asBits.size() > 1);
LoadTags(asBits[asBits.size()-2], out);
}
// search for music with song in the file name
CStringArray arrayPossibleMusic;
GetDirListing( out.GetSongDir() + CString("song.mp3"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + CString("song.ogg"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + CString("song.wav"), arrayPossibleMusic );
if( !arrayPossibleMusic.empty() ) // we found a match
out.m_sMusicFile = arrayPossibleMusic[0];
return true;
}
示例4: Refresh
void ObjectBarDialog::Refresh(bool layer_changed)
{
// check for unnecessary refresh
if (layer_changed && !show_only_selected_layer)
return;
// clear all lists
objects.DeleteAllItems();
for (int i = 0; i < large_images.GetImageCount(); i++)
large_images.Remove(0);
for (int i = 0; i < small_images.GetImageCount(); i++)
small_images.Remove(0);
if(folderfilter > -1 && folderfilter >= application->object_folders.size())
folderfilter = -1;
CObj* pObject;
CObjType* pObjectType;
CStringArray List; // Object list
//object folders
if (folderfilter == -1)
{
HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);
HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL);
ImageList_Add(small_images.m_hImageList, small_image, NULL);
DeleteObject(large_image);
DeleteObject(small_image);
for (int i=0; i<application->object_folders.size(); ++i)
{
if(application->object_folders[i].name == "Default")
continue;
int item = objects.InsertItem(objects.GetItemCount(), application->object_folders[i].name, ImageID);
objects.SetItemData(item, (DWORD_PTR)(const char*)"-1");
}
} // -1 is Default, -2 is disabled
else if(folderfilter != -2 && application->object_folders[folderfilter].name != "Default")
{
HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);
HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL);
ImageList_Add(small_images.m_hImageList, small_image, NULL);
DeleteObject(large_image);
DeleteObject(small_image);
int item = objects.InsertItem(0,"...\\"+application->object_folders[folderfilter].name, ImageID);
objects.SetItemData(item, (DWORD_PTR)(const char*)"-1");
}
if (layout)
{
POSITION LayerPos = layout->layers.GetHeadPosition();
// For each layer
while(LayerPos)
{
CLayer* pLayer = layout->layers.GetNext(LayerPos);
if (show_only_selected_layer && pLayer != layout->current_layer)
continue;
if (!show_nonlayout_objects && pLayer->m_layerType == LAYER_NONFRAME)
continue;
// Loop all objects
CObjList Objects;
pLayer->GetEveryObject(Objects, layout);
POSITION ObjectPos = Objects.GetHeadPosition();
for (int i = 0; i < Objects.GetCount(); i++)
{
long ID = Objects.GetNext(ObjectPos);
layout->objects.Lookup(ID, pObject);
if (pObject->GetGlobalID() != -1)
{
pObjectType = pObject->GetObjectType(application);
// Failed/invalid object type, for some reason
if(!pObjectType)
continue;
//folder filtering
if(folderfilter ==-1 && pObjectType->GetFolder() != "Default")
continue;
else if(folderfilter > -1 && pObjectType->GetFolder()!=application->object_folders[folderfilter].name)
continue;
bool bAdd = true;
for (int j = 0; j < List.GetSize(); j++)
//.........这里部分代码省略.........
示例5: upFileToSer
bool CDLsyn::upFileToSer(CStringArray &data)
{
//CStringA abc="[{\"term_id\":\"1\",\"name\":\"\\u672a\\u5206\\u7c7b\"},{\"term_id\":\"4\",\"name\":\"\u7f51\u7edc\u5b89\u5168\"}]";
//CStringA b;
//b.Format("%s",abc);
//char *retdata=abc.GetBuffer();//unicodeToUtf8(m_strHtml.GetBuffer());
//getClass();
//return true;
CDLupToDistancedlg updlg;
if(updlg.DoModal()!=IDOK){
return false;
}
CStringA status=updlg.m_status;
//((CComboBox*)updlg.GetDlgItem(IDC_STATUS))->GetCurSel()==0?"draft":"public";
CConndb db;
CString sqltmp=_T("SELECT a.title,a.distanceID,a.distanceClass,a.id,a.classid,a.addtime,a.txtaddress,c.classname,a.author,a.difficulty,a.artitletype,a.uniquetag,a.content FROM articles AS a,class AS c where a.classid=c.id and a.id=%s");
CStringA titles,id,addtime,content,locaddress,classname,author,diffiNum,filetype,rid,rclass,classid,uniquetag;
CString sqlcmd;
//CString upDatatmp=_T("title=%s&distanceID=%s&distanceClass=%s&id=%s&classid=%s&addtime=%s&artitletype=%s&uniquetag=%s&content=%s");
CString upData;
for(int j=0;j<data.GetCount();j++){
sqlcmd.Format(sqltmp,data.GetAt(j));
db.search(sqlcmd);
_variant_t var;
try
{
if(db.m_query->eof())
{
AfxMessageBox(_T("没有相关文章,请重新搜索"));
return false;
}
int i=0;
Json::Value root;
while(!db.m_query->eof())
{
var=db.m_query->getStringField(_T("title"));
if(var.vt!=VT_NULL)
titles=(LPCSTR)_bstr_t(var);
var=db.m_query->getIntField(_T("id"));
if(var.vt!=VT_NULL)
id=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("addtime"));
if(var.vt!=VT_NULL)
addtime=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("txtaddress"));
if(var.vt!=VT_NULL)
locaddress=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("classname"));
if(var.vt!=VT_NULL)
classname=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("distanceID"));
if(var.vt!=VT_NULL)
rid=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("uniquetag"));
if(var.vt!=VT_NULL)
uniquetag=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("distanceClass"));
if(var.vt!=VT_NULL)
rclass=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("content"));
if(var.vt!=VT_NULL)
content=(LPCSTR)_bstr_t(var);
var=db.m_query->getStringField(_T("author"));
if(var.vt!=VT_NULL)
author=(LPCSTR)_bstr_t(var);
else
author=_T("");
var=db.m_query->getIntField(_T("difficulty"));
if(var.vt!=VT_NULL)
diffiNum=(LPCSTR)_bstr_t(var);
else
diffiNum=_T("");
var=db.m_query->getStringField(_T("artitletype"));
if(var.vt!=VT_NULL)
filetype=(LPCSTR)_bstr_t(var);
else
filetype=_T("tit");
Json::Value sartitle;
//CString upDatatmp=_T("title=%s&distanceID=%s&distanceClass=%s&id=%s&classid=%s&addtime=%s&artitletype=%s&uniquetag=%s&content=%s");
sartitle["title"] = titles.GetBuffer();
sartitle["distanceID"] = rid.GetBuffer();
sartitle["distanceClass"] = rclass.GetBuffer();
sartitle["id"] = id.GetBuffer();
sartitle["classid"] = classid.GetBuffer();
sartitle["addtime"] = addtime.GetBuffer();
sartitle["artitletype"] = filetype.GetBuffer();
sartitle["uniquetag"] = uniquetag.GetBuffer();
sartitle["content"] = content.GetBuffer();
sartitle["status"]=status.GetBuffer();
root.append(sartitle);
db.m_query->nextRow();
}
//upData.Format(upDatatmp,titles,rid,rclass,id,classid,addtime,filetype,uniquetag,content);
Json::FastWriter writer;
//.........这里部分代码省略.........
示例6: bFormatFunctionPrototype
BOOL CSelectFunctions::bFormatFunctionPrototype(CString &omStrFunctionPrototype)
{
BOOL bReturn = TRUE;
CStringArray omStrArrayParaType;
CString omStrReturnType = "";
CString omStrFuncName = "";
if(m_omStrSelectedText.IsEmpty() == 0 )
{
CString omStrTemp = m_omStrSelectedText;
omStrTemp = omStrTemp.Right(omStrTemp.GetLength() -
omStrTemp.Find(" ") - 1 );
omStrTemp.TrimLeft();
omStrTemp.TrimRight();
omStrReturnType = m_omStrSelectedText;
omStrReturnType.Replace(omStrTemp, "");
INT nIndex = 0;
nIndex = omStrTemp.Find("(");
omStrFuncName = omStrTemp.Left(nIndex);
omStrTemp = omStrTemp.Right(omStrTemp.GetLength() - nIndex - 1);
omStrTemp = omStrTemp.Left( omStrTemp.Find(")"));
while(omStrTemp.IsEmpty() == 0)
{
nIndex = omStrTemp.Find(",");
if(nIndex != -1)
{
omStrArrayParaType.Add(omStrTemp.Left(nIndex));
}
else
{
omStrArrayParaType.Add(omStrTemp);
omStrTemp = "";
}
omStrTemp = omStrTemp.Right(omStrTemp.GetLength() - nIndex - 1 );
}
omStrReturnType.TrimLeft();
omStrReturnType.TrimRight();
omStrFuncName.TrimLeft();
omStrFuncName.TrimRight();
if(omStrReturnType.CompareNoCase(_T("void")) !=0)
{
omStrFunctionPrototype = defTODO_FUNCTION_INSERT;
omStrFunctionPrototype += defNEW_LINE;
omStrFunctionPrototype += _T("/* ");
omStrFunctionPrototype += omStrReturnType;
omStrFunctionPrototype += _T(" ");
omStrFunctionPrototype += defRETURN_TYPE_NAME;
omStrFunctionPrototype += _T(" ;*/");
}
UINT unCount = (COMMANUINT)omStrArrayParaType.GetSize();
omStrFuncName += _T("(");
for(UINT i = 0; i<unCount ;i++)
{
omStrTemp = omStrArrayParaType.GetAt(i);
omStrTemp.TrimLeft();
omStrTemp.TrimRight();
omStrFunctionPrototype += defNEW_LINE;
omStrFunctionPrototype += "/* ";
omStrFunctionPrototype += omStrTemp;
omStrTemp = "";
omStrTemp.Format(defPARAMETER_NAME,i+1);
omStrFunctionPrototype += " ";
omStrFunctionPrototype +=omStrTemp;
omStrFunctionPrototype += " ;*/";
omStrFuncName +=omStrTemp;
if(i != unCount - 1 )
{
omStrFuncName += _T(",");
}
}
omStrFuncName += _T(")");
if(omStrReturnType.CompareNoCase(_T("void")) !=0)
{
omStrFunctionPrototype += defNEW_LINE;
omStrFunctionPrototype += defRETURN_TYPE_NAME;
omStrFunctionPrototype += _T(" = ");
}
omStrFunctionPrototype += omStrFuncName;
omStrFunctionPrototype += _T(";");
omStrFunctionPrototype += defNEW_LINE;
}
return bReturn;
}
示例7: SaveToFile
BOOL CMain_Set::SaveToFile(CString strFile)
{
CString strBuf,str;
str.Format("//VER_%d\r\n",m_nVersion);
strBuf+=str;
str.Format("NUM_DIRECT=%d\r\n",m_ProcessInfoArray.GetSize());
strBuf+=str;
str.Format("REAL_SIZE_DIRECT_BUFER=%d\r\n",REAL_SIZE_DIRECT_BUFER);
strBuf+=str;
str.Format("REAL_NUM_GENFAST_OBJECT=%d\r\n",REAL_NUM_GENFAST_OBJECT);
strBuf+=str;
str.Format("AMOUNT_OBJECT=%d\r\n",AMOUNT_OBJECT);
strBuf+=str;
str.Format("AMOUNT_INIOBJECT=%d\r\n",m_IniObjectArray.GetSize());
strBuf+=str;
str.Format("AMOUNT_INI_MASKA=%d\r\n",m_IniMaskArray.GetSize());
strBuf+=str;
if(m_nVersion > 19)
{
CStringArray dest;
Str2Array(MY_IP, &dest, '.');
if(dest.GetSize()==4)
{
union
{
UINT uIP;
BYTE byIP[4];
}IP;
IP.byIP[0] = (BYTE)atoi(dest[3]);
IP.byIP[1] = (BYTE)atoi(dest[2]);
IP.byIP[2] = (BYTE)atoi(dest[1]);
IP.byIP[3] = (BYTE)atoi(dest[0]);
str.Format("MY_IP=%u\r\n",IP.uIP);
}
else
str.Format("MY_IP=%i\r\n",0);
strBuf+=str;
Str2Array(MY_IP_MASK, &dest, '.');
if(dest.GetSize()==4)
{
union
{
UINT uIP;
BYTE byIP[4];
}IP;
IP.byIP[0] = (BYTE)atoi(dest[3]);
IP.byIP[1] = (BYTE)atoi(dest[2]);
IP.byIP[2] = (BYTE)atoi(dest[1]);
IP.byIP[3] = (BYTE)atoi(dest[0]);
str.Format("MY_IP_MASK=%u\r\n",IP.uIP);
}
else
str.Format("MY_IP_MASK=%i\r\n",0);
strBuf+=str;
Str2Array(MY_IP_GW, &dest, '.');
if(dest.GetSize()==4)
{
union
{
UINT uIP;
BYTE byIP[4];
}IP;
IP.byIP[0] = (BYTE)atoi(dest[3]);
IP.byIP[1] = (BYTE)atoi(dest[2]);
IP.byIP[2] = (BYTE)atoi(dest[1]);
IP.byIP[3] = (BYTE)atoi(dest[0]);
str.Format("MY_IP_GW=%u\r\n",IP.uIP);
}
else
str.Format("MY_IP_GW=%i\r\n",0);
strBuf+=str;
}
str.Format("//KPL_%s\r\n",KPLType);
strBuf+=str;
str.Format("//_%s\r\n\r\n",m_strPSNAME);
strBuf+=str;
for(int i =0; i < m_ProcessInfoArray.GetSize(); i++)
{
str.Format("MAKE_DIRECT=%d\r\n",i+1);
strBuf+=str;
str.Format("TYPE_PROTOKOL=%d\r\n",m_ProcessInfoArray[i].TYPE_PROTOKOL);
strBuf+=str;
str.Format("START_ADDRESS_MAP=%d\r\n",m_ProcessInfoArray[i].START_ADDRESS_MAP);
strBuf+=str;
str.Format("AMOUNT_SIGNIFICATE=%d\r\n",m_ProcessInfoArray[i].AMOUNT_SIGNIFICATE);
strBuf+=str;
str.Format("YESNOLOGALARM=%d\r\n",m_ProcessInfoArray[i].YESNOLOGALARM);
strBuf+=str;
str.Format("YESNOLOGPROTOKOL=%d\r\n",m_ProcessInfoArray[i].YESNOLOGPROTOKOL);
strBuf+=str;
str.Format("//%s\r\n\r\n",m_ProcessInfoArray[i].strCOMMENT);
strBuf+=str;
}
for(int i =0; i < m_IniObjectArray.GetSize(); i++)
//.........这里部分代码省略.........
示例8: Loadable
bool NotesLoader::Loadable( CString sPath )
{
CStringArray list;
GetApplicableFiles( sPath, list );
return !list.empty();
}
示例9: Der_GetDatabaseFiles
// Get the list of database files associated
void CLogObjectCAN::Der_GetDatabaseFiles(CStringArray& omList)
{
omList.Append(m_omListDBFiles);
}
示例10: GetForcedAxisX
//----------------------------------------
void CPlot::GetAxisX(CInternalFiles* yfx,
ExpressionValueDimensions* dimVal,
CExpressionValue* varX,
string* varXName)
{
if (!m_forcedVarXName.empty())
{
if (varXName != NULL)
{
*varXName = m_forcedVarXName.c_str();
}
GetForcedAxisX(yfx, dimVal, varX);
return;
}
CStringArray axisNames;
CStringArray::iterator is;
//ExpressionValueDimensions dimVal;
yfx->GetAxisVars(axisNames);
if (axisNames.size() != 1)
{
string msg = CTools::Format("CPlot::GetAxisX - wrong number of axis in file '%s' : %ld"
"Correct number is 1",
yfx->GetName().c_str(),
(long)axisNames.size());
CException e(msg, BRATHL_INCONSISTENCY_ERROR);
CTrace::Tracer("%s", e.what());
throw (e);
}
for (is = axisNames.begin(); is != axisNames.end(); is++)
{
// Get dim
if (dimVal != NULL)
{
yfx->GetVarDims(*is, *dimVal);
if ( (dimVal->size() <= 0) || (dimVal->size() > 2) )
{
string msg = CTools::Format("CPlot::GetAxisX - '%s' axis -> number of dimensions must be 1 or 2 - Found : %ld",
(*is).c_str(), (long)dimVal->size());
CException e(msg, BRATHL_INCONSISTENCY_ERROR);
CTrace::Tracer("%s", e.what());
throw (e);
}
}
// Get values
if (varX != NULL)
{
/*
string wantedUnit;
NetCDFVarKind varKind = yfx->GetVarKind(*is);
if (varKind == Longitude)
{
wantedUnit = CLatLonPoint::m_DEFAULT_UNIT_LONGITUDE;
}
else if (varKind == Latitude)
{
wantedUnit = CLatLonPoint::m_DEFAULT_UNIT_LATITUDE;
}
else
{
CUnit unitX = yfx->GetUnit(*varXName);
wantedUnit = unitX.GetText();
}
yfx->ReadVar(*is, *varX, wantedUnit);
*/
yfx->ReadVar(*is, *varX, yfx->GetUnit(*is).GetText());
}
// Get name
if (varXName != NULL)
{
*varXName = (*is);
}
}
}
示例11: allInternalFiles
//----------------------------------------
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;
//.........这里部分代码省略.........
示例12: nLoadXMLConfig
int CReplayFile::nLoadXMLConfig(xmlNodePtr pNodePtr)
{
int nRetValue = S_OK;
xmlNodePtr pTempNode = pNodePtr;
CStringArray omStrFilters;
while( NULL != pNodePtr )
{
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"Log_File_Path")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
if(PathIsRelative((char*)key) == TRUE)
{
std::string omStrConfigFolder;
std::string omPath;
char configPath[MAX_PATH];
AfxGetMainWnd()->SendMessage(MSG_GET_CONFIGPATH, (WPARAM)configPath, 0);
CUtilFunctions::nGetBaseFolder(configPath, omStrConfigFolder );
char chAbsPath[MAX_PATH];
PathCombine(chAbsPath, omStrConfigFolder.c_str(), (char*)key);
m_omStrFileName = chAbsPath;
}
else
{
m_omStrFileName = (char*)key;
}
xmlFree(key);
}
}
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"IsEnabled")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
m_bEnabled = xmlUtils::getBooleanValue((char*)key);
xmlFree(key);
}
}
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"Retain_Recored_Time")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
m_nTimeMode = xmlUtils::getBooleanValue((char*)key);
xmlFree(key);
}
}
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"Message_Delay")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
m_unMsgTimeDelay = atoi((char*)key);
xmlFree(key);
}
}
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"Is_Cyclic_Mode")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
m_nReplayMode = (int)xmlUtils::getBooleanValue((char*)key);
xmlFree(key);
}
}
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"Cyclic_Delay")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
m_unCycleTimeDelay = atoi((char*)key);
xmlFree(key);
}
}
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"IsInteractive")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
m_bInteractive = (int)xmlUtils::getBooleanValue((char*)key);
xmlFree(key);
}
}
if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"Replay_Message_Direction")))
{
xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1);
if(NULL != key)
{
this->m_ouReplayMsgType = xmlUtils::bGetDirection((char*)key);
xmlFree(key);
}
}
//.........这里部分代码省略.........
示例13: _T
BOOL CMsgHandlerDlg::bValidateUserSelection(CFunctionEditorDoc* pDoc)
{
BOOL bReturn = TRUE;
BOOL bButtonChecked = FALSE;
CString omStrMsgNameForID = _T("");
CString omStrMsgIDForName = _T("");
if(pDoc != NULL )
{
CString omStrText = _T("");
CString omStrHandlerType = _T("");
bButtonChecked = IsDlgButtonChecked(IDC_RBTN_MSG_NAME);
CStringArray* pMsgArray = pDoc->omStrGetMessageHandlerPrototypes();
if(bButtonChecked)
{
//COMMENTED BY AK **************
int nSelection = 0;
UINT unMsgIDForName = 0;
CString omStrMsgName = _T("");
nSelection = m_omListMsgName.GetCurSel();
m_omListMsgName.GetText(nSelection,omStrMsgName);
// get the corresponding message ID from the database
/* unMsgIDForName=CMsgSignal::ouGetMsgSignal().nGetSlotIDFromName(omStrMsgName);
if(unMsgIDForName != -1)
{
omStrMsgIDForName.Format("%x",unMsgIDForName);
bReturn = bValidateMessageNameAndID( pMsgArray,
defMSG_NAME_HANDLER,
omStrMsgIDForName);
}*/
m_omStrSelectedItemText = defMSG_NAME_HANDLER;
m_omStrSelectedItemText += omStrMsgName;
omStrText = "\""+ omStrMsgName + "\"";
omStrHandlerType = defMSG_NAME_TEXT;
}
else
{
bButtonChecked = IsDlgButtonChecked(IDC_RBTN_MSG_ID);
if(bButtonChecked != 0)
{
UINT unMsgID = 0;
unMsgID = (UINT)m_odEditMsgID.lGetValue();
// Get the corresponding message name from the database
/*omStrMsgNameForID = CMsgSignal::ouGetMsgSignal().
omStrGetMessageNameFromSlotID(unMsgID);
bReturn = bValidateMessageNameAndID( pMsgArray,
defMSG_ID_HANDLER,
omStrMsgNameForID);*/
m_omStrSelectedItemText = defMSG_ID_HANDLER;
m_omStrSelectedItemText += m_omStrMsgID;
omStrText = _T("\"")+ m_omStrMsgID + _T("\"");
omStrHandlerType = defMSG_ID_TEXT;
}
else
{
bButtonChecked = IsDlgButtonChecked(IDC_RBTN_MSG_RANGE);
if(bButtonChecked != 0)
{
UINT unMsgIDFrom = 0;
UINT unMsgIDTo = 0;
m_omStrSelectedItemText = defMSG_IDRANGE_HANDLER;
m_omStrSelectedItemText += m_omStrMsgIDFrom;
m_omStrSelectedItemText += "_";
m_omStrSelectedItemText += m_omStrMsgIDTo;
unMsgIDTo = (UINT)m_odEditMsgIDTo.lGetValue();
unMsgIDFrom =(UINT) m_odEditMsgIDFrom.lGetValue();
if(unMsgIDFrom < unMsgIDTo)
{
omStrText = _T("\"")+ m_omStrMsgIDFrom;
omStrText += _T("-");
omStrText += m_omStrMsgIDTo;
omStrText += _T("\"");
omStrHandlerType = defMSG_IDRANGE_TEXT;
}
else
{
bReturn = FALSE;
AfxMessageBox(defSTRMSG_RANGE_INVALID);
m_odEditMsgIDFrom.SetFocus();
}
}
else
{
bButtonChecked = IsDlgButtonChecked(IDC_RBTN_MSG_ALL);
if(bButtonChecked != 0)
{
m_omStrSelectedItemText = defMSG_ALL;
omStrHandlerType = defMSG_ALL_TEXT;
omStrText = "message";
}
}
}
}
if(bReturn == TRUE)
{
//.........这里部分代码省略.........
示例14: UpdateData
void CMsgHandlerDlg::OnCbtnMsgHandlerApply()
{
BOOL bValidateSelection = FALSE;
UpdateData(TRUE);
m_omButtonApply.EnableWindow(FALSE);
m_omButtonOK.EnableWindow(FALSE);
// Get document pointer
CFunctionEditorDoc* pDoc = CGlobalObj::ouGetObj(m_eBus).podGetFunctionEditorDoc();
if (NULL != pDoc)
{
SBUS_SPECIFIC_INFO sBusSpecInfo;
pDoc->bGetBusSpecificInfo(sBusSpecInfo);
// Validate user selections
bValidateSelection = bValidateUserSelection(pDoc);
if (bValidateSelection == TRUE)
{
CString omFunc = CGlobalObj::omGetBusSpecMsgHndlrName(m_eBus);;
// Add to function editor
CString omSelectedText = _T("");
omSelectedText = BUS_FN_HDR; // Start comment section: init
omSelectedText.Replace(_T("PLACE_HODLER_FOR_BUSNAME"),
sBusSpecInfo.m_omBusName); // Replace the bus name
omFunc += m_omStrSelectedItemText;
omSelectedText.Replace( _T("PLACE_HODLER_FOR_FUNCTIONNAME"),
omFunc );
pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );
// Form the function prototype
omSelectedText = m_omStrSelectedItemText;
int nIndex = -1;
// Get the type and set the parameter type
BOOL bIsMsgSpecificHandler = FALSE;
//Find out whether the Msg handler is DatabaseMsgName type or ID type
CString omMsgHandlerType = CGlobalObj::ouGetObj(m_eBus).m_omMsgStructName;
nIndex = omSelectedText.Find(defSTR_MSG_SPECIFIC_HANDLER);
if( nIndex != -1 )
{
bIsMsgSpecificHandler = TRUE;
// For database message type is equal same as msg name
omMsgHandlerType = omSelectedText.Mid( nIndex +
defMESSAGE_NAME_INDEX );
}
CString omStrParamtype;
if (bIsMsgSpecificHandler == TRUE && (m_eBus == CAN))
{
omStrParamtype = omMsgHandlerType;
}
else// For Msg ID, Range and generic messages the type is sTCANDATA
{
omStrParamtype = CGlobalObj::ouGetObj(m_eBus).m_omMsgStructName;
}
CString omFormatString = m_eBus == CAN ? defDEFAULT_MSG_HANDLER_CODE_CAN : defDEFAULT_MSG_HANDLER_CODE;
omSelectedText.Format( omFormatString,
CGlobalObj::omGetBusSpecMsgHndlrName(sBusSpecInfo.m_eBus),
omSelectedText, // Fun name
omStrParamtype ); // Parameter type
pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );
CString omStrPrototype = omSelectedText;
// Add to tree view
CFnsTreeView* pomTreeView = CGlobalObj::ouGetObj(m_eBus).podGetFuncsTreeViewPtr();
if(pomTreeView != NULL )
{
// Add the prototype to the tree view
CTreeCtrl& omTree = pomTreeView->GetTreeCtrl();
HTREEITEM hItem = omTree.GetSelectedItem();
HTREEITEM hNew =
omTree.InsertItem( omSelectedText, hItem);
omTree.SetItemImage( hNew, 5, 5 );
omTree.SelectItem( hNew );
// Form the body of the function
omSelectedText = "{";
pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );
if (CGlobalObj::ouGetObj(m_eBus).m_omMsgStructName.IsEmpty())
{
ASSERT(FALSE);
}
omSelectedText = defTODO;
pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );
// Form the function footer
omSelectedText = BUS_FN_FOOTER;
omSelectedText.Replace(_T("PLACE_HODLER_FOR_BUSNAME"), sBusSpecInfo.m_omBusName);
omSelectedText.Replace( _T("PLACE_HODLER_FOR_FUNCTIONNAME"),
omFunc );
pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );
CStringArray* pMsgArray =
pDoc->omStrGetMessageHandlerPrototypes();
if ( pMsgArray != NULL )
{
pMsgArray->Add( omStrPrototype );
//.........这里部分代码省略.........
示例15: CMsgSignal
/**
* \brief initialises user selection
* \return TRUE or FALSE
*
* This method will initialise user selection from
* a configuration module to respective module.
*/
BOOL CCANMonitorApp::bInitialiseConfiguration(BOOL bFromCom)
{
BOOL bReturn = TRUE;
CMainFrame* pMainFrame = static_cast<CMainFrame*> (m_pMainWnd);
if(pMainFrame != nullptr )
{
BOOL bIsDatabaseFoundInConfigFile = FALSE;
if(m_pouMsgSignal != nullptr)
{
m_pouMsgSignal->bDeAllocateMemory("");
}
else
{
m_pouMsgSignal = new CMsgSignal(sg_asDbParams[CAN], m_bFromAutomation);
}
if ( m_pouMsgSignal != nullptr )
{
//Get the Database names
CStringArray aomOldDatabases;
//To keep all the files which are successfully imported
CStringArray aomNewDatabases;
aomNewDatabases.RemoveAll();
m_pouMsgSignal->vGetDataBaseNames(&aomOldDatabases);
int nFileCount = aomOldDatabases.GetSize();
if(nFileCount == 0)
{
bIsDatabaseFoundInConfigFile = FALSE;
// Reset corresponding flag
m_pouFlags->vSetFlagStatus( SELECTDATABASEFILE, FALSE );
}
else
{
CString omStrDatabase;
int nDatabaseNotFound = 0;
for(int nCount = 0; nCount < nFileCount; nCount++)
{
omStrDatabase = aomOldDatabases.GetAt(nCount);
if (omStrDatabase.IsEmpty())
{
nDatabaseNotFound++;
aomOldDatabases.RemoveAt(nCount);
--nCount;
--nFileCount;
}
else
{
bIsDatabaseFoundInConfigFile = TRUE;
// Check if the file really exists
struct _finddata_t fileinfo;
if (_findfirst(omStrDatabase.GetBuffer(MAX_PATH) ,&fileinfo) == -1L)
{
CString omStrMsg = _("Database File: ");
omStrMsg += omStrDatabase;
omStrMsg += _(" not found!");
if(bFromCom==FALSE)
{
MessageBox(nullptr,omStrMsg,"BUSMASTER",MB_OK|MB_ICONERROR);
}
// Remove the file name from configuration file.
nDatabaseNotFound++;
aomOldDatabases.RemoveAt(nCount);
--nCount;
--nFileCount;
}
else
{
// Reset corresponding flag
m_pouFlags->vSetFlagStatus( SELECTDATABASEFILE, TRUE );
m_pouMsgSignal->
bFillDataStructureFromDatabaseFile(omStrDatabase, PROTOCOL_UNKNOWN);
pMainFrame->vPopulateJ1939PGNList();
aomNewDatabases.Add(omStrDatabase);
}
}
}
if(nDatabaseNotFound > 0)
{
BYTE* pbyConfigData = nullptr;
UINT unSize = 0;
unSize += (sizeof (UINT) + ((sizeof(char) *MAX_PATH) * aomNewDatabases.GetSize()));
pbyConfigData = new BYTE[unSize];
BYTE* pbyTemp = pbyConfigData;
UINT nCount = 0;
//.........这里部分代码省略.........