本文整理汇总了C++中wxArrayString::end方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayString::end方法的具体用法?C++ wxArrayString::end怎么用?C++ wxArrayString::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayString
的用法示例。
在下文中一共展示了wxArrayString::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseArguments
bool vvCommitCommand::ParseArguments(
const wxArrayString& cArguments
)
{
// make sure we got at least one path
if (cArguments.Count() < 1u)
{
wxLogError("No path(s) specified to commit from.");
return false;
}
// store the given paths
for (wxArrayString::const_iterator it = cArguments.begin(); it != cArguments.end(); ++it)
{
this->mcAbsolutePaths.Add(*it);
}
// success
return true;
}
示例2: CopyFiles
void ModEditWindow::CopyFiles(wxWindow *window, wxArrayString files, wxString destDir)
{
for (wxArrayString::const_iterator iter = files.begin(); iter != files.end(); ++iter)
{
wxFileName source (*iter);
wxString fileName = source.GetFullName();
wxFileName dest(Path::Combine(destDir, fileName));
if (wxFileName::DirExists(*iter))
{
// TODO make the file copy task copy the file list all in one go.
FileCopyTask *task = new FileCopyTask(*iter, dest.GetFullPath());
TaskProgressDialog dlg(window);
dlg.ShowModal(task);
delete task;
}
else
{
wxCopyFile(*iter, dest.GetFullPath());
}
}
}
示例3: wxSplitPath
// this function is used to properly interpret '..' in path
void wxSplitPath(wxArrayString& aParts, const wxString& path)
{
aParts.clear();
wxString strCurrent;
wxString::const_iterator pc = path.begin();
for ( ;; ) {
if ( pc == path.end() || *pc == wxCONFIG_PATH_SEPARATOR ) {
if ( strCurrent == wxT(".") ) {
// ignore
}
else if ( strCurrent == wxT("..") ) {
// go up one level
if ( aParts.size() == 0 )
{
wxLogWarning(_("'%s' has extra '..', ignored."), path);
}
else
{
aParts.erase(aParts.end() - 1);
}
strCurrent.Empty();
}
else if ( !strCurrent.empty() ) {
aParts.push_back(strCurrent);
strCurrent.Empty();
}
//else:
// could log an error here, but we prefer to ignore extra '/'
if ( pc == path.end() )
break;
}
else
strCurrent += *pc;
++pc;
}
}
示例4: wxSplit
wxArrayString
wxGridCellAutoWrapStringRenderer::GetTextLines(wxGrid& grid,
wxDC& dc,
const wxGridCellAttr& attr,
const wxRect& rect,
int row, int col)
{
dc.SetFont(attr.GetFont());
const wxCoord maxWidth = rect.GetWidth();
// Transform logical lines into physical ones, wrapping the longer ones.
const wxArrayString
logicalLines = wxSplit(grid.GetCellValue(row, col), '\n', '\0');
// Trying to do anything if the column is hidden anyhow doesn't make sense
// and we run into problems in BreakLine() in this case.
if ( maxWidth <= 0 )
return logicalLines;
wxArrayString physicalLines;
for ( wxArrayString::const_iterator it = logicalLines.begin();
it != logicalLines.end();
++it )
{
const wxString& line = *it;
if ( dc.GetTextExtent(line).x > maxWidth )
{
// Line does not fit, break it up.
BreakLine(dc, line, maxWidth, physicalLines);
}
else // The entire line fits as is
{
physicalLines.push_back(line);
}
}
return physicalLines;
}
示例5: wxSaveFileSelector
int wxSaveFileSelector(wxWindow* parent, wxFileName* fileName, const wxArrayString& extensions)
{
const wxString filter = wxJoin(extensions, wxT('|'), 0);
const wxString ext = wxString(wxT(".")) + fileName->GetExt();
wxString defaultPath = GetDefaultPath(*fileName);
wxString caption = wxGetStockLabelEx(wxID_SAVE, wxSTOCK_PLAINTEXT);
wxFileDialog fileDialog(parent, caption, defaultPath, fileName->GetFullName(), filter, wxFD_DEFAULT_STYLE_SAVE | wxFD_CHANGE_DIR);
if (!fileName->GetExt().empty())
for (wxArrayString::const_iterator it = extensions.begin(); it != extensions.end(); it++)
if (it->EndsWith(ext))
{
int index = (int)(it - extensions.begin());
fileDialog.SetFilterIndex(index);
break;
}
if (fileDialog.ShowModal() != wxID_OK)
return wxNOT_FOUND;
fileName->Assign(fileDialog.GetPath());
return fileDialog.GetFilterIndex();
}
示例6: modFileName
bool ModEditWindow::JarModsDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
{
int flags = wxLIST_HITTEST_ONITEM;
long index = 0;
if (m_owner->GetItemCount() > 0)
{
index = m_owner->HitTest(wxPoint(x, y), flags);
}
m_owner->SetInsertMark(-1);
for (wxArrayString::const_iterator iter = filenames.begin(); iter != filenames.end(); iter++)
{
wxFileName modFileName(*iter);
m_inst->GetModList()->InsertMod(index, modFileName.GetFullPath());
m_owner->UpdateItems();
}
return true;
}
示例7: MakePCHIfNeeded
void ClangUtils::MakePCHIfNeeded(const wxArrayString& tokens, const CXIndex& index)
{
// Copy the tokens
wxArrayString mytokens;
wxString pchfile;
mytokens.insert(mytokens.end(), tokens.begin(), tokens.end());
int where = mytokens.Index(wxT("-include-pch"));
if(where != wxNOT_FOUND) {
int pchfileIndex = where + 1;
if(mytokens.GetCount() > pchfileIndex) {
pchfile = mytokens.Item(pchfileIndex);
mytokens.RemoveAt(where, 2);
} else {
// Invalid tokens
// Found -include-pch but not the actual pch file...
return;
}
// At this point, pchfile contains the file that we should create for faster code-completion
// Now we simply test to see if this file exists
wxFileName filename(pchfile);
wxFileName filename_h(pchfile);
filename.SetExt(wxT("clang-pch"));
if(filename.FileExists()) {
return;
}
// We needed to create it...
}
}
示例8: wxExOpenFiles
void wxExOpenFiles(
wxExFrame* frame,
const wxArrayString& files,
long file_flags,
int dir_flags)
{
// std::vector gives compile error.
for (
#ifdef wxExUSE_CPP0X
auto it = files.begin();
#else
wxArrayString::const_iterator it = files.begin();
#endif
it != files.end();
it++)
{
wxString file = *it; // cannot be const because of file = later on
if (file.Contains("*") || file.Contains("?"))
{
wxExDirOpenFile dir(frame, wxGetCwd(), file, file_flags, dir_flags);
dir.FindFiles();
}
else
{
int line = 0;
if (!wxFileName(file).FileExists() && file.Contains(":"))
{
line = atoi(file.AfterFirst(':').c_str());
file = file.BeforeFirst(':');
}
frame->OpenFile(file, line, wxEmptyString, file_flags);
}
}
}
示例9:
GameDatabaseListView& GameDatabaseListView::SortBy( GameDataColumnId column )
{
const bool isDescending = false;
wxArrayString::iterator begin = m_GamesInView.begin();
wxArrayString::iterator end = m_GamesInView.end();
// Note: std::sort does not pass predicate instances by reference, which means we can't use
// object polymorphism to simplify the code below. --air
switch( column )
{
case GdbCol_Serial: std::sort(begin, end, GLSort_bySerial(isDescending)); break;
case GdbCol_Title: std::sort(begin, end, GLSort_byTitle(isDescending)); break;
case GdbCol_Region: std::sort(begin, end, GLSort_byRegion(isDescending)); break;
case GdbCol_Compat: std::sort(begin, end, GLSort_byCompat(isDescending)); break;
case GdbCol_Patches: std::sort(begin, end, GLSort_byPatches(isDescending)); break;
default: break; // for GdbCol_Count
}
//m_GamesInView.( );
return *this;
}
示例10: wxSplitPath
// this function is used to properly interpret '..' in path
void wxSplitPath(wxArrayString& aParts, const wxChar *sz)
{
aParts.clear();
wxString strCurrent;
const wxChar *pc = sz;
for ( ;; ) {
if ( *pc == wxT('\0') || *pc == wxCONFIG_PATH_SEPARATOR ) {
if ( strCurrent == wxT(".") ) {
// ignore
}
else if ( strCurrent == wxT("..") ) {
// go up one level
if ( aParts.size() == 0 )
wxLogWarning(_("'%s' has extra '..', ignored."), sz);
else
aParts.erase(aParts.end() - 1);
strCurrent.Empty();
}
else if ( !strCurrent.empty() ) {
aParts.push_back(strCurrent);
strCurrent.Empty();
}
//else:
// could log an error here, but we prefer to ignore extra '/'
if ( *pc == wxT('\0') )
break;
}
else
strCurrent += *pc;
pc++;
}
}
示例11: selection
FindInFilesDialog::FindInFilesDialog(wxWindow* parent,
const wxString& dataName,
const wxArrayString& additionalSearchPaths)
: FindInFilesDialogBase(parent, wxID_ANY)
{
m_data.SetName(dataName);
m_nonPersistentSearchPaths.insert(additionalSearchPaths.begin(), additionalSearchPaths.end());
// Store the find-in-files data
clConfig::Get().ReadItem(&m_data);
wxArrayString paths = m_data.GetSearchPaths();
wxStringSet_t persistentSearchPaths, d;
persistentSearchPaths.insert(m_data.GetSearchPaths().begin(), m_data.GetSearchPaths().end());
// Create a new set 'd' which contains the elements that appear in 'm_nonPersistentSearchPaths' but not in
// 'persistentSearchPaths' set
std::set_difference(m_nonPersistentSearchPaths.begin(),
m_nonPersistentSearchPaths.end(),
persistentSearchPaths.begin(),
persistentSearchPaths.end(),
std::inserter(d, d.end()));
m_nonPersistentSearchPaths.swap(d);
// At this point, m_nonPersistentSearchPaths contains list of paths that we should not persist
// Append them to the list of paths to search
std::for_each(m_nonPersistentSearchPaths.begin(), m_nonPersistentSearchPaths.end(), [&](const wxString& path) {
paths.Add(path);
});
DoAddSearchPaths(paths);
// Search for
m_findString->Clear();
m_findString->Append(m_data.GetFindStringArr());
m_findString->SetValue(m_data.GetFindString());
m_replaceString->Append(m_data.GetReplaceStringArr());
m_replaceString->SetValue(m_data.GetReplaceString());
m_fileTypes->SetSelection(0);
m_matchCase->SetValue(m_data.GetFlags() & wxFRD_MATCHCASE);
m_matchWholeWord->SetValue(m_data.GetFlags() & wxFRD_MATCHWHOLEWORD);
m_regualrExpression->SetValue(m_data.GetFlags() & wxFRD_REGULAREXPRESSION);
m_checkBoxSaveFilesBeforeSearching->SetValue(m_data.GetFlags() & wxFRD_SAVE_BEFORE_SEARCH);
m_checkBoxPipeForGrep->SetValue(m_data.GetFlags() & wxFRD_ENABLE_PIPE_SUPPORT);
// Set encoding
wxArrayString astrEncodings;
wxFontEncoding fontEnc;
int selection(0);
size_t iEncCnt = wxFontMapper::GetSupportedEncodingsCount();
for(size_t i = 0; i < iEncCnt; i++) {
fontEnc = wxFontMapper::GetEncoding(i);
if(wxFONTENCODING_SYSTEM == fontEnc) { // skip system, it is changed to UTF-8 in optionsconfig
continue;
}
wxString encodingName = wxFontMapper::GetEncodingName(fontEnc);
size_t pos = astrEncodings.Add(encodingName);
if(m_data.GetEncoding() == encodingName) {
selection = static_cast<int>(pos);
}
}
m_choiceEncoding->Append(astrEncodings);
if(m_choiceEncoding->IsEmpty() == false) {
m_choiceEncoding->SetSelection(selection);
}
// Set the file mask
DoSetFileMask();
SetName("FindInFilesDialog");
// Fit the initial size and set it as the default minimum size
GetSizer()->Fit(this);
SetMinSize(GetSize());
// Load the last size and position, but not on GTK
WindowAttrManager::Load(this);
CentreOnParent();
}
示例12: GetDefinitionsAndSearchPaths
bool CodeCompletionManager::GetDefinitionsAndSearchPaths(LEditor* editor,
wxArrayString& searchPaths,
wxArrayString& definitions)
{
// Sanity
CHECK_PTR_RET_FALSE(editor);
if(editor->GetProjectName().IsEmpty())
return false;
if(!WorkspaceST::Get()->IsOpen())
return false;
// Support only C/C++ files
if(!FileExtManager::IsCxxFile(editor->GetFileName().GetFullName()))
return false;
// Get the file's project and get the build configuration settings
// for it
ProjectPtr proj = WorkspaceST::Get()->GetProject(editor->GetProjectName());
CHECK_PTR_RET_FALSE(proj);
BuildConfigPtr buildConf = proj->GetBuildConfiguration();
CHECK_PTR_RET_FALSE(buildConf);
CompilerPtr compiler = buildConf->GetCompiler();
CHECK_PTR_RET_FALSE(compiler);
if(buildConf->IsCustomBuild()) {
// Custom builds are handled differently
CompilationDatabase compileDb;
compileDb.Open();
if(compileDb.IsOpened()) {
// we have compilation database for this workspace
wxString compileLine, cwd;
compileDb.CompilationLine(editor->GetFileName().GetFullPath(), compileLine, cwd);
CL_DEBUG("Pre Processor dimming: %s\n", compileLine);
CompilerCommandLineParser cclp(compileLine, cwd);
searchPaths = cclp.GetIncludes();
// get the mcros
definitions = cclp.GetMacros();
} else {
// we will probably will fail...
return false;
}
} else {
// get the include paths based on the project settings (this is per build configuration)
searchPaths = proj->GetIncludePaths();
CL_DEBUG("CxxPreProcessor will use the following include paths:");
CL_DEBUG_ARR(searchPaths);
// get the compiler include paths
// wxArrayString compileIncludePaths = compiler->GetDefaultIncludePaths();
// includePaths.insert(includePaths.end(), compileIncludePaths.begin(), compileIncludePaths.end());
definitions = proj->GetPreProcessors();
CL_DEBUG("CxxPreProcessor will use the following macros:");
CL_DEBUG_ARR(definitions);
}
// Append the compiler builtin macros
wxArrayString builtinMacros = compiler->GetBuiltinMacros();
definitions.insert(definitions.end(), builtinMacros.begin(), builtinMacros.end());
return true;
}
示例13: GetDefinitionsAndSearchPaths
bool CodeCompletionManager::GetDefinitionsAndSearchPaths(clEditor* editor, wxArrayString& searchPaths,
wxArrayString& definitions)
{
// Sanity
CHECK_PTR_RET_FALSE(editor);
if(editor->GetProjectName().IsEmpty()) return false;
if(!clCxxWorkspaceST::Get()->IsOpen()) return false;
// Support only C/C++ files
if(!FileExtManager::IsCxxFile(editor->GetFileName().GetFullName())) return false;
// Get the file's project and get the build configuration settings
// for it
ProjectPtr proj = clCxxWorkspaceST::Get()->GetProject(editor->GetProjectName());
CHECK_PTR_RET_FALSE(proj);
BuildConfigPtr buildConf = proj->GetBuildConfiguration();
CHECK_PTR_RET_FALSE(buildConf);
CompilerPtr compiler = buildConf->GetCompiler();
CHECK_PTR_RET_FALSE(compiler);
#if 0
if(buildConf->IsCustomBuild()) {
definitions = proj->GetPreProcessors();
CL_DEBUG("CxxPreProcessor will use the following macros:");
CL_DEBUG_ARR(definitions);
// Custom builds are handled differently
CompilationDatabase compileDb;
compileDb.Open();
if(compileDb.IsOpened()) {
// we have compilation database for this workspace
wxString compileLine, cwd;
compileDb.CompilationLine(editor->GetFileName().GetFullPath(), compileLine, cwd);
CL_DEBUG("Pre Processor dimming: %s\n", compileLine);
CompilerCommandLineParser cclp(compileLine, cwd);
searchPaths = cclp.GetIncludes();
// get the mcros
definitions << cclp.GetMacros();
}
}
#endif
// get the include paths based on the project settings (this is per build configuration)
searchPaths = proj->GetIncludePaths();
CL_DEBUG("CxxPreProcessor will use the following include paths:");
CL_DEBUG_ARR(searchPaths);
// get the compiler include paths
// wxArrayString compileIncludePaths = compiler->GetDefaultIncludePaths();
// includePaths.insert(includePaths.end(), compileIncludePaths.begin(), compileIncludePaths.end());
definitions = proj->GetPreProcessors();
// get macros out of workspace
wxString strWorkspaceMacros = clCxxWorkspaceST::Get()->GetParserMacros();
wxArrayString workspaceMacros = wxStringTokenize(strWorkspaceMacros, wxT("\n\r"), wxTOKEN_STRTOK);
for(size_t i = 0; i < workspaceMacros.GetCount(); i++)
definitions.Add(workspaceMacros.Item(i).Trim().Trim(false).c_str());
CL_DEBUG("CxxPreProcessor will use the following macros:");
CL_DEBUG_ARR(definitions);
// Append the compiler builtin macros
wxArrayString builtinMacros = compiler->GetBuiltinMacros();
definitions.insert(definitions.end(), builtinMacros.begin(), builtinMacros.end());
return true;
}
示例14: set
void Value::set(const wxArrayString& values) {
clear();
wxArrayString::const_iterator it;
for (it = values.begin(); it != values.end(); it++)
emplace_back(it->ToStdString(), size() + 1);
}
示例15: unserializeBrush
bool Brushes::unserializeBrush(pugi::xml_node node, wxArrayString& warnings)
{
pugi::xml_attribute attribute;
if (!(attribute = node.attribute("name"))) {
warnings.push_back(wxT("Brush node without name."));
return false;
}
const std::string& brushName = attribute.as_string();
if (brushName == "all" || brushName == "none") {
warnings.push_back(wxString(wxT("Using reserved brushname \"")) << wxstr(brushName) << wxT("\"."));
return false;
}
Brush* brush = getBrush(brushName);
if (!brush) {
if (!(attribute = node.attribute("type"))) {
warnings.push_back(wxT("Couldn't read brush type"));
return false;
}
const std::string brushType = attribute.as_string();
if (brushType == "border" || brushType == "ground") {
brush = newd GroundBrush();
} else if (brushType == "wall") {
brush = newd WallBrush();
} else if (brushType == "wall decoration") {
brush = newd WallDecorationBrush();
} else if (brushType == "carpet") {
brush = newd CarpetBrush();
} else if (brushType == "table") {
brush = newd TableBrush();
} else if (brushType == "doodad") {
brush = newd DoodadBrush();
} else {
warnings.push_back(wxString(wxT("Unknown brush type ")) << wxstr(brushType));
return false;
}
ASSERT(brush);
brush->setName(brushName);
}
if (!node.first_child()) {
brushes.insert(std::make_pair(brush->getName(), brush));
return true;
}
wxArrayString subWarnings;
brush->load(node, subWarnings);
if(!subWarnings.empty()) {
warnings.push_back(wxString(wxT("Errors while loading brush \"")) << wxstr(brush->getName()) << wxT("\""));
warnings.insert(warnings.end(), subWarnings.begin(), subWarnings.end());
}
if(brush->getName() == "all" || brush->getName() == "none") {
warnings.push_back(wxString(wxT("Using reserved brushname '")) << wxstr(brush->getName()) << wxT("'."));
delete brush;
return false;
}
Brush* otherBrush = getBrush(brush->getName());
if(otherBrush) {
if(otherBrush != brush) {
warnings.push_back(wxString(wxT("Duplicate brush name ")) << wxstr(brush->getName()) << wxT(". Undefined behaviour may ensue."));
} else {
// Don't insert
return true;
}
}
brushes.insert(std::make_pair(brush->getName(), brush));
return true;
}