当前位置: 首页>>代码示例>>C++>>正文


C++ wxString::Index方法代码示例

本文整理汇总了C++中wxString::Index方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Index方法的具体用法?C++ wxString::Index怎么用?C++ wxString::Index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxString的用法示例。


在下文中一共展示了wxString::Index方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetUserSize

void AeroQSPFrame::SetUserSize( const wxString &size )
{
	long width = 800, height = 600;
	int pos = size.Index(wxT('x'));
	if (pos > 0 && pos + 1 < size.Length())
	{
		size.Mid(0, pos).ToLong(&width);
		size.Mid(pos + 1).ToLong(&height);
	}
	if (width > 0 && height > 0)
	{
		int curW, curH;
		if (_isFullScreen)
		{
			_isFullScreen = false;
			ShowFullScreen(false);
		}
		GetClientSize(&curW, &curH);
		if (width != curW || height != curH)
		{
			SetClientSize(width, height);
			CenterOnParent();
		}
	}
}
开发者ID:Nesles,项目名称:qsp,代码行数:25,代码来源:AeroQSPFrame.cpp

示例2: Add

bool FileFilters::Add(const wxString& name, const wxString& mask)
{
    if (name.IsEmpty() || mask.IsEmpty())
        return false; // both must be valid
    if (mask.Index(_T(',')) != wxString::npos)
    {
        // replace commas with semicolons
        wxString tmp = mask;
        while (tmp.Replace(_T(","), _T(";")))
            ;
        s_Filters[name] = tmp;
    }
    else
        s_Filters[name] = mask;
    return true;
}
开发者ID:yjdwbj,项目名称:cb10-05-ide,代码行数:16,代码来源:filefilters.cpp

示例3: WriteData

bool EdiComposer::WriteData(const FieldDescriptor& desc, const wxString& value) {

    if ( desc.GetType().Cmp(NUMERIC_TYPE) == 0 ) {
        wxString data = value;
        BufferWriteRawData(data.Pad(desc.GetLenght() - value.Len(), '0', FALSE),
                           desc.GetLenght(),
                           desc.GetAlign());
    } else if ( desc.GetType().Cmp(MONEY_TYPE) == 0 ) {
        wxString data = value;
        data = data.erase(value.Index('.'), 1);
        BufferWriteRawData(data.Pad(desc.GetLenght() - data.Len(), '0', FALSE),
                           desc.GetLenght(),
                           desc.GetAlign());
    } else if ( desc.GetType().Cmp(CHOICE_TYPE) == 0 ) {
        BufferWriteRawData(desc.PrepareValue(value), desc.GetLenght(), desc.GetAlign());
    } else {
        BufferWriteRawData(ConvertDataForType(value, desc.GetType()), 
                           desc.GetLenght(), desc.GetAlign());
    }
    return true;
};
开发者ID:Skier,项目名称:vault_repo,代码行数:21,代码来源:EdiComposer.cpp

示例4: getUrlFile

// 获取远程文件
bool CUpdate::getUrlFile(const wxString &url, unsigned char urlType, const wxString dir, wxString saveName)
{
	// 处理文件名
	wxString fileName = url.substr(url.Last('/')+1);	// 如果没有指定文件名,则使用链接地址文件名
	if (saveName.IsEmpty())
		saveName = fileName;
	bool res = true;
	// access save file.
	if (urlType == EUT_HTTP)
	{			
		wxURL *purl = new wxURL(url);		
		wxInputStream *in = purl->GetInputStream();		
		if (!in)
		{
			wxLogError("Couldn't get the file:%s",fileName);			
		}
		else
		{
			res &= SaveFile(in, saveName, dir);
			delete in;
		}
		in = NULL;
		delete purl;
	}
	else if (urlType == EUT_FTP)
	{
		wxFTP ftp;
		// access ftp hostName
		wxString tempFtpAddr = url.substr(0, url.Index('/'));
		// access ftp Dir
		wxString fileDir = url.substr(tempFtpAddr.Len(), url.Len()-tempFtpAddr.Len()-fileName.Len());		
		//ftp.SetUser(_("Anonymous"));	//匿名访问
		ftp.SetUser(_("guest"));
		//ftp.SetPassword(wxEmptyString);
		if ( !ftp.Connect(tempFtpAddr))
		{
			wxLogError("Lost connect,The url is %s and filename is %s.",tempFtpAddr, fileName);
		}
		else
		{
			ftp.ChDir(fileDir);
			// 文件包大小判断
			int size = ftp.GetFileSize(fileName);
			if ( size == -1 )
			{
				wxLogError("Couldn't get the file size for \"%s\"", fileName);
			}
			else
			{
				// 文件流判断
				wxInputStream *in = ftp.GetInputStream(fileName);
				if ( !in )
				{
					wxLogError("Couldn't get the file:%s",fileName);				
				}
				else
				{
					// 保存文件
					res &= SaveFile(in, saveName, dir, size);
					delete in;
				}
				in = NULL;
			}
		}
		// gracefully close the connection to the server
		ftp.Close();
	}
	else if (urlType == EUT_HTTPS)
	{
		//TODO: 实现HTTPS,传输机密文件或核心文件
	}
	// 传输成功且传输总数大于零,避免零作除数(有点冗余判断)
	if (res && m_mainAmountValue>0)
	{
		m_mainAmountValue++;
	}
	return res;
}
开发者ID:dnjsflagh1,项目名称:code,代码行数:79,代码来源:update.cpp

示例5: ParseBuffer

void ToDoListView::ParseBuffer(const wxString& buffer, const wxString& filename)
{
    // this is the actual workhorse...

    HighlightLanguage hlang = Manager::Get()->GetEditorManager()->GetColourSet()->GetLanguageForFilename(filename);
    CommentToken cmttoken = Manager::Get()->GetEditorManager()->GetColourSet()->GetCommentToken(hlang);
    wxString langName = Manager::Get()->GetEditorManager()->GetColourSet()->GetLanguageName(hlang);

    m_ItemsMap[filename].clear();

    wxArrayString allowedTypes;
    size_t t = 0;
    while(t < m_Types.Count())
    {
        if(m_pAllowedTypesDlg->IsChecked(m_Types.Item(t)))
            allowedTypes.Add(m_Types.Item(t));
        t++;
    }

    wxArrayString startStrings;
    if (langName == _T("C/C++") )
    {
        startStrings.Add(_T("#warning"));
        startStrings.Add(_T("#error"));
    }
    if (!cmttoken.doxygenLineComment.IsEmpty())
        startStrings.Add(cmttoken.doxygenLineComment);
    if (!cmttoken.doxygenStreamCommentStart.IsEmpty())
        startStrings.Add(cmttoken.doxygenStreamCommentStart);

    if ( !cmttoken.lineComment.IsEmpty() )
        startStrings.Add(cmttoken.lineComment);
    if ( !cmttoken.streamCommentStart.IsEmpty() )
        startStrings.Add(cmttoken.streamCommentStart);

    if ( startStrings.IsEmpty() || allowedTypes.IsEmpty() )
    {
        Manager::Get()->GetLogManager()->Log(_T("ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do."));
        return;
    }

    for ( unsigned k = 0; k < startStrings.size(); k++)
    {
        size_t pos = 0;
        int oldline=0, oldlinepos=0;
        while (1)
        {
            pos = buffer.find(startStrings[k], pos);
            if ( pos == (size_t)wxNOT_FOUND )
                break;

            pos += startStrings[k].length();
            SkipSpaces(buffer, pos);

            for (unsigned int i = 0; i < allowedTypes.GetCount(); ++i)
            {
                wxString type = buffer.Mid(pos, allowedTypes[i].length());
                if ( type != allowedTypes[i])
                    continue;
                pos += allowedTypes[i].length();
                SkipSpaces(buffer, pos);

                ToDoItem item;
                item.type = allowedTypes[i];
                item.filename = filename;


                // ok, we look for two basic kinds of todo entries in the text
                // our version...
                // TODO (mandrav#0#): Implement code to do this and the other...
                // and a generic version...
                // TODO: Implement code to do this and the other...

                wxChar c = buffer.GetChar(pos);
                // is it ours or generic todo?
                if (c == _T('('))
                {
                    // it's ours, find user and/or priority
                    ++pos;
                    while(pos < buffer.length() && buffer.GetChar(pos) != _T('\r') && buffer.GetChar(pos) != _T('\n'))
                    {
                        wxChar c1 = buffer.GetChar(pos);
                        if (c1 != _T('#') && c1 != _T(')'))
                        {
                            // a little logic doesn't hurt ;)
                            if (c1 == _T(' ') || c1 == _T('\t'))
                            {
                                // allow one consecutive space
                                if (item.user.Last() != _T(' '))
                                    item.user << _T(' ');
                            }
                            else
                                item.user << c1;
                        }
                        else if (c1 == _T('#'))
                        {
                            // look for priority
                            c1 = buffer.GetChar(++pos);
                            const wxString allowedChars = _T("0123456789");
                            if ((int)allowedChars.Index(c1) != wxNOT_FOUND)
//.........这里部分代码省略.........
开发者ID:simple-codeblocks,项目名称:Codeblocks,代码行数:101,代码来源:todolistview.cpp


注:本文中的wxString::Index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。