本文整理汇总了C++中wxArrayString::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayString::Clear方法的具体用法?C++ wxArrayString::Clear怎么用?C++ wxArrayString::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayString
的用法示例。
在下文中一共展示了wxArrayString::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadFromCache
bool SjInterfaceBase::ReadFromCache(const wxString& file, wxArrayString& retInfo, unsigned long fileTimestamp)
{
retInfo.Clear();
// get key
wxString key(SjModule::GetUniqueStrId(m_name+file, 0));
// create file timestamp if not given
if( fileTimestamp == 0 )
{
if( ::wxFileExists(file) )
{
size_t fileModTime = ::wxFileModificationTime(file);
fileTimestamp = (unsigned long)fileModTime;
}
}
// get info from cache as "<timestamp>:<len1>:<val1>:<len2>:<val2>:<len3> ..."
wxString info(g_tools->m_config->Read("modulecache/" + key, ""));
if( info.IsEmpty() )
{
return FALSE; // not in cache
}
// get cache timestamp
long l;
if( !info.BeforeFirst(':').ToLong(&l, 10) ) { l = 0; }
if( (unsigned long)l != fileTimestamp )
{
return FALSE; // cache out of date
}
info = info.AfterFirst(':');
// get cache data
long currLen;
while( info.BeforeFirst(':').ToLong(&currLen, 10) )
{
info = info.AfterFirst(':');
if( currLen >= (long)info.Len() ) { return FALSE; }
retInfo.Add(info.Left(currLen));
info = info.Mid(currLen+1);
}
return TRUE;
}
示例2: Split
//Split (Tokenize) string at specified intervals
//s == string to split
//retArray == split up string (out)
//cpszExp == expression to split at
//crnStart == start postion to split
//crnCount == max number of split of strings
//crbCIComp == true if case insensitive
void Split( const wxString& s, wxArrayString& retArray, const wxChar* cpszExp,
const size_t& crnStart = 0, const size_t& crnCount = (size_t)-1,
const bool& crbCIComp = false)
{
//sanity checks
wxASSERT_MSG(cpszExp != NULL, wxT("Invalid value for First Param of wxString::Split (cpszExp)"));
//wxASSERT_MSG(crnCount >= (size_t)-1, wxT("Invalid value for Third Param of wxString::Split (crnCount)"));
retArray.Clear();
size_t nOldPos = crnStart, //Current start position in this string
nPos = crnStart; //Current end position in this string
wxString szComp, //this string as-is (if bCIComp is false) or converted to lowercase
szExp = cpszExp; //Expression string, normal or lowercase
if (crbCIComp)
{
szComp = s.Lower();
szExp.MakeLower();
}
else
szComp = s;
if(crnCount == (size_t)-1)
{
for (; (nPos = szComp.find(szExp, nPos)) != wxString::npos;)//Is there another token in the string
{
retArray.Add(Slice(s, nOldPos, nPos)); //Insert the token in the array
nOldPos = nPos += szExp.Length();//Move up the start slice position
}
}
else
{
for (int i = crnCount;
(nPos = szComp.find(szExp, nPos)) != wxString::npos &&
i != 0;
--i)//Is there another token in the string && have we met nCount?
{
retArray.Add(Slice(s, nOldPos, nPos)); //Insert the token in the array
nOldPos = nPos += szExp.Length();//Move up the start slice position
}
}
if (nOldPos != s.Length())
retArray.Add( Slice(s, nOldPos, s.Length()) ); //Add remaining characters in string
}
示例3: GetScripSQL
/*---------------------------------------------------------------------------*/
void wxSQLBook::GetScripSQL(wxArrayString& array)
{
long start, end, count;
wxString str;
array.Clear();
start = end = 0;
count = m_SQLEdit->GetLineCount();
while (start < count && end != -1)
{
str = GetSQLStatementAt(start, end);
if (!str.IsEmpty())
array.Add(str);
start = end + 1;
}
}
示例4: GetMimeTypes
bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
{
mimeTypes.Clear();
size_t nCount = m_index.GetCount();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for (size_t i = 0; i < nCount; i++)
mimeTypes.Add(m_manager->m_aTypes[m_index[i]]);
return true;
}
示例5: Chop
int ecUtils::Chop(const wxString& str, wxArrayString &ar, const wxString& sep,
bool bObserveStrings/*=false*/,bool bBackslashQuotes/*=false*/)
{
ar.Clear();
const wxChar* pszSep = (const wxChar*) sep;
const wxChar* psz = (const wxChar*) str;
int i=0;
for(;;){
// Skip multiple separators
while(*psz && wxStrchr(pszSep,*psz)){
psz++;
}
if(!*psz){
return i;
}
wxString strTok;
if(bObserveStrings){
bool bInString=FALSE;
do{
if(*psz == wxT('\\') && bBackslashQuotes && psz[1]){
strTok += psz[1];
psz++;
} else if(*psz == wxT('"')){
bInString ^= 1;
} else if (!bInString && *psz && NULL != wxStrchr(pszSep,*psz)) {
break;
} else {
strTok+=*psz;
}
} while (*++psz);
} else {
const wxChar* pszStart=psz;
do {
psz++;
} while (*psz && ! wxStrchr(pszSep,*psz));
strTok=wxString(pszStart,psz-pszStart);
}
ar.Add(strTok);
i++;
}
return ar.GetCount();
}
示例6: FindFilesInPaths
/*static*/
bool TranslationMemoryUpdater::FindFilesInPaths(const wxArrayString& paths,
wxArrayString& files,
const wxString& lang)
{
bool rv = true;
files.Clear();
TMUDirTraverser trav(&files, lang);
for (size_t i = 0; i < paths.GetCount(); i++)
{
wxDir dir(paths[i]);
if (!dir.IsOpened() || dir.Traverse(trav) == (size_t)-1)
// return false, but don't terminate, try other directories
// first:
rv = false;
}
return rv;
}
示例7: EnumDatabases
bool wxMySQL::EnumDatabases(wxArrayString & array)
{
MYSQL_RES * res;
MYSQL_ROW row;
array.Clear();
do
{
res = mysql_list_dbs(m_pDB,NULL);
if(!res) break;
while(row = mysql_fetch_row(res))
{
array.Add(wxString(row[0]));
}
mysql_free_result(res);
}
while(false);
m_LastErrorMessage = mysql_error(m_pDB);
return true;
}
示例8: Get
//---------------------------------------------------------
bool CWKSP_Data_Menu_File::Get(wxArrayString &FileNames, bool bAppend)
{
if( !bAppend )
{
FileNames.Clear();
}
if( m_Recent && m_Recent_Count > 0 )
{
for(int i=0; i<m_Recent_Count; i++)
{
FileNames.Add(m_Recent[i]);
}
return( true );
}
return( false );
}
示例9: OnChar
void OnChar(wxKeyEvent &evt) {
if (evt.GetKeyCode()==WXK_TAB) {
if (debug->CanTalkToGDB()) {
comp_options.Clear();
wxString ans = debug->SendCommand("complete ",GetValue());
while (ans.Contains("\n")) {
wxString line=ans.BeforeFirst('\n');
ans=ans.AfterFirst('\n');
if (line.StartsWith("~\"")) {
wxString ue=mxUT::UnEscapeString(line.Mid(1));
while (ue.Len() && (ue.Last()=='\n'||ue.Last()=='\r')) ue.RemoveLast();
comp_options.Add(ue);
}
}
if (!comp_options.GetCount()) return;
if (comp_options.GetCount()==1) { SetText(comp_options[0]); return; }
else {
wxString common_part=comp_options[0];
for(unsigned int i=1;i<comp_options.GetCount();i++) {
int j=0, l1=comp_options[i].Len(), l2=common_part.Len();
while (j<l1 && j<l2 && comp_options[i][j]==common_part[j]) j++;
if (j<l2) common_part=common_part.Mid(0,j);
}
if (common_part!=GetValue()) SetValue(common_part);
}
wxMenu menu("");
for(unsigned int i=0;i<comp_options.GetCount();i++)
menu.Append(wxID_HIGHEST+1000+i, comp_options[i]);
wxRect r = GetScreenRect();
PopupMenu(&menu,0,r.height);
}
} else if (evt.GetKeyCode()==WXK_UP) {
if (input_history_pos>0)
SetText(input_history[--input_history_pos]);
} else if (evt.GetKeyCode()==WXK_DOWN) {
if (input_history_pos+1==input_history.GetCount())
SetText("");
else if (input_history_pos+1<input_history.GetCount())
SetText(input_history[++input_history_pos]);
} else {
evt.Skip();
}
}
示例10: GetMusicDirs
void MusikScanNewThread::GetMusicDirs( const wxArrayString & aDirs, wxArrayString & aFiles )
{
aFiles.Clear();
if ( aDirs.GetCount() > 0 )
{
wxString sCurrPath;
wxCommandEvent evtSetTotalFiles ( wxEVT_COMMAND_MENU_SELECTED, MUSIK_LIBRARY_THREAD_PROG );
evtSetTotalFiles.SetInt(SET_TOTAL);
wxCommandEvent ScanNewProgEvt ( wxEVT_COMMAND_MENU_SELECTED, MUSIK_LIBRARY_THREAD_PROG );
ScanNewProgEvt.SetInt(SET_CURRENT);
wxCommandEvent evtSetNewFiles ( wxEVT_COMMAND_MENU_SELECTED, MUSIK_LIBRARY_THREAD_PROG );
evtSetNewFiles.SetInt(SET_NEW);
for ( size_t i = 0; i < aDirs.GetCount(); i++ )
{
if ( TestDestroy() )
break;
else
{
//--- get directory ---//
int nLastCount = aFiles.GetCount();
GetMusicDir( aDirs[i], aFiles );
//--- do math ---//
int nTotal = aFiles.GetCount() - nLastCount;
evtSetTotalFiles.SetExtraLong( nTotal );
wxPostEvent( Parent(), evtSetTotalFiles );
int nCompare = wxGetApp().Library.GetSongDirCount( sCurrPath );
int nResult = nTotal - nCompare;
//--- post update progress event ---//
evtSetNewFiles.SetExtraLong( nResult );
wxPostEvent( Parent(), evtSetNewFiles );
ScanNewProgEvt.SetExtraLong(i);
wxPostEvent( Parent(), ScanNewProgEvt );
}
}
}
}
示例11: EnumTables
bool wxMySQL::EnumTables(wxArrayString & array, wxString wildchar)
{
MYSQL_RES * res = mysql_list_tables(m_pDB, wildchar);
MYSQL_ROW row;
bool success(true);
array.Clear();
do
{
if(!res)
{
success = false;
break;
}
while(row = mysql_fetch_row(res)) array.Add(row[0]);
mysql_free_result(res);
}
while(false);
m_LastErrorMessage = mysql_error(m_pDB);
return success;
}
示例12: GetInfo
void CMusikLibrary::GetInfo( const wxArrayString & aList, const PlaylistColumn & ColumnIn, const PlaylistColumn & ColumnOut ,wxArrayString & aReturn, bool bSorted )
{
aReturn.Clear();
wxString sInfo;
wxString query;
query.Alloc(50 * aList.GetCount()+ 40);
wxString sColumnOut(wxString::Format(ColumnOut.ColQueryMask,ColumnOut.DBName.c_str()));
sColumnOut += wxT(" as OutColumn ");
if(bSorted)
{
if( wxGetApp().Prefs.bSortArtistWithoutPrefix && ColumnOut.SortOrder == PlaylistColumn::SortNoCaseNoPrefix)
query << wxT("select distinct ") << sColumnOut << wxT(",REMPREFIX(") << sColumnOut << wxT(") as RPF from songs where ");
else
query = wxT("select distinct ") + sColumnOut + wxT(" from songs where ");
}
else
query = wxT("select distinct ") + sColumnOut + wxT(" from songs where ");
_Add_IN_ClauseForColumn(query,ColumnIn,aList);
if(bSorted)
{
switch ( ColumnOut.SortOrder )
{
case PlaylistColumn::SortNoCase:
case PlaylistColumn::SortNoCaseNoPrefix:
query += (wxGetApp().Prefs.bSortArtistWithoutPrefix) ? wxT(" order by RPF collate nocase")
: wxT(" order by OutColumn collate nocase");
break;
case PlaylistColumn::SortCase:
query += wxT(" order by OutColumn");
break;
case PlaylistColumn::SortNone:
break;
}
}
query << wxT(';');
Query(query,aReturn,false);
}
示例13: GetEncodings
void AssStyle::GetEncodings(wxArrayString &encodingStrings) {
encodingStrings.Clear();
encodingStrings.Add(wxString("0 - ") + _("ANSI"));
encodingStrings.Add(wxString("1 - ") + _("Default"));
encodingStrings.Add(wxString("2 - ") + _("Symbol"));
encodingStrings.Add(wxString("77 - ") + _("Mac"));
encodingStrings.Add(wxString("128 - ") + _("Shift_JIS"));
encodingStrings.Add(wxString("129 - ") + _("Hangeul"));
encodingStrings.Add(wxString("130 - ") + _("Johab"));
encodingStrings.Add(wxString("134 - ") + _("GB2312"));
encodingStrings.Add(wxString("136 - ") + _("Chinese BIG5"));
encodingStrings.Add(wxString("161 - ") + _("Greek"));
encodingStrings.Add(wxString("162 - ") + _("Turkish"));
encodingStrings.Add(wxString("163 - ") + _("Vietnamese"));
encodingStrings.Add(wxString("177 - ") + _("Hebrew"));
encodingStrings.Add(wxString("178 - ") + _("Arabic"));
encodingStrings.Add(wxString("186 - ") + _("Baltic"));
encodingStrings.Add(wxString("204 - ") + _("Russian"));
encodingStrings.Add(wxString("222 - ") + _("Thai"));
encodingStrings.Add(wxString("238 - ") + _("East European"));
encodingStrings.Add(wxString("255 - ") + _("OEM"));
}
示例14: DoSrv
// Do serv sends the command back to the script server function,
// and creates a list of response lines to be sent.
int DoSrv( char * pIn )
{
wxString Str1(pIn);
Str1.Replace("\r","");
Str1.Replace("\n","");
(*pScriptServerFn)( &Str2, &Str1 );
int l = Str2.Length();
Str2+= '\n';
aStr.Clear();
iSent = -1;
int iStart = 0;
int i;
for(i=0;i<=l;i++)
{
if( Str2[i] == '\n' )
{
aStr.Add( Str2.Mid( iStart, i-iStart) );
iStart = i+1;
}
}
// wxLogDebug("Added %i Strings", aStr.GetCount());
return 1;
}
示例15: Execute
/*! \brief Run the dialogue.
*
* \param aItems wxArrayString&
* \return bool
*
*/
bool wxsImageTreeEditorDlg::Execute(wxArrayString &aItems)
{
int i, n;
int jv, j1, j2, j3, j4;
wxColor jc;
bool jb;
wxString jt;
wxTreeItemId jp[32];
wxString ss, tt;
wxTreeItemId root;
wxTreeItemId item;
wxBitmap bmp;
wxsImageList *ilist;
// get name of combo-box and image-list
n = aItems.GetCount();
m_sTreeName = _("<unknown>");
m_sImageName = _("<none>");
if(n >= 1){
m_sTreeName = aItems.Item(0);
}
if(n >= 2){
m_sImageName = aItems.Item(1);
}
// show the names
ss = _("Tree Control: ") + m_sTreeName;
StaticBoxSizer1->GetStaticBox()->SetLabel(ss);
ss = m_sImageName;
StaticText13->SetLabel(ss);
// clear old junk
Tree1->DeleteAllItems();
// a valid image-list given?
m_imageList.RemoveAll();
ilist = (wxsImageList *) wxsImageListEditorDlg::FindTool(NULL, m_sImageName);
if(ilist != NULL){
ilist->GetImageList(m_imageList);
}
SetImageList(m_imageList);
// add all the new items
n = aItems.GetCount();
for(i = 2; i < n; i++){
ss = aItems.Item(i);
ParseTreeItem(ss, jv, jc, jb, j1, j2, j3, j4, jt);
if(jv == 0){
item = Tree1->AddRoot(jt);
}
else{
item = Tree1->AppendItem(jp[jv-1], jt);
}
jp[jv] = item;
if(jc.IsOk()){
Tree1->SetItemTextColour(item, jc);
}
Tree1->SetItemBold(item, jb);
Tree1->SetItemImage(item, j1, wxTreeItemIcon_Normal);
Tree1->SetItemImage(item, j2, wxTreeItemIcon_Selected);
Tree1->SetItemImage(item, j3, wxTreeItemIcon_Expanded);
Tree1->SetItemImage(item, j4, wxTreeItemIcon_SelectedExpanded);
}
Tree1->ExpandAll();
// show the dialog and wait for a response
n = ShowModal();
// save all new stuff?
if(n == wxOK){
// must save combo-box name and image-list name
aItems.Clear();
aItems.Add(m_sTreeName);
aItems.Add(m_sImageName);
// save the root item and all it's children
// this effectively saves every item in the tree
// I wanted to use a simple loop here, but it works MUCH easier with a recursive function
root = Tree1->GetRootItem();
if(root.IsOk()){
EncodeTreeItems(root, 0, aItems);
}
}
// done
return (n == wxOK);
}