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


C++ wxLongLong::GetLo方法代码示例

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


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

示例1: 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

示例2: 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

示例3: Format

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


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