本文整理汇总了C++中CStr::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ CStr::GetData方法的具体用法?C++ CStr::GetData怎么用?C++ CStr::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStr
的用法示例。
在下文中一共展示了CStr::GetData方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveUnitListHdr
void CUnitPane::SaveUnitListHdr()
{
CListLayoutItem * pLI;
int i;
CStr Key;
CStr Val;
if (m_pLayout)
{
// we are naming items dynamically, so remove them first!
gpApp->RemoveSection(m_sConfigSectionHdr.GetData());
for (i=0; i<m_pLayout->Count(); i++)
{
pLI = (CListLayoutItem*)m_pLayout->At(i);
Key.Format("%03d", i);
Val.Format("%d, %lu, %s, %s", GetColumnWidth(i), pLI->m_Flags, pLI->m_Name, pLI->m_Caption);
gpApp->SetConfig(m_sConfigSectionHdr.GetData(), Key.GetData(), Val.GetData());
}
gpApp->SetConfig(m_sConfigSection.GetData(), SZ_KEY_SORT1, GetSortName(0 ) );
gpApp->SetConfig(m_sConfigSection.GetData(), SZ_KEY_SORT2, GetSortName(1 ) );
gpApp->SetConfig(m_sConfigSection.GetData(), SZ_KEY_SORT3, GetSortName(2 ) );
}
}
示例2: Decode_GetNextToken
bool COrgOp::Decode_GetNextToken( CStr &roDst, CStr &roSrc ) const
{
int j = roSrc.Find( 0, ORG_OP_DELIM );
if( j < 0 )
return false;
roDst = roSrc.GetSub( 0, j );
roSrc.Del( 0, j+1 ); // ORG_OP_DELIM auch löschen
ORG_OP_LOG( "token: %s\n", roDst.GetData() );
return true;
}
示例3: ShowMessageBoxSwitchable
void ShowMessageBoxSwitchable(const wxString &szTitle, const wxString &szMessage, const wxString &szConfigKey)
{
CStr S;
S = gpApp->GetConfig(SZ_SECT_DO_NOT_SHOW_THESE, szConfigKey.ToUTF8());
if (atol(S.GetData()) > 0)
return;
CMessageBoxSwitchableDlg dlg(NULL, szTitle.ToUTF8(), szMessage.ToUTF8());
dlg.ShowModal();
if (dlg.m_chbSwitchOff->IsChecked())
gpApp->SetConfig(SZ_SECT_DO_NOT_SHOW_THESE, szConfigKey.ToUTF8(), "1");
}
示例4: wxBoxSizer
CShowOneDescriptionDlg::CShowOneDescriptionDlg(wxWindow * parent, const char * title, const char * description)
:CResizableDlg( parent, wxString::FromUTF8(title), SZ_SECT_WND_DESCR_ONE)
{
wxBoxSizer * topsizer = new wxBoxSizer( wxVERTICAL );
wxButton * pBtnDone = new wxButton (this, wxID_CANCEL, wxT("Done") );
wxButton * pBtnSave = new wxButton (this, wxID_OK , wxT("Save as") );
//wxTextCtrl * pText = new wxTextCtrl(this, -1, description, wxDefaultPosition, wxDefaultSize,
// wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL );
wxTextCtrl * pText = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL );
const char * p;
int count = 0;
CStr S;
topsizer->Add( pText ,
1, // make vertically stretchable
wxEXPAND );//| wxALL, // make horizontally stretchable // and make border all around
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( pBtnSave, 0, wxALL, 10 );
button_sizer->Add( pBtnDone, 0, wxALL, 10 );
topsizer->Add( button_sizer, 0, wxALIGN_CENTER );
SetAutoLayout( TRUE ); // tell dialog to use sizer
SetSizer( topsizer ); // actually set the sizer
topsizer->Fit( this ); // set size to minimum size as calculated by the sizer
topsizer->SetSizeHints( this ); // set size hints to honour mininum size}
pText->SetFocus();
pBtnDone ->SetDefault();
CResizableDlg::SetSize();
pText->SetValue(wxString::FromAscii(description));
pText->SetFont(*gpApp->m_Fonts[FONT_VIEW_DLG]);
m_descr = description;
p = description;
while (p && *p && count++ < 3)
{
p = S.GetToken(p, '(', TRIM_ALL);
p = S.GetToken(p, ')', TRIM_ALL);
if (gpApp->SelectLand(S.GetData()))
break;
}
}
示例5:
void CCurveBezier3::Load( const CStr &roData )
{
const char * pcD = roData.GetData();
unsigned int i = 0;
unsigned int uiVertex = 0, uiToken = 0, uiSub = 0;
while( true )
{
const int j = roData.Find( i, DELIM );
if( j < 0 )
break;
float fVal;
sscanf( pcD + i, "%g", &fVal );
switch( uiToken )
{
case 0:
m_aoVertex[uiVertex].m_oPos[uiSub] = fVal;
if( ++uiSub >= 4 )
{
uiSub = 0;
++uiToken;
}
break;
case 1:
m_aoVertex[uiVertex].m_oColor[uiSub] = fVal;
if( ++uiSub >= 4 )
{
uiSub = 0;
++uiToken;
}
break;
case 2:
m_aoVertex[uiVertex].m_fWeight0 = fVal;
if( ++uiSub >= 1 )
{
m_aoVertex[uiVertex].m_uiVertex = uiVertex;
uiSub = 0;
uiToken = 0;
++uiVertex;
if( uiVertex >= 4 )
break;
}
break;
}
i = j + 1;
}
}
示例6: Decode_GetNextLine
bool COrgOp::Decode_GetNextLine( CStr &roDst, CStr &roSrc ) const
{
int j;
j = roSrc.Find( 0, ORG_OP_DELIM );
if( j < 0 )
return false;
roSrc.Del( 0, ++j );
j = roSrc.Find( 0, ORG_OP_NEWLINE );
if( j < 0 )
return false;
roDst = roSrc.GetSub( 0, j );
roSrc.Del( 0, j+sizeof( ORG_OP_NEWLINE ) );
ORG_OP_LOG( "line: %s\n", roDst.GetData() );
return true;
}
示例7: OnLBSelect
void CShowDescriptionListDlg::OnLBSelect(wxCommandEvent & event)
{
CBaseObject * pObj;
CStr S;
const char * p;
pObj = (CBaseObject*)m_pItems->At((long)m_pList->GetClientData(m_pList->GetSelection()));
if (pObj)
{
p = pObj->Name.GetData();
while (p && *p)
{
p = S.GetToken(p, '(', TRIM_ALL);
p = S.GetToken(p, ')', TRIM_ALL);
if (gpApp->SelectLand(S.GetData()))
break;
}
}
}
示例8: wxT
CComboboxDlg::CComboboxDlg(wxWindow *parent, const char * szTitle, const char * szMessage, const char * szChoices)
:wxDialog(parent, -1, wxString::FromAscii(szTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
{
wxBoxSizer * topsizer;
wxBoxSizer * sizer ;
CStr S;
wxButton * btnOk;
wxButton * btnCancel;
btnOk = new wxButton (this, wxID_OK , wxT("Ok") );
btnCancel = new wxButton (this, wxID_CANCEL, wxT("Cancel") );
m_cbChoices = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN);
topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add(new wxStaticText(this, -1, wxString::FromAscii(szMessage)), 0, wxALIGN_LEFT | wxALL, 5);
topsizer->Add(m_cbChoices , 0, wxALIGN_CENTER | wxALL | wxGROW, 5);
sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add(btnOk , 0, wxALIGN_CENTER | wxALL, 5);
sizer->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5);
topsizer->Add(sizer, 0, wxALIGN_CENTER | wxALL, 10);
while (szChoices && *szChoices)
{
szChoices = S.GetToken(szChoices, ',');
m_cbChoices->Append(wxString::FromAscii(S.GetData()));
}
SetAutoLayout( TRUE ); // tell dialog to use sizer
SetSizer( topsizer ); // actually set the sizer
topsizer->Fit( this ); // set size to minimum size as calculated by the sizer
topsizer->SetSizeHints( this ); // set size hints to honour mininum size}
m_cbChoices->SetFocus();
btnOk->SetDefault();
Centre( wxBOTH | wxCENTER_FRAME);
}
示例9: OnPopupMenuAddUnitToTracking
void CUnitPane::OnPopupMenuAddUnitToTracking (wxCommandEvent& WXUNUSED(event))
{
long idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
CUnit * pUnit = GetUnit(idx);
int sectidx;
CStr S;
const char * szName;
const char * szValue;
BOOL found = FALSE;
BOOL ManyUnits = (GetSelectedItemCount() > 1);
sectidx = gpApp->GetSectionFirst(SZ_SECT_UNIT_TRACKING, szName, szValue);
while (sectidx >= 0)
{
if (!S.IsEmpty())
S << ",";
S << szName;
sectidx = gpApp->GetSectionNext(sectidx, SZ_SECT_UNIT_TRACKING, szName, szValue);
}
if (S.IsEmpty())
S = "Default";
if (pUnit || ManyUnits)
{
CComboboxDlg dlg(this, "Add unit to a tracking group", "Select a group to add unit to.\nTo create a new group, just type in it's name.", S.GetData());
if (wxID_OK == dlg.ShowModal())
{
idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
while (idx>=0)
{
pUnit = GetUnit(idx);
found = FALSE;
szValue = gpApp->GetConfig(SZ_SECT_UNIT_TRACKING, dlg.m_Choice.GetData());
while (szValue && *szValue)
{
szValue = S.GetToken(szValue, ',');
if (atol(S.GetData()) == pUnit->Id)
{
found = TRUE;
break;
}
}
if (found)
wxMessageBox(wxT("The unit is already in the group."));
else
{
S = gpApp->GetConfig(SZ_SECT_UNIT_TRACKING, dlg.m_Choice.GetData());
S.TrimRight(TRIM_ALL);
if (!S.IsEmpty())
S << ",";
S << pUnit->Id;
gpApp->SetConfig(SZ_SECT_UNIT_TRACKING, dlg.m_Choice.GetData(), S.GetData());
}
idx = GetNextItem(idx, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}
}
}
}
示例10: Parse
bool CPrsBDF::Parse( const char *pcFont )
{
#define TOK(T) TPairTokenNameID( #T, PBDF_TOKEN_##T )
static const TPairTokenNameID m_aoToken_[] =
{
TOK( STARTFONT ),
TOK( COMMENT ),
TOK( CONTENTVERSION ),
TOK( FONT ),
TOK( SIZE ),
TOK( FONTBOUNDINGBOX ),
TOK( METRICSSET ),
TOK( SWIDTH ),
TOK( DWIDTH ),
TOK( SWIDTH1 ),
TOK( DWIDTH1 ),
TOK( VVECTOR ),
TOK( STARTPROPERTIES ),
TOK( ENDPROPERTIES ),
TOK( CHARS ),
TOK( STARTCHAR ),
TOK( ENCODING ),
TOK( BBX ),
TOK( BITMAP ),
TOK( ENDCHAR ),
TOK( ENDFONT )
};
static const unsigned int uiTokenNum = sizeof( m_aoToken_ ) / sizeof( TPairTokenNameID );
CStr oStrFontFile( pcFont );
const int iFontSize = oStrFontFile.GetSize();
int iPropertiesStartPos = -1;
CGlyph oGylphNew;
CGlyph *poGlyph = &m_oGlyphDefault;
bool bIsReadingChar = false;
Reset();
PBDF_LOG( "parse: start\n" );
int iPos = 0;
while( iPos < iFontSize )
{
int iEndOfLine = oStrFontFile.Find( iPos, PBDF_NEWLINE );
if( iEndOfLine < 0 )
iEndOfLine = iFontSize;
CStr oStrLine = oStrFontFile.GetSub( iPos, iEndOfLine - iPos );
RemoveLeadingSpace( oStrLine );
//PBDF_LOG( "line: %s", oStrLine.GetData() );
//PBDF_LOG( "line_size: %s", oStrLine.GetSize() );
unsigned int uiTokenNext = PBDF_TOKEN_NONE;
for( unsigned int t=0; t<uiTokenNum; ++t )
{
CStr oStrToken = m_aoToken_[t].GetFirst() ;
const unsigned int uiTokenSize = oStrToken.GetSize();
//PBDF_LOG( "token: %s", oStrToken.GetData() );
int iPosToken = oStrLine.Find( 0, oStrToken );
if( iPosToken != 0 )
continue;
// Danach müssen Leerzeichen oder das Ende folgen!
const unsigned int uiPosNext = iPosToken + uiTokenSize;
if( uiPosNext < oStrLine.GetSize() )
{
const char cNext = oStrLine[ uiPosNext ];
if( !( cNext == ' ' || cNext == '\t' ) )
continue;
}
if( iPosToken >= 0 )
{
oStrLine.Del( 0, uiTokenSize );
RemoveLeadingSpace( oStrLine );
uiTokenNext = m_aoToken_[t].GetSecond();
PBDF_LOG( "token: %s\n", oStrToken.GetData() );
break;
}
}
if( uiTokenNext != PBDF_TOKEN_NONE )
{
switch( uiTokenNext )
{
case PBDF_TOKEN_STARTFONT:
ReadValue( oStrLine, &m_dVersion );
PBDF_LOG( "version: %g\n", m_dVersion );
break;
case PBDF_TOKEN_COMMENT:
break;
case PBDF_TOKEN_CONTENTVERSION: // optional
ReadValue( oStrLine, &m_iContentVersion );
PBDF_LOG( "content_version: %d\n", m_iContentVersion );
break;
case PBDF_TOKEN_FONT:
ReadValue( oStrLine, &m_oStrFont );
//.........这里部分代码省略.........
示例11: ReadValue
void CPrsBDF::ReadValue( CStr &roStr, int *piInteger )
{
if( roStr.GetSize() )
*piInteger = atoi( roStr.GetData() ); // TODO: ersetzen durch eigene Funktion.
}
示例12: NewMeshObj
void CGmResMan::NewMeshObj( const char *pcSubDir, const char *pcFileName, CArray<CGMeshObj *> &roArr, bool bTexSmooth, bool bRawPoly )
{
roArr.Clear();
CStr oPre( DATA_DIR + "model/" + pcSubDir );
if( oPre[oPre.GetSize()-1] != '/' )
oPre += '/';
CFileBlockTxt oFile;
if( oFile.Load( ( oPre + pcFileName ).GetData() ) )
{
LOG( "Loading %s.\n", ( oPre + pcFileName ).GetData() );
CStr oMaterialLibName;
if( CGMeshObj::LoadModel_( oFile.GetString(), &roArr, bRawPoly, &oMaterialLibName ) )
{
LOG( "%d OBJ-Meshes loaded.\n", roArr.GetSize() );
bool bMtllibOk = false;
CFileBlockTxt oFileMaterialLib;
if( oMaterialLibName.GetSize() )
{
if( oFileMaterialLib.Load( ( oPre + oMaterialLibName ).GetData() ) )
{
//LOG( "\nmtllib:\n%s\n", (const char *)oFileMaterialLib.m_pucData );
LOG( "%s loaded.\n", oMaterialLibName.GetData() );
bMtllibOk = true;
}
}
for( unsigned int i=0; i<roArr.GetSize(); ++i )
{
CGMeshObj *poMesh = roArr[i];
//poMesh->RotateX( M_PI );
//poMesh->ScaleX( 1.1f );
//poMesh->ScaleY( 1.1f );
//poMesh->ScaleZ( 1.1f );
LOG( "\t%s\n", poMesh->m_oName.GetData() );
LOG( "\t%d vertices\n", poMesh->m_oArrVertex.GetSize() );
LOG( "\t%d indices\n", poMesh->m_oArrIndex.GetSize() );
LOG( "\tmaterial: %s\n", poMesh->m_oMaterialName.GetData() );
if( bMtllibOk )
{
CStr oTexNameDiffuse, oTexNameNormal;
poMesh->LoadMaterial(
oFileMaterialLib.GetString(),
poMesh->m_oMaterialName,
&oTexNameDiffuse, 0, &oTexNameNormal );
if( !bRawPoly )
{
if( oTexNameDiffuse.GetSize() )
{
poMesh->SetTex( NewTexture( oTexNameDiffuse, bTexSmooth, false ), 0 );
}
if( oTexNameNormal.GetSize() )
{
poMesh->SetTex( NewTexture( oTexNameNormal, false, false ), 1 );
}
}
}
else if( !bRawPoly && poMesh->m_oMaterialName.GetSize() )
{
poMesh->SetTex( NewTexture( poMesh->m_oMaterialName, bTexSmooth, false ), 0 );
}
poMesh->m_bEnableColor = false; // Hat keine Funktion bei beim Wavefront Object Meshes.
poMesh->Init();
m_oArrMesh.Append( poMesh ); // new
}
}
}
else
{
ERR( "OBJ Mesh %s.\n", pcFileName );
}
}
示例13: FindVecRev
int CStr::FindVecRev( unsigned int uiStart, const CStr & roStr ) const {
return FindVecRev( uiStart, roStr.GetData() );
}
示例14: Load
bool COrgOp::Load( CStr &roSrc, unsigned int uiIDOffset )
{
CStr oStrLine;
CStr oStrToken;
CList<COp *> oLstPatch;
unsigned int uiIDIn = 0;
unsigned int uiIdxIn = 0;
unsigned int uiCountIn = 0;
unsigned int uiPortIn = 0;
unsigned int uiIndexIn = 0;
unsigned int uiCountOut = 0;
unsigned int uiPortOut = 0;
unsigned int uiInteralInt = 0;
unsigned int uiInteralUInt = 0;
unsigned int uiInteralFlt = 0;
unsigned int i = 0;
unsigned int uiMaxIPortIn = 0;
unsigned int uiMaxIPortOut = 0;
unsigned int uiMaxIInternalInt = 0;
unsigned int uiMaxIInternalUInt = 0;
unsigned int uiMaxIInternalFlt = 0;
COp *poOp = 0;
// <mod date="2010-12-07">
CList<CArray<unsigned int> *> oLstArrID;
CArray<unsigned int> * poArrID = 0;
// </mod>
// Alle Operatoren einlesen, erstellen und pseudo-patchen.
while( 1 )
{
if( !Decode_GetNextLine( oStrLine, roSrc ) )
break;
i = 0;
while( 1 )
{
if( !Decode_GetNextToken( oStrToken, oStrLine ) )
break;
if( !oStrToken.GetSize() )
{
if( i > 1 ) // Komprimierung :: -> :0:
oStrToken = '0';
else if( i == 0 )
ORG_OP_LOG( "Fehler: Klassen-Name nicht vorhanden." );
}
// class
if( i == 0 )
{
poOp = Create( oStrToken );
if( poOp == 0 )
{
ORG_OP_LOG( "Fehler: Unbekannte Klasse: %s\n", oStrToken.GetData() );
return false;
}
oLstPatch.Append( poOp );
}
// instance
else if( i == 1 )
{
#ifdef OP_USE_RUNTIME_INFO
poOp->SetNameInstance( oStrToken );
#endif // OP_USE_RUNTIME_INFO
}
// id
else if( i == 2 )
{
unsigned int uiID;
ORG_OP_SSCANF( oStrToken, "%x", &uiID );
poOp->SetID( uiID + uiIDOffset ); // Um keinen Konflikt zu erzeugen.
}
// flags
else if( i == 3 )
{
unsigned int uiFlags;
ORG_OP_SSCANF( oStrToken, "%x", &uiFlags );
poOp->SetFlags( uiFlags );
}
// count_input
else if ( i == 4 )
{
ORG_OP_SSCANF( oStrToken, "%x", &uiCountIn );
if( poOp->GetFlags() & OP_FLAG_DYNAMIC_INPUTS )
{
poOp->SetCountIn( uiCountIn );
}
else if( poOp->GetCountIn() != uiCountIn )
{
#ifdef OP_USE_RUNTIME_INFO
ORG_OP_LOG( "Fehler: Von Klasse %s werden nicht %d Inputs unterstuetzt! "
"Keine dynamischen Inputs!\n", poOp->GetNameClass(), uiCountIn );
#endif // OP_USE_RUNTIME_INFO
return false;
}
uiPortIn = 0;
uiIndexIn = 0;
uiMaxIPortIn = 3 * uiCountIn + 4 + 1;
// <mod date="2010-12-07">
//.........这里部分代码省略.........