Ejemplo n.º 1
0
BaseFormat& BaseFormat::Put(LPCWSTR Data, size_t Length)
{
    if (Precision == fmt::Precision::GetDefault())
    {
        Precision = Length;
    }

    string OutStr(Data, Min(Precision, Length));

    if (Align == fmt::A_RIGHT)
    {
        while (OutStr.GetLength() < Width)
        {
            OutStr.Insert(0, FillChar);
        }
    }
    else
    {
        while (OutStr.GetLength() < Width)
        {
            OutStr.Append(FillChar);
        }
    }

    Commit(OutStr);
    Reset();
    return *this;
}
Ejemplo n.º 2
0
BaseFormat& BaseFormat::Put(LPCWSTR Data, size_t Length)
{
	if (MaxWidth == fmt::MaxWidth::GetDefault())
	{
		MaxWidth = Length;
	}

	string OutStr(Data, std::min(MaxWidth, Length));

	if (OutStr.size() < MinWidth)
	{
		if (Align == fmt::A_RIGHT)
		{
			OutStr.insert(0, MinWidth - OutStr.size(), FillChar);
		}
		else
		{
			OutStr.append(MinWidth - OutStr.size(), FillChar);
		}
	}

	Commit(OutStr);
	Reset();
	return *this;
}