本文整理汇总了C++中wxString::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::GetLength方法的具体用法?C++ wxString::GetLength怎么用?C++ wxString::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::GetLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StripExtraWhitespace
wxString ecUtils::StripExtraWhitespace (const wxString & strInput)
{
wxString strOutput;
wxChar* o=strOutput.GetWriteBuf(1+strInput.Len());
for(const wxChar* c=strInput.GetData();*c;c++){
if(ecIsSpace(*c)){
*o++=wxT(' ');
if (ecIsSpace(c[1])){
for(c=c+2; ecIsSpace(*c);c++);
c--;
}
} else {
*o++=*c;
}
}
*o=0;
strOutput.UngetWriteBuf();
strOutput.Trim(TRUE);
strOutput.Trim(FALSE);
return strOutput;
#if 0
wxString strOutput;
LPTSTR o=strOutput.GetBuffer(1+strInput.GetLength());
for(LPCTSTR c=strInput;*c;c++){
if(_istspace(*c)){
*o++=_TCHAR(' ');
if (_istspace(c[1])){
for(c=c+2;_istspace(*c);c++);
c--;
}
} else {
*o++=*c;
}
}
*o=0;
strOutput.ReleaseBuffer();
strOutput.TrimLeft();
strOutput.TrimRight();
return strOutput;
#endif
}
示例2: OnOpenDocument
bool DrawProgDoc::OnOpenDocument(const wxString& filename)
{
INXString filename;
int len;
int response;
#ifdef _UNUSED_FUNCTIONS_TO_LOAD_THE_FILE
CLabLgbBaseApp *pApp = ( CLabLgbBaseApp * ) AfxGetApp();
double dFreeDiskSpace = pApp->MyGetFreeDiskSpaceMB();
if (dFreeDiskSpace < DISK_SPACE_WARNING_MB) {
response = AfxMessageBox("Warning, less than 50MB of free disk space remaining.\nYou may not be able save your work.\nContinue?",MB_YESNO | MB_ICONWARNING);
if (response == IDNO) {
return FALSE;
}
} else if (dFreeDiskSpace < DISK_SPACE_CRITICAL_MB) {
AfxMessageBox("Unable to open project, less than 10MB of free disk space remaining.",MB_ICONWARNING);
return FALSE;
}
#endif
// Extract filename
filename = (INXString)lpszPathName;
//filename = filename.SpanExcluding(".");
filename.MakeReverse();
filename = filename.SpanExcluding("\\");
filename.MakeReverse();
// remove .prg to get filename
len = filename.GetLength() - 4;
filename = filename.Left(len);
if (!wxDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
POSITION pos = GetFirstViewPosition();
DrawProgView* pView = (DrawProgView*) GetNextView(pos);
if (pFrame->m_wndProjectBar.m_cProjTree.openProject) {
pProject = pFrame->m_wndProjectBar.m_cProjTree.openProj;
}
else {
pProject = pFrame->m_wndProjectBar.m_cProjTree.GetProjectPtr(pFrame->m_wndProjectBar.m_cProjTree.hSelItem);
}
// Check Folder Structure
INXString csProjDir;
pProject->pProjMData->initProjFolderMinder();
if(pProject->pProjMData->folderStructureNotOk()){
AfxMessageBox("Unable to open this project, because the directory structure is invalid");
return kErr_InvalidFolderStructure;
}
// Create DEP, load and initialise
pDEP = pProject->AddDEP();
pDEP->LoadProg((INXString)lpszPathName);
pDEP->InitTagLists();
pDEP->depFilename = filename;
// Populate project tree if opening a project. Uses the loaded DEP to populate the tree
if (pFrame->m_wndProjectBar.m_cProjTree.openProject) {
pFrame->m_wndProjectBar.m_cProjTree.PopulateProjectTree(pDEP->condata, pProject);
}
pDEP->hItem = pFrame->m_wndProjectBar.m_cProjTree.hSelItem;
// Set the project and DEP pointers in the view
pView->pProject = pProject;
pView->pDEP = pDEP;
pView->RedrawWindow();
// Need to initialise undo for case when the view is already open
pView->initUndo();
return true;
}