• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AppendText函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AppendText函数的典型用法代码示例。如果您正苦于以下问题:C++ AppendText函数的具体用法?C++ AppendText怎么用?C++ AppendText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: AppendText

void luConsoleEdit::writeLine(const wxString& line, bool newLine)
{
	AppendText(line);
	//long pos = GetLastPosition();
	//Replace(pos, pos, line);
	if (newLine) AppendText("\n");
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:7,代码来源:luOutputs.cpp


示例2: tokens

void CChatSession::AddText(const wxString& text, const wxTextAttr& style, bool newline)
{
	// Split multi-line messages into individual lines
	wxStringTokenizer tokens( text, wxT("\n") );

	while ( tokens.HasMoreTokens() ) {
		// Check if we should add a time-stamp
		if ( GetNumberOfLines() > 1 ) {
			// Check if the last line ended with a newline
			wxString line = GetLineText( GetNumberOfLines() - 1 );
			if ( line.IsEmpty() ) {
				SetDefaultStyle( COLOR_BLACK );

				AppendText( wxT(" [") + wxDateTime::Now().FormatISOTime() + wxT("] ") );
			}
		}

		SetDefaultStyle(style);

		AppendText( tokens.GetNextToken() );

		// Only add newlines after the last line if it is desired
		if ( tokens.HasMoreTokens() || newline ) {
			AppendText( wxT("\n") );
		}
	}
}
开发者ID:geekt,项目名称:amule,代码行数:27,代码来源:ChatSelector.cpp


示例3: AppendText

void SvnConsole::Stop()
{
    if (m_process) {
        delete m_process;
        m_process = NULL;
    }
    AppendText(_("Aborted.\n"));
    AppendText(wxT("--------\n"));
}
开发者ID:HTshandou,项目名称:codelite,代码行数:9,代码来源:svn_console.cpp


示例4: wxDELETE

void FindResultsTab::OnSearchMatch(wxCommandEvent& e)
{
    SearchResultList* res = (SearchResultList*)e.GetClientData();
    if(!res) return;

    int m = m_book ? m_book->GetPageIndex(m_recv) : 0;
    if(m == wxNOT_FOUND) {
        wxDELETE(res);
        return;
    }

    MatchInfo& matchInfo = GetMatchInfo(m);
    for(SearchResultList::iterator iter = res->begin(); iter != res->end(); iter++) {
        if(matchInfo.empty() || matchInfo.rbegin()->second.GetFileName() != iter->GetFileName()) {
            if(!matchInfo.empty()) {
                AppendText("\n");
            }
            wxFileName fn(iter->GetFileName());
            fn.MakeRelativeTo();
            AppendText(fn.GetFullPath() + wxT("\n"));
        }

        int lineno = m_recv->GetLineCount() - 1;
        matchInfo.insert(std::make_pair(lineno, *iter));
        wxString text = iter->GetPattern();
        int delta = -text.Length();
        text.Trim(false);
        delta += text.Length();
        text.Trim();

        wxString linenum;
        if(iter->GetMatchState() == CppWordScanner::STATE_CPP_COMMENT ||
           iter->GetMatchState() == CppWordScanner::STATE_C_COMMENT)
            linenum = wxString::Format(wxT(" %5u //"), iter->GetLineNumber());
        else
            linenum = wxString::Format(wxT(" %5u "), iter->GetLineNumber());

        SearchData* d = GetSearchData(m_recv);
        // Print the scope name
        if(d->GetDisplayScope()) {
            TagEntryPtr tag = TagsManagerST::Get()->FunctionFromFileLine(iter->GetFileName(), iter->GetLineNumber());
            wxString scopeName(wxT("global"));
            if(tag) {
                scopeName = tag->GetPath();
            }

            linenum << wxT("[ ") << scopeName << wxT(" ] ");
            iter->SetScope(scopeName);
        }

        delta += linenum.Length();
        AppendText(linenum + text + wxT("\n"));
        m_recv->IndicatorFillRange(m_sci->PositionFromLine(lineno) + iter->GetColumn() + delta, iter->GetLen());
    }
    wxDELETE(res);
}
开发者ID:Jactry,项目名称:codelite,代码行数:56,代码来源:findresultstab.cpp


示例5: sizeof

void CLogView::Log(LogFacility logType, BSTR bsSource, BSTR bsModuleID, VARIANT vtValue)
{
  CHARFORMAT cf = {0};
  cf.cbSize = sizeof(CHARFORMAT);
  cf.dwMask = CFM_COLOR;
  CString sType;
  switch(logType)
  {
    case LT_DEBUG:
      sType = _T("debug");
      cf.crTextColor = LOG_COLOR_DEBUG;
      break;
    case LT_INFO:
      sType = _T("info");
      cf.crTextColor = LOG_COLOR_INFO;
      break;
    case LT_WARN:
      sType = _T("warning");
      cf.crTextColor = LOG_COLOR_WARN;
      break;
    case LT_ERROR:
      sType = _T("error");
      cf.crTextColor = LOG_COLOR_ERROR;
      break;
    default:
      sType = _T("log");
      cf.crTextColor = LOG_DEFAULTCOLOR;
      break;
  }

  CTime ts = CTime::GetCurrentTime();
  CString sDate(ts.Format(_T("%H:%M:%S")));

  CComVariant vt;
  vt.ChangeType(VT_BSTR, &vtValue);
  if (vt.vt != VT_BSTR)
  {
    vt = _T("???");
  }
  CString s;
  s.Format(_T("%s %s [%s: %s]: "), sDate, sType, bsSource, bsModuleID);

  SetSelectionCharFormat(cf);
  AppendText(s);

  cf.dwMask |= CFM_BOLD;
  cf.dwEffects = CFE_BOLD;
  SetSelectionCharFormat(cf);
  AppendText(vt.bstrVal);

  cf.dwMask = CFM_COLOR;
  cf.crTextColor = LOG_DEFAULTCOLOR;
  SetSelectionCharFormat(cf);
  AppendText(_T("\r\n"));
}
开发者ID:bver,项目名称:ancho,代码行数:55,代码来源:LogViewRE.cpp


示例6: write_file

void write_file(JJGui *jibber_ui)
{
	GError			*err = NULL;
	gchar			*text;
	gboolean		result;
	GtkTextBuffer	*buffer;
	GtkTextIter		start, end;
	char			szFilename[35] = "";

	time_t t;
	struct tm *tmNow;

	// make sure the gui is finished with any queued instructions before going further
	while (gtk_events_pending())
			gtk_main_iteration();

	// get contents of buffer
	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (jibber_ui->text_view));
	gtk_text_buffer_get_start_iter(buffer, &start);
	gtk_text_buffer_get_end_iter(buffer, &end);
	text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
	gtk_text_buffer_set_modified(buffer, FALSE);

	t = time(NULL);
	tmNow = localtime(&t);

	if (tmNow == NULL) {

		// create a filename from the compile stamp
		sprintf(szFilename, "jibber_%s_%s.txt", __DATE__, __TIME__);
	}
	else {

		// create a filename from the time
		strftime(szFilename, 35, "jibber_%F_%H-%M-%S.txt", tmNow);
	}

	result = g_file_set_contents (szFilename, text, -1, &err);

	if (result == FALSE) {

		// error saving file, show message to user
		AppendText(jibber_ui, DIR_SYSTEM, "Couldn't save file: %s", szFilename);
		AppendText(jibber_ui, DIR_SYSTEM, (err->message));
	}
	else
			AppendText(jibber_ui, DIR_SYSTEM, "Saved file: %s", szFilename);

	// free the text memory
	g_free (text);

}	// end of write_file
开发者ID:TheGurkha,项目名称:Jibber,代码行数:52,代码来源:jibber.c


示例7: AppendText

void BuildProgressPnl::OnMustRefresh(wxCommandEvent&)
{
    std::vector < CodeCompilerTask > currentTasks = CodeCompiler::Get()->GetCurrentTasks();

    if (CodeCompiler::Get()->CompilationInProcess())
    {
        if (!currentTasks.empty())
        {
            if (!CodeCompiler::Get()->LastTaskFailed())
            {
                statusTxt->SetLabel(_("Task in progress:")+currentTasks[0].userFriendlyName);
                AppendText(_("Task in progress:")+currentTasks[0].userFriendlyName+("...")+"\n");
            }
            else
            {
                statusTxt->SetLabel(_("The task ")+currentTasks[0].userFriendlyName+_("failed."));
                AppendText(_("The task ")+currentTasks[0].userFriendlyName+_("failed.")+"\n");
            }
        }
    }
    else
    {
        if (CodeCompiler::Get()->LastTaskFailed())
        {
            statusTxt->SetLabel(_("Some tasks failed."));
            AppendText(_("Some tasks failed.")+"\n");
        }
        else
        {
            wxString timeStr = wxString::Format(_("( %ld seconds )"), compilationTimer.Time()/1000);
            if (!currentTasks.empty())
            {
                statusTxt->SetLabel(_("Compilation finished")+timeStr+_(", but ")+gd::String::From(currentTasks.size())+_(" task(s) are waiting."));
                AppendText(_("Tasks finished ")+timeStr+_(", but ")+gd::String::From(currentTasks.size())+_(" task(s) are waiting.")+"\n");

            }
            else
            {
                statusTxt->SetLabel(_("Compilation finished."));
                AppendText(_("All tasks have been completed.")+" "+timeStr+"\n");
            }
        }
        clearOnNextTextAdding = true;
    }

    if (!currentTasks.empty())
        progressGauge->SetValue(100.f/static_cast<float>(currentTasks.size()));
}
开发者ID:HaoDrang,项目名称:GD,代码行数:48,代码来源:BuildProgressPnl.cpp


示例8: Freeze

void SearchWindow::SearchMessage(const wxString& message)
{
    Freeze();
    SetDefaultStyle(m_messageAttr);
    AppendText(message + "\n");
    Thaw();
}
开发者ID:dansen,项目名称:luacode,代码行数:7,代码来源:SearchWindow.cpp


示例9: wxCHECK_RET

void wxLuaConsole::DisplayStack(const wxLuaState& wxlState)
{
    wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState"));
    int       nIndex   = 0;
    lua_Debug luaDebug = INIT_LUA_DEBUG;
    wxString  buffer;

    lua_State* L = wxlState.GetLuaState();

    while (lua_getstack(L, nIndex, &luaDebug) != 0)
    {
        if (lua_getinfo(L, "Sln", &luaDebug))
        {
            wxString what    (luaDebug.what     ? lua2wx(luaDebug.what)     : wxString(wxT("?")));
            wxString nameWhat(luaDebug.namewhat ? lua2wx(luaDebug.namewhat) : wxString(wxT("?")));
            wxString name    (luaDebug.name     ? lua2wx(luaDebug.name)     : wxString(wxT("?")));

            buffer += wxString::Format(wxT("[%d] %s '%s' '%s' (line %d)\n    Line %d src='%s'\n"),
                                       nIndex, what.c_str(), nameWhat.c_str(), name.c_str(), luaDebug.linedefined,
                                       luaDebug.currentline, lua2wx(luaDebug.short_src).c_str());
        }
        nIndex++;
    }

    if (!buffer.empty())
    {
        AppendText(wxT("\n-----------------------------------------------------------")
                   wxT("\n- Backtrace")
                   wxT("\n-----------------------------------------------------------\n") +
                   buffer +
                   wxT("\n-----------------------------------------------------------\n\n"));
    }
}
开发者ID:mattprintz,项目名称:wx-xword,代码行数:33,代码来源:wxlconsole.cpp


示例10: SetPreservedRow

//setting up the textarea for smooth scrolling, the first
//TEXTAREA_OUTOFTEXT callback is called automatically
void TextArea::SetupScroll(unsigned long tck)
{
	SetPreservedRow(0);
	smooth = ftext->maxHeight;
	startrow = 0;
	ticks = tck;
	//clearing the textarea
	Clear();
	unsigned int i = (unsigned int) (Height/smooth);
	while (i--) {
		char *str = (char *) malloc(1);
		str[0]=0;
		lines.push_back(str);
		lrows.push_back(0);
	}
	i = (unsigned int) lines.size();
	Flags |= IE_GUI_TEXTAREA_SMOOTHSCROLL;
	GetTime( starttime );
	if (RunEventHandler( TextAreaOutOfText )) {
		//event handler destructed this object?
		return;
	}
	if (i==lines.size()) {
		ResetEventHandler( TextAreaOutOfText );
		return;
	}
	//recalculates rows
	AppendText("\n",-1);
}
开发者ID:NickDaly,项目名称:GemRB-MultipleConfigs,代码行数:31,代码来源:TextArea.cpp


示例11: AppendText

int wxTextCtrlBase::overflow(int c)
{
    AppendText((wxChar)c);

    // return something different from EOF
    return 0;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:7,代码来源:textcmn.cpp


示例12: assert

void
CBExecOutputDocument::ReceiveRecord()
{
	assert( itsRecordLink != NULL );

	JString text;
	const JBoolean ok = itsRecordLink->GetNextMessage(&text);
	assert( ok );

	// remove text that has already been printed

	if (!itsLastPrompt.IsEmpty() && text.BeginsWith(itsLastPrompt))
		{
		text.RemoveSubstring(1, itsLastPrompt.GetLength());
		}
	itsLastPrompt.Clear();

	const JXTEBase::DisplayState state = GetTextEditor()->SaveDisplayState();

	AppendText(text);
	GetTextEditor()->ClearUndo();

	if (!itsReceivedDataFlag)
		{
		itsReceivedDataFlag = kJTrue;
		if (!IsActive())
			{
			Activate();
			}
		}

	GetTextEditor()->RestoreDisplayState(state);
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:33,代码来源:CBExecOutputDocument.cpp


示例13: wxT

void FindResultsTab::OnSearchStart(wxCommandEvent& e)
{
    m_searchInProgress = true;
    SearchData* data = (SearchData*)e.GetClientData();
    wxString label = data ? data->GetFindString() : wxT("");

    if(e.GetInt() != 0 || m_sci == NULL) {
        if(m_book) {
            clWindowUpdateLocker locker(this);
            MySTC* sci = new MySTC(m_book);
            SetStyles(sci);
            sci->Connect(wxEVT_STC_STYLENEEDED, wxStyledTextEventHandler(FindResultsTab::OnStyleNeeded), NULL, this);
            m_book->AddPage(sci, label, true);
#ifdef __WXMAC__
            m_book->GetSizer()->Layout();
#endif
            size_t where = m_book->GetPageCount() - 1;

            // keep the search data used for this tab
            wxWindow* tab = m_book->GetPage(where);
            if(tab) {
                tab->SetClientData(data);
            }

            m_matchInfo.push_back(MatchInfo());
            m_sci = sci;
        }
    } else if(m_book) {
        // using current tab, update the tab title and the search data
        int where = m_book->GetPageIndex(m_sci);
        if(where != wxNOT_FOUND) {
            m_book->SetPageText(where, label);
            // delete the old search data
            wxWindow* tab = m_book->GetPage(where);
            SearchData* oldData = (SearchData*)tab->GetClientData();
            if(oldData) {
                delete oldData;
            }
            // set the new search data
            tab->SetClientData(data);
        }
    }

    // This is needed in >=wxGTK-2.9, otherwise the 'Search' pane doesn't fully expand
    SendSizeEvent(wxSEND_EVENT_POST);

    m_recv = m_sci;
    Clear();

    if(data) {
        m_searchData = *data;

        wxString message;
        message << _("====== Searching for: '") << data->GetFindString() << _("'; Match case: ")
                << (data->IsMatchCase() ? _("true") : _("false")) << _(" ; Match whole word: ")
                << (data->IsMatchWholeWord() ? _("true") : _("false")) << _(" ; Regular expression: ")
                << (data->IsRegularExpression() ? _("true") : _("false")) << wxT(" ======\n");
        AppendText(message);
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:60,代码来源:findresultstab.cpp


示例14: AppendText

wxTextCtrl& wxTextCtrlBase::operator<<(long i)
{
    wxString str;
    str.Printf(wxT("%ld"), i);
    AppendText(str);
    return *TEXTCTRL(this);
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:7,代码来源:textcmn.cpp


示例15: GetLastError

void CRedirect::ShowLastError(LPCTSTR szText)
{
	LPVOID		lpMsgBuf;
	DWORD		Success;

	//--------------------------------------------------------------------------
	//	Get the system error message.
	//--------------------------------------------------------------------------
	Success = FormatMessage
	(
		FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
		NULL,
		GetLastError(),
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),	//lint !e1924 (warning about C-style cast)
		LPTSTR(&lpMsgBuf),
		0,
		NULL
	);

	CString	Msg;

	Msg = szText;
	Msg += _T("\r\n");
	if ( Success )
	{
		Msg += LPTSTR(lpMsgBuf);
	}
	else
	{
		Msg += _T("No status because FormatMessage failed.\r\n");
	}

	AppendText(Msg);

}
开发者ID:weiwei22844,项目名称:UsefullProject,代码行数:35,代码来源:Redirect.cpp


示例16: Assert

AUI_ERRCODE aui_TextBox::AppendText
(
	MBCHAR const *  text,
	COLORREF        color,
	sint32          bold,
	sint32          italic 
)
{
	Assert( text != NULL );
	if ( !text ) return AUI_ERRCODE_INVALIDPARAM;

	
	if ( !strlen( text ) ) return AppendText(" ", color, bold, italic );

	
	m_curColor = color;
	m_curBold = bold;
	m_curItalic = italic;

	
	
	CalculateAppendedItems( text );

	
	Assert( m_curLength + strlen( text ) <= m_maxLength );

	
	strncat( m_text, text, m_maxLength - m_curLength );

	m_curLength = strlen( m_text );

	return AUI_ERRCODE_OK;
}
开发者ID:talentlesshack,项目名称:C2P2,代码行数:33,代码来源:aui_textbox.cpp


示例17: s

void SvnConsole::OnReadProcessOutput(wxCommandEvent& event)
{
    ProcessEventData *ped = (ProcessEventData *)event.GetClientData();
    if (ped) {
        m_output.Append(ped->GetData().c_str());
    }

    wxString s (ped->GetData());
    s.MakeLower();

    if (m_currCmd.printProcessOutput)
        AppendText( ped->GetData() );
    
    static wxRegEx reUsername("username[ \t]*:", wxRE_DEFAULT|wxRE_ICASE);
    wxArrayString lines = wxStringTokenize(s, wxT("\n"), wxTOKEN_STRTOK);
    if( !lines.IsEmpty() && lines.Last().StartsWith(wxT("password for '")) ) {
        m_output.Clear();
        wxString pass = wxGetPasswordFromUser(ped->GetData(), wxT("Subversion"));
        if(!pass.IsEmpty() && m_process) {
            m_process->WriteToConsole(pass);
        }
    } else if ( !lines.IsEmpty() && reUsername.IsValid() && reUsername.Matches( lines.Last() ) ) {
        // Prompt the user for "Username:"
        wxString username = ::wxGetTextFromUser(ped->GetData(), "Subversion");
        if ( !username.IsEmpty() && m_process ) {
            m_process->Write(username + "\n");
        }
    }
    delete ped;
}
开发者ID:HTshandou,项目名称:codelite,代码行数:30,代码来源:svn_console.cpp


示例18: AppendText

NyqRedirector::~NyqRedirector()
{
   std::cout.flush();
   std::cout.rdbuf(mOld);
   if (s.length() > 0) {
      AppendText();
   }
}
开发者ID:finefin,项目名称:audacity,代码行数:8,代码来源:NyqBench.cpp


示例19: wxTextCtrl

SourceView::SourceView(wxWindow *parent, MainWin* mainwin_)
:	wxTextCtrl(parent, SOURCE_VIEW, wxEmptyString,
               wxDefaultPosition, wxDefaultSize,
               wxTE_MULTILINE | wxSUNKEN_BORDER | wxTE_READONLY | wxTE_DONTWRAP | wxTE_RICH2  ),
	mainwin(mainwin_)
{
	AppendText("Select a procedure from the list above.");
}
开发者ID:mhoffesommer,项目名称:Very-Sleepy,代码行数:8,代码来源:sourceview.cpp


示例20: HotKeyPressed

void HotKeyPressed(WPARAM wParam)
{
	//AppendText(txtbox, _T("hotkey test"));
	if (wParam == (pauseHotKey + hotkeyIdOffset))
	{
		if (!isPaused) 
		{
			AppendText(txtbox, _T("Paused\r\n"));
			isPaused = true;
		}
		else
		{
			isPaused = false;
			AppendText(txtbox, _T("Unpaused\r\n"));
		}
	}
}
开发者ID:Synthuse,项目名称:synthuse-src,代码行数:17,代码来源:MsgHookWindow.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AppendToString函数代码示例发布时间:2022-05-30
下一篇:
C++ AppendString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap