本文整理汇总了C++中wxLongLong类的典型用法代码示例。如果您正苦于以下问题:C++ wxLongLong类的具体用法?C++ wxLongLong怎么用?C++ wxLongLong使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxLongLong类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FormatNumber
wxString CSizeFormatBase::FormatNumber(COptionsBase* pOptions, const wxLongLong& size, bool* thousands_separator /*=0*/)
{
if ((thousands_separator && !*thousands_separator) || pOptions->GetOptionVal(OPTION_SIZE_USETHOUSANDSEP) == 0)
return size.ToString();
const wxString& sep = GetThousandsSeparator();
if (sep.empty())
return size.ToString();
wxString tmp = size.ToString();
const int len = tmp.Len();
if (len <= 3)
return tmp;
wxString result;
int i = (len - 1) % 3 + 1;
result = tmp.Left(i);
while (i < len)
{
result += sep + tmp.Mid(i, 3);
i += 3;
}
return result;
}
开发者ID:bugiii,项目名称:filezilla3ex,代码行数:25,代码来源:sizeformatting_base.cpp
示例2: FormatSize
wxString DirectoriesPrefs::FormatSize(wxLongLong size)
{
wxString sizeStr;
/* wxLongLong contains no built-in conversion to double */
double dSize = size.GetHi() * pow(2, 32); // 2 ^ 32
dSize += size.GetLo();
if (size == -1L)
sizeStr = _("Unable to determine");
else {
/* make it look nice, by formatting into k, MB, etc */
if (size < 1024)
sizeStr.sprintf("%ld bytes", size.GetLo());
else if (size < 1024 * 1024) {
sizeStr.sprintf("%.1f kB", dSize / 1024);
}
else if (size < 1024 * 1024 * 1024) {
sizeStr.sprintf("%.1f MB", dSize / (1024 * 1024));
}
else {
sizeStr.sprintf("%.1f GB", dSize / (1024 * 1024 * 1024));
}
}
return sizeStr;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:27,代码来源:DirectoriesPrefs.cpp
示例3: FormatSize
wxString Internat::FormatSize(wxLongLong size)
{
/* wxLongLong contains no built-in conversion to double */
double dSize = size.GetHi() * pow(2.0, 32); // 2 ^ 32
dSize += size.GetLo();
return FormatSize(dSize);
}
开发者ID:nicklecoder,项目名称:Audacity,代码行数:8,代码来源:Internat.cpp
示例4: wxGetLocalTimeMillis
/*****************************************************
**
** Painter --- drawMString
**
******************************************************/
void Painter::drawMString( const MRect &r, MString &f, const int& align )
{
#ifdef SHOW_STOP_WATCH
static wxLongLong totaltime = 0;
const wxLongLong starttime = wxGetLocalTimeMillis();
#endif
static int count = 0;
SheetFormatter sfmt;
wxString s;
if ( f.formattedLines.size() == 0 )
{
if ( ! f.isEmpty() && f.size.real() == 0 )
{
s = sfmt.fragment2PlainText( f );
//printf( "Painter::drawMString - old size %f %f\n", f.size.real(), f.size.imag());
f.size = getTextExtent( f );
printf( "Painter::drawMString - size not set #%d contents was %s, size now %f %f\n", count++, str2char( s ), f.size.real(), f.size.imag());
}
drawSingleMStringLine( r, f, align );
//return;
}
else
{
double y0 = r.y;
if ( align & Align::Top )
{
// nothing
}
else if ( align & Align::Bottom )
{
y0 = y0 + r.height - f.size.imag();
}
else // default: align & align::VCenter
{
y0 += .5 * ( r.height - f.size.imag());
}
MRect rect( r.x, y0, r.width, r.height );
int line = 0;
for( list<MString>::iterator iter = f.formattedLines.begin(); iter != f.formattedLines.end(); iter++ )
{
line++;
rect.height = iter->size.imag();
//printf( " --->>> Line %d width %f h %f\n", line, iter->size.real(), iter->size.imag() );
drawSingleMStringLine( rect, *iter, align );
rect.y += rect.height;
}
}
#ifdef SHOW_STOP_WATCH
const wxLongLong duration = wxGetLocalTimeMillis() - starttime;
totaltime += duration;
wxLogMessage( wxString::Format( wxT( "Painter::drawTextFormatted in %ld msec, total %ld" ), duration.ToLong(), totaltime.ToLong() ));
#endif
}
开发者ID:martin-pe,项目名称:maitreya8,代码行数:63,代码来源:Painter.cpp
示例5: NumToStr
wxString NumToStr(wxLongLong value)
{
wxString str;
#if wxCHECK_VERSION(2, 9, 0)
str.Printf("%" wxLongLongFmtSpec "d", value.GetValue());
#else
str.Printf(wxT("%") wxLongLongFmtSpec wxT("d"), value.GetValue());
#endif
return str;
}
开发者ID:swflb,项目名称:pgadmin3,代码行数:10,代码来源:misc.cpp
示例6: ElapsedTimeToStr
wxString ElapsedTimeToStr(wxLongLong msec)
{
wxTimeSpan tsMsec(0, 0, 0, msec);
int days = tsMsec.GetDays();
int hours = (wxTimeSpan(tsMsec.GetHours(), 0, 0, 0) - wxTimeSpan(days * 24)).GetHours();
int minutes = (wxTimeSpan(0, tsMsec.GetMinutes(), 0, 0) - wxTimeSpan(hours)).GetMinutes();
long seconds = (wxTimeSpan(0, 0, tsMsec.GetSeconds(), 0) - wxTimeSpan(0, minutes)).GetSeconds().ToLong();
long milliseconds = (wxTimeSpan(0, 0, 0, tsMsec.GetMilliseconds()) - wxTimeSpan(0, 0, seconds)).GetMilliseconds().ToLong();
if (days > 0)
return wxString::Format(
wxT("%d %s, %02d:%02d:%02ld hours"),
days, wxT("days"), hours, minutes, seconds
);
else if (hours > 0)
return wxString::Format(
wxT("%02d:%02d:%02ld hours"), hours, minutes, seconds
);
else if (msec >= 1000 * 60)
return wxString::Format(wxT("%02d:%02ld minutes"), minutes, seconds);
else if (msec >= 1000)
return wxString::Format(
wxT("%ld.%ld secs"), seconds, milliseconds / 100
);
else
return msec.ToString() + wxT(" msec");
}
开发者ID:swflb,项目名称:pgadmin3,代码行数:28,代码来源:misc.cpp
示例7: UpdateCallback
virtual void UpdateCallback(wxUpdateType type,
const wxString& database, const wxString& table,
wxLongLong rowid)
{
const char* strType;
cout << "Here is the UPDATE callback" << endl;
switch (type)
{
case SQLITE_DELETE:
strType = "DELETE row ";
break;
case SQLITE_INSERT:
strType = "INSERT row ";
break;
case SQLITE_UPDATE:
strType = "UPDATE row ";
break;
default:
strType = "Unknown change row ";
break;
}
cout << strType << (const char*) rowid.ToString().mb_str()
<< " in table " << (const char*) table.mb_str()
<< " of database " << (const char*) database.mb_str() << endl;
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:25,代码来源:minimal.cpp
示例8: ReadString
wxLongLong TIniFile::ReadLongLong(const wxString &Section, const wxString &Ident,
wxLongLong Default)
{
wxString str = ReadString(Section, Ident, Default.ToString());
wxLongLong lng = StrToLongLong(str);
return lng;
}
开发者ID:gkathire,项目名称:wxVCL,代码行数:7,代码来源:inifiles.cpp
示例9: FormatSize
wxString COptionsPageSizeFormatting::FormatSize(const wxLongLong& size)
{
const CSizeFormat::_format format = GetFormat();
const bool thousands_separator = GetCheck(XRCID("ID_SIZEFORMAT_SEPARATE_THOUTHANDS"));
const int num_decimal_places = XRCCTRL(*this, "ID_SIZEFORMAT_DECIMALPLACES", wxSpinCtrl)->GetValue();
return CSizeFormat::Format(size.GetValue(), false, format, thousands_separator, num_decimal_places);
}
开发者ID:juaristi,项目名称:filezilla,代码行数:8,代码来源:optionspage_sizeformatting.cpp
示例10: wxGetLocalTimeMillis
/*****************************************************
**
** SheetWidget --- doPaint
**
******************************************************/
void SheetWidget::doPaint( const wxRect &rect, const bool eraseBackground )
{
#ifdef SCROLLABLE_PAGE_WIDGET_SHOW_STOP_WATCH
const wxLongLong starttime = wxGetLocalTimeMillis();
#endif
// may have changed
writer->setSheetConfig( getSheetConfig() );
assert( painter );
painter->writercfg = sheet->writercfg;
painter->colorcfg = colorcfg;
//printf( "RECT x %d y %d w %d h %d\n", rect.x, rect.y, rect.width, rect.height );
MRect therect( rect );
//printf( "SheetWidget::doPaint xviewport %d yviewport %d erase = %d DIRTY %d\n", xviewport, yviewport, eraseBackground, dirty );
// dirty ist okay. kommt bei echten Updates und Resize. nicht bei Scroll, mouse over usw.
if ( dirty )
{
init();
calculateContentSize();
initViewPort();
dirty = false;
}
painter->setBrush( config->colors->bgColor );
painter->setTransparentPen();
painter->drawRectangle( rect );
painter->setTransparentPen();
writer->drawSheet( painter, therect, eraseBackground );
#ifdef SCROLLABLE_PAGE_WIDGET_SHOW_STOP_WATCH
const wxLongLong totaltime = wxGetLocalTimeMillis() - starttime;
wxLogMessage( wxString::Format( wxT( "SheetWidget::doPaint in %ld millisec eraseBackground %d" ),
totaltime.ToLong(), eraseBackground ));
#endif
}
开发者ID:martin-pe,项目名称:maitreya8,代码行数:46,代码来源:SheetWidget.cpp
示例11: OnPong
void ServerEvents::OnPong(wxLongLong ping_time)
{
//wxLongLong is non-POD and cannot be passed to wxString::Format as such. use c-string rep instead. converting to long might loose precision
UiEvents::StatusData data(wxString::Format(_("ping: %s ms"), ping_time.ToString().c_str()), 2);
UiEvents::GetStatusEventSender(UiEvents::addStatusMessage).SendEvent(data);
}
开发者ID:OursDesCavernes,项目名称:springlobby,代码行数:6,代码来源:serverevents.cpp
示例12: wxASSERT
wxString CSizeFormatBase::Format(COptionsBase* pOptions, wxLongLong size, bool add_bytes_suffix, enum CSizeFormatBase::_format format, bool thousands_separator, int num_decimal_places)
{
wxASSERT(format != formats_count);
wxASSERT(size >= 0);
if( size < 0 ) {
size = 0;
}
if (format == bytes) {
wxString result = FormatNumber(pOptions, size, &thousands_separator);
if (!add_bytes_suffix)
return result;
else
{
// wxPLURAL has no support for wxLongLong
int last;
if (size > 1000000000)
last = (1000000000 + (size % 1000000000)).GetLo();
else
last = size.GetLo();
return wxString::Format(wxPLURAL("%s byte", "%s bytes", last), result);
}
}
wxString places;
int divider;
if (format == si1000)
divider = 1000;
else
divider = 1024;
// Exponent (2^(10p) or 10^(3p) depending on option
int p = 0;
wxLongLong r = size;
int remainder = 0;
bool clipped = false;
while (r > divider && p < 6) {
const wxLongLong rr = r / divider;
if (remainder != 0)
clipped = true;
remainder = (r - rr * divider).GetLo();
r = rr;
++p;
}
if (!num_decimal_places) {
if (remainder != 0 || clipped)
++r;
}
else if (p) { // Don't add decimal places on exact bytes
if (format != si1000) {
// Binary, need to convert 1024 into range from 1-1000
if (clipped) {
++remainder;
clipped = false;
}
remainder = (int)ceil((double)remainder * 1000 / 1024);
}
int max;
switch (num_decimal_places)
{
default:
num_decimal_places = 1;
// Fall-through
case 1:
max = 9;
divider = 100;
break;
case 2:
max = 99;
divider = 10;
break;
case 3:
max = 999;
break;
}
if (num_decimal_places != 3) {
if (remainder % divider)
clipped = true;
remainder /= divider;
}
if (clipped)
remainder++;
if (remainder > max) {
r++;
remainder = 0;
}
places.Printf(_T("%d"), remainder);
const size_t len = places.Len();
for (size_t i = len; i < static_cast<size_t>(num_decimal_places); ++i)
places = _T("0") + places;
}
wxString result = r.ToString();
//.........这里部分代码省略.........
开发者ID:bugiii,项目名称:filezilla3ex,代码行数:101,代码来源:sizeformatting_base.cpp
示例13: SetSettingLong
void eSettings::SetSettingLong(const wxString& name, const wxLongLong& value) {
wxJSONValue& settings = m_jsonRoot[wxT("settings")];
settings[name] = value.GetValue();
}
开发者ID:boulerne,项目名称:e,代码行数:4,代码来源:eSettings.cpp
示例14: WriteLongLong
void TIniFile::WriteLongLong(const wxString &Section, const wxString &Ident,
wxLongLong Value)
{
WriteString(Section, Ident, Value.ToString());
}
开发者ID:gkathire,项目名称:wxVCL,代码行数:5,代码来源:inifiles.cpp
注:本文中的wxLongLong类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论