本文整理汇总了C++中wxPrintf函数的典型用法代码示例。如果您正苦于以下问题:C++ wxPrintf函数的具体用法?C++ wxPrintf怎么用?C++ wxPrintf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxPrintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxPrintf
void CodeLiteLLDBApp::OpenCoreFile(const LLDBCommand& command)
{
wxPrintf("codeite-lldb: debugging core file '%s'\n", command.GetCorefile());
wxPrintf("codeite-lldb: executable file '%s'\n", command.GetExecutable());
if(!InitializeLLDB(command)) {
return;
}
lldb::SBProcess process = m_target.LoadCore(command.GetCorefile().mb_str(wxConvUTF8).data());
if(!process.IsValid()) {
wxPrintf("codeite-lldb: error loading core file '%s'\n", command.GetCorefile());
NotifyExited();
return;
}
// Launch the thread that will handle the LLDB process events
m_lldbProcessEventThread =
new LLDBProcessEventHandlerThread(this, m_debugger, m_target.GetProcess(), kDebugSessionTypeCore);
m_lldbProcessEventThread->Start();
// Notify codelite that the debugger started successfully
NotifyStarted(kDebugSessionTypeCore);
// In any case, reset the interrupt reason
m_interruptReason = kInterruptReasonNone;
// Since we are in 'core' session
// immediately notify about 'stop'
NotifyStopped();
}
示例2: throw
void CodeLiteLLDBApp::AcceptNewConnection() throw(clSocketException)
{
m_replySocket.reset(NULL);
wxPrintf("codelite-lldb: waiting for new connection\n");
try {
while(true) {
m_replySocket = m_acceptSocket.WaitForNewConnection(1);
if(m_replySocket) {
break;
}
}
// Remote connection, send the 'handshake' packet
if(m_port != wxNOT_FOUND) {
wxPrintf("codelite-lldb: sending handshake packet\n");
LLDBRemoteHandshakePacket handshake;
handshake.SetHost(::wxGetHostName());
m_replySocket->WriteMessage(handshake.ToJSON().format());
}
// handle the connection to the thread
m_networkThread = new LLDBNetworkServerThread(this, m_replySocket->GetSocket());
m_networkThread->Start();
} catch(clSocketException& e) {
wxPrintf("codelite-lldb: an error occurred while waiting for connection. %s\n", e.what().c_str());
Cleanup();
// exit
throw clSocketException("Failed to accept new connection");
}
}
示例3: wxPuts
void InteractiveInputTestCase::TestSingleIstance()
{
#ifdef TEST_SNGLINST
wxPuts(wxT("\n*** Testing wxSingleInstanceChecker ***"));
wxSingleInstanceChecker checker;
if ( checker.Create(wxT(".wxconsole.lock")) )
{
if ( checker.IsAnotherRunning() )
{
wxPrintf(wxT("Another instance of the program is running, exiting.\n"));
return;
}
// wait some time to give time to launch another instance
wxPuts(wxT("If you try to run another instance of this program now, it won't start."));
wxPrintf(wxT("Press \"Enter\" to exit wxSingleInstanceChecker test and proceed..."));
wxFgetc(stdin);
}
else // failed to create
{
wxPrintf(wxT("Failed to init wxSingleInstanceChecker.\n"));
}
wxPuts("\n");
#endif // defined(TEST_SNGLINST)
}
示例4: wxPrintf
void CodeLiteLLDBApp::ApplyBreakpoints(const LLDBCommand& command)
{
wxPrintf("codelite-lldb: ApplyBreakpoints called\n");
if ( m_target.GetProcess().GetState() == lldb::eStateStopped ) {
wxPrintf("codelite-lldb: ApplyBreakpoints: process state is stopped - will apply them now\n");
// we can apply the breakpoints
// Apply all breakpoints with an-invalid breakpoint ID
LLDBBreakpoint::Vec_t breakpoints = command.GetBreakpoints();
while( !breakpoints.empty() ) {
LLDBBreakpoint::Ptr_t breakPoint = breakpoints.at(0);
if ( !breakPoint->IsApplied() ) {
switch( breakPoint->GetType() ) {
case LLDBBreakpoint::kFunction: {
wxPrintf("codelite-lldb: creating breakpoint by name: %s\n", breakPoint->GetName());
m_target.BreakpointCreateByName(breakPoint->GetName().mb_str().data(), NULL);
break;
}
case LLDBBreakpoint::kFileLine: {
wxPrintf("codelite-lldb: creating breakpoint by location: %s,%d\n", breakPoint->GetFilename(), breakPoint->GetLineNumber());
m_target.BreakpointCreateByLocation(breakPoint->GetFilename().mb_str().data(), breakPoint->GetLineNumber());
break;
}
}
}
breakpoints.erase(breakpoints.begin());
}
NotifyBreakpointsUpdated();
} else {
wxPrintf("codelite-lldb: ApplyBreakpoints: process state is _NOT_ Stopped - interrupting process\n");
// interrupt the process
m_interruptReason = kInterruptReasonApplyBreakpoints;
m_target.GetProcess().SendAsyncInterrupt();
}
}
示例5: BenchmarkRoundedRectangles
void BenchmarkRoundedRectangles(const wxString& msg, wxDC& dc)
{
if ( !opts.testRectangles )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
dc.SetBrush( *wxCYAN_BRUSH );
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
wxStopWatch sw;
for ( int n = 0; n < opts.numIters; n++ )
{
int x = rand() % opts.width,
y = rand() % opts.height;
dc.DrawRoundedRectangle(x, y, 48, 32, 8);
}
const long t = sw.Time();
wxPrintf("%ld rounded rects done in %ldms = %gus/rect\n",
opts.numIters, t, (1000. * t)/opts.numIters);
}
示例6: main
int main(int argc, char **argv)
{
wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program");
wxInitializer initializer;
if ( !initializer )
{
fprintf(stderr, "Failed to initialize the wxWidgets library, aborting.");
return -1;
}
wxCmdLineParser parser(cmdLineDesc, argc, argv);
switch ( parser.Parse() )
{
case -1:
// help was given, terminating
break;
case 0:
// everything is ok; proceed
if (parser.Found("d"))
{
wxPrintf("Dummy switch was given...\n");
while (1)
{
wxChar input[128];
wxPrintf("Try to guess the magic number (type 'quit' to escape): ");
if ( !wxFgets(input, WXSIZEOF(input), stdin) )
break;
// kill the last '\n'
input[wxStrlen(input) - 1] = 0;
if (wxStrcmp(input, "quit") == 0)
break;
long val;
if (!wxString(input).ToLong(&val))
{
wxPrintf("Invalid number...\n");
continue;
}
if (val == 42)
wxPrintf("You guessed!\n");
else
wxPrintf("Bad luck!\n");
}
}
break;
default:
break;
}
// do something useful here
return 0;
}
示例7: main
int main(int argc, char **argv)
{
if ( argc < 2 ) {
printf("usage: %s <bind string>\n", argv[0]);
return EXIT_FAILURE;
}
try {
wxString connectAddress(argv[1], wxConvUTF8);
ZMQContext context;
ZMQSocket s(context, ZMQSocket::Reply); // Server socket type
s.bind( connectAddress );
// wait for messages
s.setTimeout( 1000 );
while ( true ) {
ZMQMessage incMessage;
if ( s.recvMessage( incMessage ) ) {
wxPrintf(wxT("Received message: %s\n"), incMessage.GetString().c_str());
// Message received!
// process it
wxString reply( incMessage.GetString() );
reply << wxT(" - a reply!");
s.sendMessage( reply );
}
}
} catch (ZMQException &e) {
wxPrintf(wxT("error: %s\n"), e.What().c_str());
}
return 0;
}
示例8: BenchmarkLines
void BenchmarkLines(const char *msg, wxDC& dc)
{
if ( opts.mapMode != 0 )
dc.SetMapMode(opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
wxPrintf("Benchmarking %s DC: ", msg);
wxStopWatch sw;
int x = 0,
y = 0;
for ( int n = 0; n < opts.numLines; n++ )
{
int x1 = rand() % opts.width,
y1 = rand() % opts.height;
dc.DrawLine(x, y, x1, y1);
x = x1;
y = y1;
}
const long t = sw.Time();
wxPrintf("%d lines done in %lums = %gus/line\n",
opts.numLines, t, (1000. * t)/opts.numLines);
}
示例9: catch
bool CodeLiteLLDBApp::OnInit()
{
try {
if(m_port != wxNOT_FOUND) {
m_acceptSocket.CreateServer(m_ip.mb_str(wxConvUTF8).data(), m_port);
} else {
m_acceptSocket.CreateServer(m_debuggerSocketPath.mb_str(wxConvUTF8).data());
}
} catch(clSocketException& e) {
if(m_port == wxNOT_FOUND) {
wxPrintf("codelite-lldb: caught exception: %s\n", e.what());
wxPrintf("codelite-lldb: failed to create server on %s. %s\n", m_debuggerSocketPath, strerror(errno));
} else {
wxPrintf("codelite-lldb: caught exception: %s\n", e.what());
wxPrintf("codelite-lldb: failed to create server on %s. %s\n",
(wxString() << m_ip << ":" << m_port),
strerror(errno));
}
return false;
}
return true;
}
示例10: BenchmarkImages
void BenchmarkImages(const wxString& msg, wxDC& dc)
{
if ( !opts.testImages )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
wxImage image(wxSize(opts.width, opts.height), false /* don't clear */);
wxStopWatch sw;
for ( int n = 0; n < opts.numIters; n++ )
{
UpdateRGB(image.GetData(), n);
dc.DrawBitmap(image, 0, 0);
}
const long t = sw.Time();
wxPrintf("%ld images done in %ldms = %gus/image or %ld FPS\n",
opts.numIters, t, (1000. * t)/opts.numIters,
(1000*opts.numIters + t - 1)/t);
}
示例11: CHECK_DEBUG_SESSION_RUNNING
void CodeLiteLLDBApp::DeleteBreakpoints(const LLDBCommand& command)
{
CHECK_DEBUG_SESSION_RUNNING();
const LLDBBreakpoint::Vec_t& bps = command.GetBreakpoints();
if(bps.empty()) {
return;
}
wxPrintf("codelite-lldb: DeleteBreakpoints called\n");
if(m_target.GetProcess().GetState() == lldb::eStateStopped) {
wxPrintf("codelite-lldb: DeleteBreakpoints: process state is Stopped - will apply them now\n");
for(size_t i = 0; i < bps.size(); ++i) {
LLDBBreakpoint::Ptr_t breakpoint = bps.at(i);
wxPrintf("codelite-lldb: deleting breakpoint: %s\n", breakpoint->ToString());
if(breakpoint->IsApplied()) {
lldb::SBBreakpoint lldbBreakpoint = m_target.FindBreakpointByID(breakpoint->GetId());
if(lldbBreakpoint.IsValid()) {
lldbBreakpoint.ClearAllBreakpointSites();
m_target.BreakpointDelete(lldbBreakpoint.GetID());
}
}
}
NotifyBreakpointsUpdated();
} else {
wxPrintf("codelite-lldb: DeleteBreakpoints: process is Busy - will interrupt it\n");
m_interruptReason = kInterruptReasonDeleteBreakpoint;
m_target.GetProcess().SendAsyncInterrupt();
}
}
示例12: BenchmarkEllipses
void BenchmarkEllipses(const wxString& msg, wxDC& dc)
{
if ( !opts.testEllipses )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
dc.SetBrush( *wxBLUE_BRUSH );
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
wxStopWatch sw;
for ( long n = 0; n < opts.numIters; n++ )
{
int x = rand() % opts.width,
y = rand() % opts.height;
dc.DrawEllipse(x, y, 48, 32);
}
const long t = sw.Time();
wxPrintf("%ld ellipses done in %ldms = %gus/ellipse\n",
opts.numIters, t, (1000. * t)/opts.numIters);
}
示例13: mName
FileIO::FileIO(const wxString & name, FileIOMode mode)
: mName(name),
mMode(mode),
mInputStream(NULL),
mOutputStream(NULL),
mOpen(false)
{
wxString scheme;
if (mMode == FileIO::Input) {
mInputStream = new wxFFileInputStream(mName);
if (mInputStream == NULL || !mInputStream->IsOk()) {
wxPrintf(wxT("Couldn't get input stream: %s\n"), name.c_str());
return;
}
}
else {
mOutputStream = new wxFFileOutputStream(mName);
if (mOutputStream == NULL || !mOutputStream->IsOk()) {
wxPrintf(wxT("Couldn't get output stream: %s\n"), name.c_str());
return;
}
}
mOpen = true;
}
示例14: BenchmarkLines
void BenchmarkLines(const wxString& msg, wxDC& dc)
{
if ( !opts.testLines )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
wxStopWatch sw;
int x = 0,
y = 0;
for ( int n = 0; n < opts.numIters; n++ )
{
int x1 = rand() % opts.width,
y1 = rand() % opts.height;
dc.DrawLine(x, y, x1, y1);
x = x1;
y = y1;
}
const long t = sw.Time();
wxPrintf("%ld lines done in %ldms = %gus/line\n",
opts.numIters, t, (1000. * t)/opts.numIters);
}
示例15: wxPrintf
void TestResult::testsEnded() {
if (failureCount > 0)
wxPrintf("\n%ld tests run [%ld checks]: there were %ld failures!\n",
testCount, checkCount, failureCount);
else
wxPrintf("\n%ld tests run [%ld checks]: all tests passed!\n",
testCount, checkCount);
}