Esempio n. 1
0
TUint Ascii::AppendDec(Bwx& aBuffer, TInt64 aValue)
{
    Bws<20> reversed; // Maximum value requires 20 digits

    if (aValue == 0) {
        aBuffer.Append('0');
        return (1);
    }

    TUint extra = 0;

    if (aValue < 0) {
        aBuffer.Append('-');
        extra++;
    }

    while(aValue != 0) {
        reversed.Append((TChar)('0' + abs((TInt)(aValue % 10))));
        aValue = aValue / 10;
    }

    for (TUint i = reversed.Bytes(); i > 0; i--) {
        aBuffer.Append(reversed[i - 1]);
    }

    return (reversed.Bytes() + extra);
}
Esempio n. 2
0
void MdnsPlatform::AppendTxtRecord(Bwx& aBuffer, const TChar* aKey, const TChar* aValue)
{
    ASSERT((strlen(aKey) + strlen(aValue) + 3) <= (aBuffer.MaxBytes()-aBuffer.Bytes()));
    TByte length = (TByte)(strlen(aKey) + strlen(aValue) + 1);
    aBuffer.Append(length);
    aBuffer.Append(aKey);
    aBuffer.Append('=');
    aBuffer.Append(aValue);
}
Esempio n. 3
0
void DviDevice::GetUriBase(Bwx& aUriBase, TIpAddress aInterface, TUint aPort, IDvProtocol& aProtocol)
{
    const Brx& name = aProtocol.ProtocolName();
    aUriBase.Append(Http::kUriPrefix);
    Endpoint endpt(aPort, aInterface);
    Endpoint::EndpointBuf buf;
    endpt.AppendEndpoint(buf);
    aUriBase.Append(buf);
    aUriBase.Append('/');
    Uri::Escape(aUriBase, iUdn);
    aUriBase.Append('/');
    aUriBase.Append(name);
    aUriBase.Append('/');
}
Esempio n. 4
0
File: Fifo.cpp Progetto: ACDN/ohNet
void FifoByte::Read(Bwx& aBuffer, TUint aBytes)
{
    aBuffer.SetBytes(0);
    for (TUint i = 0; i < aBytes; i++) {
        aBuffer.Append(Fifo<TByte>::Read());
    }
}
Esempio n. 5
0
void ReaderBinary::ReadReplace(TUint aBytes, Bwx& aBuffer)
{
    ASSERT(aBytes <= aBuffer.MaxBytes());
    aBuffer.SetBytes(0);
    while (aBytes > 0) {
        Brn buf = iReader.Read(aBytes);
        aBuffer.Append(buf);
        aBytes -= buf.Bytes();
    }
}
Esempio n. 6
0
TUint Ascii::AppendDec(Bwx& aBuffer, TUint64 aValue)
{
    Bws<20> reversed; // Maximum value requires 20 digits

    if (aValue == 0) {
        aBuffer.Append('0');
        return (1);
    }

    while(aValue > 0) {
        reversed.Append((TChar)('0' + aValue % 10));
        aValue = aValue / 10;
    }

    for (TUint i = reversed.Bytes(); i > 0; i--) {
        aBuffer.Append(reversed[i - 1]);
    }

    return (reversed.Bytes());
}
Esempio n. 7
0
void DviProtocolUpnp::GetUriDeviceXml(Bwx& aUri, const Brx& aUriBase)
{
    aUri.Replace(aUriBase);
    aUri.Append(kDeviceXmlName);
}