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


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

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


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

示例1: Load

bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
{
    char*   p;
    int     i, ccount = 0;
    wxPoint pt;
    char*   line = (char*) aLineReader;

    i = sscanf( line + 2, "%d %d %d %d", &ccount, &m_Unit, &m_Convert, &m_Width );

    m_Fill = NO_FILL;

    if( i < 4 )
    {
        aErrorMsg.Printf( _( "Polyline only had %d parameters of the required 4" ), i );
        return false;
    }

    if( ccount <= 0 )
    {
        aErrorMsg.Printf( _( "Polyline count parameter %d is invalid" ), ccount );
        return false;
    }

    strtok( line + 2, " \t\n" );     // Skip field
    strtok( NULL, " \t\n" );         // Skip field
    strtok( NULL, " \t\n" );         // Skip field
    strtok( NULL, " \t\n" );

    for( i = 0; i < ccount; i++ )
    {
        p = strtok( NULL, " \t\n" );

        if( p == NULL || sscanf( p, "%d", &pt.x ) != 1 )
        {
            aErrorMsg.Printf( _( "Polyline point %d X position not defined" ), i );
            return false;
        }

        p = strtok( NULL, " \t\n" );

        if( p == NULL || sscanf( p, "%d", &pt.y ) != 1 )
        {
            aErrorMsg.Printf( _( "Polyline point %d Y position not defined" ), i );
            return false;
        }

        AddPoint( pt );
    }

    if( ( p = strtok( NULL, " \t\n" ) ) != NULL )
    {
        if( p[0] == 'F' )
            m_Fill = FILLED_SHAPE;

        if( p[0] == 'f' )
            m_Fill = FILLED_WITH_BG_BODYCOLOR;
    }

    return true;
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:60,代码来源:lib_polyline.cpp

示例2: FormatSize

wxInt32 CViewTransfers::FormatSize(double fBytesSent, double fFileSize, wxString& strBuffer) const {
    double          xTera = 1099511627776.0;
    double          xGiga = 1073741824.0;
    double          xMega = 1048576.0;
    double          xKilo = 1024.0;

    if (fFileSize != 0) {
        if      (fFileSize >= xTera) {
            strBuffer.Printf(wxT("%0.2f/%0.2f TB"), fBytesSent/xTera, fFileSize/xTera);
        } else if (fFileSize >= xGiga) {
            strBuffer.Printf(wxT("%0.2f/%0.2f GB"), fBytesSent/xGiga, fFileSize/xGiga);
        } else if (fFileSize >= xMega) {
            strBuffer.Printf(wxT("%0.2f/%0.2f MB"), fBytesSent/xMega, fFileSize/xMega);
        } else if (fFileSize >= xKilo) {
            strBuffer.Printf(wxT("%0.2f/%0.2f KB"), fBytesSent/xKilo, fFileSize/xKilo);
        } else {
            strBuffer.Printf(wxT("%0.0f/%0.0f bytes"), fBytesSent, fFileSize);
        }
    } else {
        if      (fBytesSent >= xTera) {
            strBuffer.Printf(wxT("%0.2f TB"), fBytesSent/xTera);
        } else if (fBytesSent >= xGiga) {
            strBuffer.Printf(wxT("%0.2f GB"), fBytesSent/xGiga);
        } else if (fBytesSent >= xMega) {
            strBuffer.Printf(wxT("%0.2f MB"), fBytesSent/xMega);
        } else if (fBytesSent >= xKilo) {
            strBuffer.Printf(wxT("%0.2f KB"), fBytesSent/xKilo);
        } else {
            strBuffer.Printf(wxT("%0.0f bytes"), fBytesSent);
        }
    }

    return 0;
}
开发者ID:niclaslockner,项目名称:boinc,代码行数:34,代码来源:ViewTransfers.cpp

示例3: SizeToSizeLabel

/** Receive the size of file and devolve your respective string in bytes, Kbytes, MBytes or GBytes.
* @param[in] size. File Size.
* @param[out] label. String containing the size in format described above.
* Private method.
*/
void ReceiveFilesFrame::SizeToSizeLabel(unsigned long size, wxString &label)
{
	// show in GBytes
	if((size/1073741824) > 0)
	{
		label.Printf(wxT("%d.%d GB"), size/1073741824, ((size*100)/1073741824)%100);
		return;
	}

	// show in MBytes
	if((size/1048576) > 0)
	{
		label.Printf(wxT("%d.%d MB"), size/1048576, ((size*100)/1048576)%100);
		return;
	}

	// show in KBytes
	if((size/1024) > 0)
	{
		label.Printf(wxT("%d.%d kB"), size/1024, ((size*10)/1024)%10);
		return;
	}

	// show in bytes
	label.Printf(wxT("%d Bytes"), size);
	return;
}
开发者ID:xiaobinshe,项目名称:multitv,代码行数:32,代码来源:ReceiveFilesFrame.cpp

示例4: sprintPinNetName

void NETLIST_EXPORTER::sprintPinNetName( wxString& aResult,
                                    const wxString& aNetNameFormat, NETLIST_OBJECT* aPin,
                                    bool aUseNetcodeAsNetName )
{
    int netcode = aPin->GetNet();

    // Not wxString::Clear(), which would free memory.  We want the worst
    // case wxString memory to grow to avoid reallocation from within the
    // caller's loop.
    aResult.Empty();

    if( netcode != 0 && aPin->GetConnectionType() == PAD_CONNECT )
    {
        if( aUseNetcodeAsNetName )
        {
            aResult.Printf( wxT("%d"), netcode );
        }
        else
        {
        aResult = aPin->GetNetName();

        if( aResult.IsEmpty() )     // No net name: give a name from net code
            aResult.Printf( aNetNameFormat.GetData(), netcode );
        }
    }
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:26,代码来源:netlist_exporter.cpp

示例5: Load

bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
    char      Name1[256];
    char      Name2[256];
    char      Name3[256];
    int       thickness = 0, size = 0, orient = 0;

    Name1[0] = 0; Name2[0] = 0; Name3[0] = 0;

    char*     sline = (char*) aLine;

    while( ( *sline != ' ' ) && *sline )
        sline++;

    // sline points the start of parameters
    int ii = sscanf( sline, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.y,
                     &orient, &size, Name2, Name3, &thickness );

    if( ii < 4 )
    {
        aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ),
                          aLine.LineNumber() );
        return false;
    }

    if( !aLine.ReadLine() )
    {
        aErrorMsg.Printf( wxT( "Eeschema file label load error atline %d" ),
                          aLine.LineNumber() );
        return false;
    }

    if( size == 0 )
        size = DEFAULT_SIZE_TEXT;

    char* text = strtok( (char*) aLine, "\n\r" );

    if( text == NULL )
    {
        aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ),
                          aLine.LineNumber() );
        return false;
    }

    m_Text = FROM_UTF8( text );
    m_Size.x = m_Size.y = size;
    SetOrientation( orient );

    if( isdigit( Name3[0] ) )
    {
        thickness = atol( Name3 );
        m_Bold = ( thickness != 0 );
        m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0;
    }

    if( stricmp( Name2, "Italic" ) == 0 )
        m_Italic = 1;

    return true;
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:60,代码来源:sch_text.cpp

示例6: CreateDigitFormatStr

 void CreateDigitFormatStr() {
    if (range > 1)
       digits = (int)ceil(log10(range-1.0));
    else
       digits = 5; // hack: default
    if (zeropad && range>1)
       formatStr.Printf(wxT("%%0%dd"), digits); // ex. "%03d" if digits is 3
    else {
       formatStr.Printf(wxT("%%0%dd"), digits);
    }
 }
开发者ID:tuanmasterit,项目名称:audacity,代码行数:11,代码来源:TimeTextCtrl.cpp

示例7: FindFirst

/**
 * Doku see wxFileSystemHandler
 */
wxString wxChmFSHandler::FindFirst(const wxString& spec, int flags)
{
    wxString right = GetRightLocation(spec);
    wxString left = GetLeftLocation(spec);
    wxString nativename = wxFileSystem::URLToFileName(left).GetFullPath();

    if ( GetProtocol(left) != _T("file") )
    {
        wxLogError(_("CHM handler currently supports only local files!"));
        return wxEmptyString;
    }

    m_chm = new wxChmTools(wxFileName(nativename));
    m_pattern = right.AfterLast(_T('/'));

    wxString m_found = m_chm->Find(m_pattern);

    // now fake around hhp-files which are not existing in projects...
    if (m_found.empty() &&
        m_pattern.Contains(_T(".hhp")) &&
        !m_pattern.Contains(_T(".hhp.cached")))
    {
        m_found.Printf(_T("%s#chm:%s.hhp"),
                       left.c_str(), m_pattern.BeforeLast(_T('.')).c_str());
    }

    return m_found;

}
开发者ID:gitrider,项目名称:wxsj2,代码行数:32,代码来源:chm.cpp

示例8: GetBuildVersion

/**
 * Function GetBuildVersion
 * Return the build date and version
 */
wxString GetBuildVersion()
{
    static wxString msg;
    msg.Printf( wxT("%s-%s"),
        wxT( KICAD_BUILD_VERSION ), wxT( VERSION_STABILITY ));
    return msg;
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:11,代码来源:build_version.cpp

示例9: ExplodeMessage

void SjLogGui::ExplodeMessage(const wxString& all___, unsigned long& severity, unsigned long& time, wxString& msg, wxString& scope)
{
	wxString temp;

	// get and strip severity
	temp = all___.BeforeFirst(wxT('|'));
	temp.ToULong(&severity);
	msg = all___.AfterFirst(wxT('|'));

	// get and strip time
	temp = msg.BeforeFirst(wxT('|'));
	temp.ToULong(&time);
	msg = msg.AfterFirst(wxT('|'));

	// now "msg" is message and optional scope enclosured by "[]"
	scope.Empty();
	int p = msg.Find(wxT('['), true/*from end*/);
	if( p!=-1 )
	{
		scope = msg.Mid(p+1);
		if( scope.Len()>=1 && scope.Last()==wxT(']') )
		{
			scope = scope.Left(scope.Len()-1);
			msg = msg.Left(p).Trim();
		}
	}

	// some finalizing translations (some stuff is logged before the translation system is available)
	if( msg.StartsWith(wxT("Loading "), &temp) )
	{
		msg.Printf(_("Loading %s"), temp.c_str());
	}
}
开发者ID:conradstorz,项目名称:silverjuke,代码行数:33,代码来源:console.cpp

示例10: serviceMain

void CALLBACK serviceMain(DWORD argc, LPTSTR *argv)
{
	serviceName.Printf(wxT("%s"), (const char *)argv[0]);
	serviceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
	serviceStatus.dwCurrentState = SERVICE_START_PENDING;
	serviceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE;
	serviceStatus.dwWin32ExitCode = 0;
	serviceStatus.dwCheckPoint = 0;
	serviceStatus.dwWaitHint = 15000;
	serviceStatusHandle = RegisterServiceCtrlHandler(serviceName.c_str(), serviceHandler);
	if (serviceStatusHandle)
	{
		SetServiceStatus(serviceStatusHandle, &serviceStatus);
		if (initService())
		{
			serviceStatus.dwCurrentState = SERVICE_RUNNING;
			serviceStatus.dwWaitHint = 1000;
		}
		else
			serviceStatus.dwCurrentState = SERVICE_STOPPED;

		SetServiceStatus(serviceStatusHandle, &serviceStatus);


	}
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例11: FormatProgress

wxInt32 CViewTransfersGrid::FormatProgress(wxInt32 item, wxString& strBuffer) const {
    float          fBytesSent = 0;
    float          fFileSize = 0;
    FILE_TRANSFER* transfer = wxGetApp().GetDocument()->file_transfer(item);

    if (transfer) {
        fBytesSent = transfer->bytes_xferred;
        fFileSize = transfer->nbytes;
    }

    // Curl apparently counts the HTTP header in byte count.
    // Prevent this from causing > 100% display
    //
    if (fBytesSent > fFileSize) {
        fBytesSent = fFileSize;
    }

    if ( 0.0 == fFileSize ) {
        strBuffer = wxT("0%");
    } else {
        strBuffer.Printf(wxT("%.2f%%"), floor((fBytesSent / fFileSize) * 10000)/100);
    }

    return 0;
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:25,代码来源:ViewTransfersGrid.cpp

示例12: toString

void cguid::toString( wxString& strGUID  )
{
    strGUID.Printf( _( "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X" ),
                    m_id[0], m_id[1], m_id[2], m_id[3],
                    m_id[4], m_id[5], m_id[6], m_id[7],
                    m_id[8], m_id[9], m_id[10], m_id[11],
                    m_id[12], m_id[13], m_id[14], m_id[15] );
}
开发者ID:dinguluer,项目名称:vscp_software,代码行数:8,代码来源:guid.cpp

示例13: FormatExtent

void ExtentDlg::FormatExtent(wxString &str, double value)
{
	if (m_bDMS)
	{
		bool sign = value > 0;
		value = fabs(value);
		int degrees = (int) value;
		value = (value - degrees) * 60;
		int minutes = (int) value;
		value = (value - minutes) * 60;
		double seconds = value;

		str.Printf(_T("%s%d %d %.2lf"), sign?"":"-", degrees, minutes, seconds);
	}
	else
		str.Printf(m_fs, value);
}
开发者ID:kamalsirsa,项目名称:vtp,代码行数:17,代码来源:ExtentDlg.cpp

示例14: FormatDiskSpace

wxInt32 CViewResources::FormatDiskSpace(double bytes, wxString& strBuffer) const {
    double         xTera = 1099511627776.0;
    double         xGiga = 1073741824.0;
    double         xMega = 1048576.0;
    double         xKilo = 1024.0;

    if (bytes >= xTera) {
        strBuffer.Printf(wxT("%0.2f TB"), bytes/xTera);
    } else if (bytes >= xGiga) {
        strBuffer.Printf(wxT("%0.2f GB"), bytes/xGiga);
    } else if (bytes >= xMega) {
        strBuffer.Printf(wxT("%0.2f MB"), bytes/xMega);
    } else {
        strBuffer.Printf(wxT("%0.2f KB"), bytes/xKilo);
    }

    return 0;
}
开发者ID:williamsullivan,项目名称:AndroidBOINC,代码行数:18,代码来源:ViewResources.cpp

示例15: MakeBlockFileName

void DirManager::MakeBlockFileName(wxString inProjDir,
                                   wxString &outFileName,
                                   wxString &outPathName)
{
   do {
      outFileName.Printf("b%05d.auf", fileIndex++);
      outPathName = inProjDir + pathChar + outFileName;
   } while (wxFileExists(outPathName));
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:9,代码来源:DirManager.cpp


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