本文整理汇总了C++中wxArrayString::Index方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayString::Index方法的具体用法?C++ wxArrayString::Index怎么用?C++ wxArrayString::Index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayString
的用法示例。
在下文中一共展示了wxArrayString::Index方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadImplements
void PHPSourceFile::ReadImplements(wxArrayString& impls)
{
wxString type;
phpLexerToken token;
while(NextToken(token)) {
switch(token.type) {
case kPHP_T_IDENTIFIER:
case kPHP_T_NS_SEPARATOR:
type << token.text;
break;
case ',':
// More to come
if(!type.IsEmpty()) {
wxString fullyQualifiedType = MakeIdentifierAbsolute(type);
if(impls.Index(fullyQualifiedType) == wxNOT_FOUND) {
impls.Add(fullyQualifiedType);
}
type.clear();
}
break;
default:
// unexpected token
if(!type.IsEmpty()) {
wxString fullyQualifiedType = MakeIdentifierAbsolute(type);
if(impls.Index(fullyQualifiedType) == wxNOT_FOUND) {
impls.Add(fullyQualifiedType);
}
type.clear();
}
UngetToken(token);
return;
}
}
}
示例2:
/**
* @brief Construye y muestra una ventana para seleccionar multiples opciones de una lista de posibles
*
* Recibe una lista de posibles opciones y un cuadro de texto, arma una ventana
* con una lista de checks para las opciones, marca las que estaban presentes
* en el cuadro de texto, y si el usuario presiona aceptar actualiza el contenido
* del cuadro de texto. La ventana se ejecuta directamente en este constructor.
*
* @param parent ventana padre, para hacerlo modal
* @param title titulo de la ventana
* @param message texto para mostrar sobre la lista de checks
* @param text control de texto de donde tomar las opciones seleccionadas y donde guardar el resultado
* @param options_array lista de opciones posibles
* @param comma_splits indica si la coma separa opciones en el cuadro de texto, para pasar a mxUtils::Split
**/
mxMultipleChoiceEditor::mxMultipleChoiceEditor(wxWindow *parent, wxString title, wxString message, wxTextCtrl *text, wxArrayString &options_array, bool comma_splits) {
if (last_multiple_choice_editor) delete last_multiple_choice_editor;
last_multiple_choice_editor=this;
wxArrayString splitted_array;
wxArrayInt selection;
mxUT::Split(text->GetValue(),splitted_array,comma_splits,true);
options_array.Sort();
int p=options_array.Index("all");
if (p!=wxNOT_FOUND) {
for (unsigned int i=0;i<splitted_array.GetCount();i++)
selection.Add(p);
} else {
for (unsigned int i=0;i<splitted_array.GetCount();i++) {
p=options_array.Index(splitted_array[i]);
if (p!=wxNOT_FOUND) selection.Add(p);
}
}
if (wxGetMultipleChoices(selection,message,title,options_array,parent)>=0) {
wxString res;
if (selection.GetCount()) {
if (options_array[selection[0]].Contains(wxChar(' ')))
res=wxString("\"")<<options_array[selection[0]]<<"\"";
else
res=options_array[selection[0]];
for (unsigned int i=1;i<selection.GetCount();i++) {
if (options_array[selection[i]].Contains(wxChar(' ')))
res<<" \""<<options_array[selection[i]]<<"\"";
else
res<<" "<<options_array[selection[i]];
}
}
text->SetValue(res);
}
}
示例3: ReadCommaSeparatedIdentifiers
bool PHPSourceFile::ReadCommaSeparatedIdentifiers(int delim, wxArrayString& list)
{
phpLexerToken token;
wxString temp;
while(NextToken(token)) {
if(token.IsAnyComment()) continue;
if(token.type == delim) {
if(!temp.IsEmpty() && list.Index(temp) == wxNOT_FOUND) {
list.Add(MakeIdentifierAbsolute(temp));
}
UngetToken(token);
return true;
}
switch(token.type) {
case ',':
if(list.Index(temp) == wxNOT_FOUND) {
list.Add(MakeIdentifierAbsolute(temp));
}
temp.clear();
break;
default:
temp << token.text;
break;
}
}
return false;
}
示例4: MakeNameUnique
void ExportMultiple::MakeNameUnique(wxArrayString &otherNames, wxString &newName)
{
if (otherNames.Index(newName, false) >= 0) {
int i=2;
wxString orig = newName;
do {
newName.Printf(wxT("%s-%d"), orig.c_str(), i);
i++;
} while (otherNames.Index(newName, false) >= 0);
}
otherNames.Add(newName);
}
示例5: MakeNameUnique
// originally an ExportMultiple method. Append suffix if newName appears in otherNames.
void FileNames::MakeNameUnique(wxArrayString &otherNames, wxFileName &newName)
{
if (otherNames.Index(newName.GetFullName(), false) >= 0) {
int i=2;
wxString orig = newName.GetName();
do {
newName.SetName(wxString::Format(wxT("%s-%d"), orig.c_str(), i));
i++;
} while (otherNames.Index(newName.GetFullName(), false) >= 0);
}
otherNames.Add(newName.GetFullName());
}
示例6: FindFilesInXML
// find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
void wxcXmlResourceCmp::FindFilesInXML(wxXmlNode* node, wxArrayString& flist, const wxString& inputPath)
{
// Is 'node' XML node element?
if(node == NULL) return;
if(node->GetType() != wxXML_ELEMENT_NODE) return;
bool containsFilename = NodeContainsFilename(node);
wxXmlNode* n = node->GetChildren();
while(n) {
if(containsFilename && (n->GetType() == wxXML_TEXT_NODE || n->GetType() == wxXML_CDATA_SECTION_NODE)) {
wxString fullname;
if(wxIsAbsolutePath(n->GetContent()) || inputPath.empty())
fullname = n->GetContent();
else
fullname = inputPath + wxFILE_SEP_PATH + n->GetContent();
wxString filename = GetInternalFileName(n->GetContent(), flist);
n->SetContent(filename);
if(flist.Index(filename) == wxNOT_FOUND) flist.Add(filename);
wxFileInputStream sin(fullname);
wxFileOutputStream sout(m_outputPath + wxFILE_SEP_PATH + filename);
sin.Read(sout); // copy the stream
}
// subnodes:
if(n->GetType() == wxXML_ELEMENT_NODE) FindFilesInXML(n, flist, inputPath);
n = n->GetNext();
}
}
示例7: refresh_rows
void main_listctrl::refresh_rows( wxArrayString& channel_sections )
{
size_t number_of_sections = channel_sections.GetCount();
wxString channel_section;
long row_number = -1; // '-1' needed to include the first selected row.
if ( number_of_sections == 0 )
{
return;
}
for ( ;; )
{
row_number = GetNextItem( row_number, wxLIST_NEXT_ALL );
if ( row_number == -1 )
{
break;
}
channel_section = get_row_channel_section( row_number );
// Only proceed if the current channel section was in our array
if ( channel_sections.Index( channel_section ) != wxNOT_FOUND )
{
refresh_row( row_number );
}
}
}
示例8: GetLibNicknames
size_t SCH_SCREENS::GetLibNicknames( wxArrayString& aLibNicknames )
{
SCH_COMPONENT* symbol;
SCH_ITEM* item;
SCH_ITEM* nextItem;
SCH_SCREEN* screen;
wxString nickname;
for( screen = GetFirst(); screen; screen = GetNext() )
{
for( item = screen->GetDrawItems(); item; item = nextItem )
{
nextItem = item->Next();
if( item->Type() != SCH_COMPONENT_T )
continue;
symbol = dynamic_cast< SCH_COMPONENT* >( item );
wxASSERT( symbol );
nickname = symbol->GetLibId().GetLibNickname();
if( !nickname.empty() && ( aLibNicknames.Index( nickname ) == wxNOT_FOUND ) )
aLibNicknames.Add( nickname );;
}
}
return aLibNicknames.GetCount();
}
示例9: GetOption
wxString wxSystemOptions::GetOption(const wxString& name)
{
wxString val;
int idx = gs_optionNames.Index(name, false);
if ( idx != wxNOT_FOUND )
{
val = gs_optionValues[idx];
}
else // not set explicitly
{
// look in the environment: first for a variable named "wx_appname_name"
// which can be set to affect the behaviour or just this application
// and then for "wx_name" which can be set to change the option globally
wxString var(name);
var.Replace(wxT("."), wxT("_")); // '.'s not allowed in env var names
var.Replace(wxT("-"), wxT("_")); // and neither are '-'s
wxString appname;
if ( wxTheApp )
appname = wxTheApp->GetAppName();
if ( !appname.empty() )
val = wxGetenv(wxT("wx_") + appname + wxT('_') + var);
if ( val.empty() )
val = wxGetenv(wxT("wx_") + var);
}
return val;
}
示例10: HasOption
bool ProjectOptionsManipulator::HasOption(const wxArrayString& opt_array, const wxString& opt, wxString& full_opt)
{
switch ( m_Dlg->GetSearchOption() )
{
case (ProjectOptionsManipulatorDlg::eContains):
{
for (size_t i=0; i<opt_array.Count(); ++i)
{
if ( opt_array.Item(i).Contains(opt) )
{
full_opt = opt_array.Item(i);
return true;
}
}
}
break;
case (ProjectOptionsManipulatorDlg::eEquals): // fall through
default:
{
int idx = opt_array.Index(opt);
if (idx!=wxNOT_FOUND)
{
full_opt = opt_array.Item(idx);
return true;
}
}
break;
}
return false;
}
示例11:
GameDatabaseListView& GameDatabaseListView::AddGame( const wxString& serial )
{
if (m_GamesInView.Index( serial, false ) != wxNOT_FOUND) return *this;
m_GamesInView.Add( serial );
return *this;
}
示例12: AddTypeToPredefined
void AddTypeToPredefined( wxListBox *WxListBoxAssociated,
wxListBox *WxListBoxPredefined,
const wxArrayString &as )
{
int idx = 0;
const int count = int( as.Count() );
wxString type;
while( idx < count )
{
type = as[idx];
int n = WxListBoxAssociated->FindString( type );
if( n != wxNOT_FOUND ) { WxListBoxAssociated->Delete( n ); }
n = WxListBoxPredefined->FindString( type );
if( n == wxNOT_FOUND ) { WxListBoxPredefined->Append( type ); }
n = as_remove.Index( type );
if( n == wxNOT_FOUND ) { as_remove.Add( type ); }
++idx;
}
}
示例13: GetAddToolbarCode
void PHPCodeGenerator::GetAddToolbarCode( PObjectInfo info, PObjectBase obj, wxArrayString& codelines )
{
wxString _template;
PCodeInfo code_info = info->GetCodeInfo( wxT( "PHP" ) );
if ( !code_info )
return;
_template = code_info->GetTemplate( wxT( "toolbar_add" ) );
if ( !_template.empty() )
{
PHPTemplateParser parser( obj, _template, m_i18n, m_useRelativePath, m_basePath );
wxString code = parser.ParseTemplate();
if ( !code.empty() )
{
if( codelines.Index( code ) == wxNOT_FOUND ) codelines.Add( code );
}
}
// Proceeding recursively with the base classes
for ( unsigned int i = 0; i < info->GetBaseClassCount(); i++ )
{
PObjectInfo base_info = info->GetBaseClass( i );
GetAddToolbarCode( base_info, obj, codelines );
}
}
示例14: DoRefreshItemRecursively
void DebuggerTreeListCtrlBase::DoRefreshItemRecursively(IDebugger *dbgr, const wxTreeItemId &item, wxArrayString &itemsToRefresh)
{
if(itemsToRefresh.IsEmpty())
return;
wxTreeItemIdValue cookieOne;
wxTreeItemId exprItem = m_listTable->GetFirstChild(item, cookieOne);
while( exprItem.IsOk() ) {
DbgTreeItemData* data = static_cast<DbgTreeItemData*>(m_listTable->GetItemData(exprItem));
if(data) {
int where = itemsToRefresh.Index(data->_gdbId);
if(where != wxNOT_FOUND) {
dbgr->EvaluateVariableObject(data->_gdbId, m_DBG_USERR);
m_gdbIdToTreeId[data->_gdbId] = exprItem;
itemsToRefresh.RemoveAt((size_t)where);
}
}
if(m_listTable->HasChildren(exprItem)) {
DoRefreshItemRecursively(dbgr, exprItem, itemsToRefresh);
}
exprItem = m_listTable->GetNextChild(item, cookieOne);
}
}
示例15: GetCategories
void CommandManager::GetCategories(wxArrayString &cats)
{
cats.Clear();
size_t cnt = mCommandList.GetCount();
for (size_t i = 0; i < cnt; i++) {
wxString cat = mCommandList[i]->labelTop;
if (cats.Index(cat) == wxNOT_FOUND) {
cats.Add(cat);
}
}
#if 0
mCommandList.GetCount(); i++) {
if (includeMultis || !mCommandList[i]->multi)
names.Add(mCommandList[i]->name);
}
AudacityProject *p = GetActiveProject();
if (p == NULL) {
return;
}
wxMenuBar *bar = p->GetMenuBar();
size_t cnt = bar->GetMenuCount();
for (size_t i = 0; i < cnt; i++) {
cats.Add(bar->GetMenuLabelText(i));
}
cats.Add(COMMAND);
#endif
}