本文整理汇总了C++中wxSortedArrayString类的典型用法代码示例。如果您正苦于以下问题:C++ wxSortedArrayString类的具体用法?C++ wxSortedArrayString怎么用?C++ wxSortedArrayString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxSortedArrayString类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AddNewItem
bool ThreadSearchThread::AddNewItem(wxSortedArrayString& sortedArrayString, const wxString& newItem, const wxArrayString& mask)
{
// Adds item to array only if it does not exist
bool added = false;
if ( sortedArrayString.Index(newItem.c_str()) == wxNOT_FOUND )
{
// Looks if current file matches one of the file patterns
size_t maskCount = mask.GetCount();
if (maskCount == 0)
{
sortedArrayString.Add(newItem);
added = true;
}
else
{
for (size_t i = 0; i < maskCount; ++i)
{
if ( newItem.Matches(mask[i].c_str() ) )
{
sortedArrayString.Add(newItem);
added = true;
break;
}
}
}
}
return added;
}
开发者ID:obfuscated,项目名称:codeblocks_sf,代码行数:28,代码来源:ThreadSearchThread.cpp
示例2: LoadLadspaEffect
static void LoadLadspaEffect(wxSortedArrayString &uniq, wxString fname,
DL_Array &dls)
{
wxLogNull logNo;
LADSPA_Descriptor_Function mainFn = NULL;
// Since we now have builtin VST support, ignore the VST bridge as it
// causes duplicate menu entries to appear.
wxFileName f(fname);
if (f.GetName().CmpNoCase(wxT("vst-bridge")) == 0) {
return;
}
// As a courtesy to some plug-ins that might be bridges to
// open other plug-ins, we set the current working
// directory to be the plug-in's directory.
wxString saveOldCWD = ::wxGetCwd();
wxString prefix = ::wxPathOnly(fname);
::wxSetWorkingDirectory(prefix);
wxDynamicLibrary* pDLL = new wxDynamicLibrary();
dls.push_back(pDLL);
if (pDLL && pDLL->Load(fname, wxDL_LAZY)) {
mainFn = (LADSPA_Descriptor_Function)(pDLL->GetSymbol(wxT(descriptorFnName)));
}
if (mainFn) {
int index = 0;
const LADSPA_Descriptor *data;
data = mainFn(index);
while(data) {
wxString uniqid = wxString::Format(wxT("%08x-%s"), data->UniqueID, LAT1CTOWX(data->Label).c_str());
if (uniq.Index(uniqid) == wxNOT_FOUND) {
uniq.Add(uniqid);
std::set<wxString> categories;
#if defined(USE_LIBLRDF) && defined(EFFECT_CATEGORIES)
std::multimap<unsigned long, wxString>::const_iterator iter;
iter = gPluginCategories.lower_bound(data->UniqueID);
for ( ; (iter != gPluginCategories.end() &&
iter->first == data->UniqueID); ++iter)
categories.insert(iter->second);
#endif
LadspaEffect *effect = new LadspaEffect(data, categories);
EffectManager::Get().RegisterEffect(effect);
}
// Get next plugin
index++;
data = mainFn(index);
}
}
::wxSetWorkingDirectory(saveOldCWD);
}
开发者ID:Cactuslegs,项目名称:audacity-of-nope,代码行数:59,代码来源:LoadLadspa.cpp
示例3: strutil_uniq_array
// this works for any strings, not only addresses: the variable names are just
// left overs
wxArrayString strutil_uniq_array(const wxSortedArrayString& addrSorted)
{
wxArrayString addresses;
wxString addr;
size_t count = addrSorted.GetCount();
for ( size_t n = 0; n < count; n++ )
{
if ( addrSorted[n] != addr )
{
// add the address we had before (if we did) to the list
if ( !addr.empty() )
{
addresses.Add(addr);
}
// and remeber it to avoid adding it more than once
addr = addrSorted[n];
}
//else: another copy, just skip
}
if ( !addr.empty() )
{
// don't forget to add the last one which we don't have yet
addresses.Add(addr);
}
return addresses;
}
开发者ID:vadz,项目名称:mahogany,代码行数:31,代码来源:strutil.cpp
示例4:
/* static */
wxArrayString
ItemContainerWidgetsPage::MakeArray(const wxSortedArrayString& sorted)
{
wxArrayString a;
const size_t count = sorted.size();
a.reserve(count);
for ( size_t n = 0; n < count; n++ )
a.push_back(sorted[n]);
return a;
}
开发者ID:ruifig,项目名称:nutcracker,代码行数:13,代码来源:itemcontainer.cpp
示例5: wxConfig
void CDVRPTRClientApp::setRpt2Calls(const wxString& call, const wxSortedArrayString& list) const
{
wxConfigBase* profile = new wxConfig(APPLICATION_NAME);
wxASSERT(profile != NULL);
// Convert the array into a comma delimited list
wxString temp;
size_t count = list.GetCount();
for (unsigned int i = 0U; i < count; i++) {
temp += list.Item(i);
temp += wxT(',');
}
profile->Write(KEY_RPT2_CALL, call);
profile->Write(KEY_RPT2_LIST, temp);
profile->Flush();
wxLogInfo(wxT("RPT2 call set to %s"), call.c_str());
wxLogInfo(wxT("RPT2 list set to %s"), temp.c_str());
delete profile;
}
开发者ID:KH6VM,项目名称:OpenSystemFusion,代码行数:22,代码来源:DVRPTRClientApp.cpp
示例6: tokens
void CDVRPTRClientApp::getRpt2Calls(wxString& call, wxSortedArrayString& list) const
{
wxConfigBase* profile = new wxConfig(APPLICATION_NAME);
wxASSERT(profile != NULL);
wxString temp;
profile->Read(KEY_RPT2_CALL, &call, DEFAULT_RPT2_CALL);
profile->Read(KEY_RPT2_LIST, &temp, DEFAULT_RPT2_LIST);
wxLogInfo(wxT("RPT2 call set to %s"), call.c_str());
wxLogInfo(wxT("RPT2 list set to %s"), temp.c_str());
// Convert the comma delimited list to an array
list.Clear();
wxStringTokenizer tokens(temp, wxT(","));
while (tokens.HasMoreTokens()) {
wxString item = tokens.GetNextToken();
if (!item.IsEmpty())
list.Add(item);
}
delete profile;
}
开发者ID:KH6VM,项目名称:OpenSystemFusion,代码行数:24,代码来源:DVRPTRClientApp.cpp
示例7: DumpTable
wxString wxLuaCheckStack::DumpTable(int stack_idx, const wxString& tablename, const wxString& msg, wxSortedArrayString& tableArray, int indent)
{
wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));
lua_State* L = m_luaState;
wxLuaState wxlState(L);
wxString indentStr;
wxString s;
// We only do tables, return error message
if (!lua_istable(L, stack_idx))
{
s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) stack idx %d is not a table.\n"), L, stack_idx);
OutputMsg(s);
return s;
}
if (indent == 0)
{
// First time through print header
s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s'\n"), L, tablename.c_str());
OutputMsg(s);
}
else if (indent > 10)
{
// Don't let things get out of hand...
s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table depth > 10! Truncating: '%s'\n"), L, tablename.c_str());
OutputMsg(s);
return s;
}
else
{
indentStr = wxString(wxT(' '), indent*2) + wxT(">");
}
wxString title = wxString::Format(wxT("%sTable Level %d : name '%s'\n"), indentStr.c_str(), indent, tablename.c_str());
s += title;
OutputMsg(title);
lua_pushvalue(L, stack_idx); // push the table to read the top of the stack
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
int keyType = 0, valueType = 0;
wxString key, value;
wxLuaDebugData::GetTypeValue(L, -2, &keyType, key);
wxLuaDebugData::GetTypeValue(L, -1, &valueType, value);
wxString info = wxString::Format(wxT("%s%-32s\t%-16s\t%-20s\t%-16s\n"),
indentStr.c_str(), key.c_str(), wxluaT_typename(L, keyType).c_str(), value.c_str(), wxluaT_typename(L, valueType).c_str());
s += info;
OutputMsg(info);
if (tableArray.Index(value) == wxNOT_FOUND)
{
if (valueType == WXLUA_TTABLE)
{
tableArray.Add(value);
s += DumpTable(lua_gettop(L), tablename + wxT(".") + key, msg, tableArray, indent+1);
}
else
{
tableArray.Add(value);
}
}
lua_pop(L, 1); // pop value
}
lua_pop(L, 1); // pop pushed table
return s;
}
开发者ID:oeuftete,项目名称:wx-xword,代码行数:75,代码来源:wxldebug.cpp
示例8: ListBenchmarks
bool BenchApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
if ( parser.Found(OPTION_LIST) )
{
ListBenchmarks();
return false;
}
const size_t count = parser.GetParamCount();
if ( !count )
{
parser.Usage();
ListBenchmarks();
return false;
}
bool numRunsSpecified = false;
if ( parser.Found(OPTION_AVG_COUNT, &m_avgCount) )
numRunsSpecified = true;
if ( parser.Found(OPTION_NUM_RUNS, &m_numRuns) )
numRunsSpecified = true;
parser.Found(OPTION_NUMERIC_PARAM, &m_numParam);
parser.Found(OPTION_STRING_PARAM, &m_strParam);
if ( parser.Found(OPTION_SINGLE) )
{
if ( numRunsSpecified )
{
wxFprintf(stderr, "Incompatible options specified.\n");
return false;
}
m_avgCount =
m_numRuns = 1;
}
// construct sorted array for quick verification of benchmark names
wxSortedArrayString benchmarks;
for ( Bench::Function *func = Bench::Function::GetFirst();
func;
func = func->GetNext() )
{
benchmarks.push_back(func->GetName());
}
for ( size_t n = 0; n < count; n++ )
{
const wxString name = parser.GetParam(n);
if ( benchmarks.Index(name) == wxNOT_FOUND )
{
wxFprintf(stderr, "No benchmark named \"%s\".\n", name);
return false;
}
m_toRun.push_back(name);
}
return BenchAppBase::OnCmdLineParsed(parser);
}
开发者ID:euler0,项目名称:Helium,代码行数:62,代码来源:bench.cpp
示例9: Check
MFolder *MFolderCache::Get(const String& name)
{
Check();
int index = ms_aFolderNames.Index(name);
return index == wxNOT_FOUND ? NULL : ms_aFolders[(size_t)index];
}
开发者ID:mark711,项目名称:mahogany,代码行数:7,代码来源:MFolder.cpp
示例10: Add
void MFolderCache::Add(MFolder *folder)
{
Check();
// the caller should verify that it's not already in the cache
ASSERT_MSG( ms_aFolders.Index(folder) == wxNOT_FOUND,
_T("can't add the folder to the cache - it's already there") );
size_t index = ms_aFolderNames.Add(folder->GetFullName());
ms_aFolders.Insert(folder, index);
}
开发者ID:mark711,项目名称:mahogany,代码行数:11,代码来源:MFolder.cpp
示例11: Remove
void MFolderCache::Remove(MFolder *folder)
{
Check();
// don't use name here - the folder might have been renamed
int index = ms_aFolders.Index(folder);
CHECK_RET( index != wxNOT_FOUND,
_T("can't remove folder from cache because it's not in it") );
ms_aFolderNames.RemoveAt((size_t)index);
ms_aFolders.RemoveAt((size_t)index);
}
开发者ID:mark711,项目名称:mahogany,代码行数:13,代码来源:MFolder.cpp
示例12: RenameAll
/* static */
void MFolderCache::RenameAll(const String& oldName, const String& newName)
{
int index = ms_aFolderNames.Index(oldName);
if ( index != wxNOT_FOUND )
{
size_t n = (size_t)index;
ms_aFolderNames[n] = newName;
MFolderFromProfile *folder = (MFolderFromProfile *)ms_aFolders[n];
folder->m_folderName = newName;
SafeDecRef(folder->m_profile);
folder->m_profile = Profile::CreateFolderProfile(newName);
}
}
开发者ID:mark711,项目名称:mahogany,代码行数:16,代码来源:MFolder.cpp
示例13: OnRun
int BenchApp::OnRun()
{
int rc = EXIT_SUCCESS;
for ( Bench::Function *func = Bench::Function::GetFirst();
func;
func = func->GetNext() )
{
if ( m_toRun.Index(func->GetName()) == wxNOT_FOUND )
continue;
wxString params;
if ( m_numParam )
params += wxString::Format(" with N=%ld", m_numParam);
if ( !m_strParam.empty() )
{
if ( !params.empty() )
params += " and";
params += wxString::Format(" with s=\"%s\"", m_strParam);
}
wxPrintf("Benchmarking %s%s: ", func->GetName(), params);
long timeMin = LONG_MAX,
timeMax = 0,
timeTotal = 0;
bool ok = func->Init();
for ( long a = 0; ok && a < m_avgCount; a++ )
{
wxStopWatch sw;
for ( long n = 0; n < m_numRuns && ok; n++ )
{
ok = func->Run();
}
sw.Pause();
const long t = sw.Time();
if ( t < timeMin )
timeMin = t;
if ( t > timeMax )
timeMax = t;
timeTotal += t;
}
func->Done();
if ( !ok )
{
wxPrintf("ERROR\n");
rc = EXIT_FAILURE;
}
else
{
wxPrintf("%ldms total, ", timeTotal);
long times = m_avgCount;
if ( m_avgCount > 2 )
{
timeTotal -= timeMin + timeMax;
times -= 2;
}
wxPrintf("%.2f avg (min=%ld, max=%ld)\n",
(float)timeTotal / times, timeMin, timeMax);
}
}
return rc;
}
开发者ID:euler0,项目名称:Helium,代码行数:69,代码来源:bench.cpp
注:本文中的wxSortedArrayString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论