Function append

Summary

#include <include/EASTL/string.h>

(1) this_type & append(const this_type &x)

(2) this_type & append(const this_type &x, size_type position, size_type n=npos)

(3) this_type & append(const value_type *p, size_type n)

(4) this_type & append(const value_type *p)

(5) this_type & append(size_type n, value_type c)

(6) this_type & append(const value_type *pBegin, const value_type *pEnd)

Function overload

Synopsis

#include <include/EASTL/string.h>

this_type & append(const this_type &x)

Description

No description yet.

Source

Lines 1610-1614 in include/EASTL/string.h. Line 624 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::append(const this_type& x)
{
    return append(x.internalLayout().BeginPtr(), x.internalLayout().EndPtr());
}

Synopsis

#include <include/EASTL/string.h>

this_type & append(const this_type &x, size_type position, size_type n=npos)

Description

No description yet.

Source

Lines 1617-1627 in include/EASTL/string.h. Line 625 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::append(const this_type& x, size_type position, size_type n)
{
    #if EASTL_STRING_OPT_RANGE_ERRORS
        if(EASTL_UNLIKELY(position >= x.internalLayout().GetSize())) // position must be < x.mpEnd, but position + n may be > mpEnd.
            ThrowRangeException();
    #endif
        return append(x.internalLayout().BeginPtr() + position,
                      x.internalLayout().BeginPtr() + position + eastl::min_alt(n, x.internalLayout().GetSize() - position));
}

Synopsis

#include <include/EASTL/string.h>

this_type & append(const value_type *p, size_type n)

Description

No description yet.

Source

Lines 1630-1634 in include/EASTL/string.h. Line 626 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::append(const value_type* p, size_type n)
{
    return append(p, p + n);
}

Synopsis

#include <include/EASTL/string.h>

this_type & append(const value_type *p)

Description

No description yet.

Source

Lines 1637-1641 in include/EASTL/string.h. Line 627 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::append(const value_type* p)
{
    return append(p, p + CharStrlen(p));
}

Synopsis

#include <include/EASTL/string.h>

this_type & append(size_type n, value_type c)

Description

No description yet.

Source

Lines 1687-1704 in include/EASTL/string.h. Line 628 in include/EASTL/string.h.

template <typename T, typename Allocator>
basic_string<T, Allocator>& basic_string<T, Allocator>::append(size_type n, value_type c)
{
    if (n > 0)
    {
        const size_type nSize = internalLayout().GetSize();
        const size_type nCapacity = capacity();
        if((nSize + n) > nCapacity)
            reserve(GetNewCapacity(nCapacity, (nSize + n) - nCapacity));
        pointer pNewEnd = CharStringUninitializedFillN(internalLayout().EndPtr(), n, c);
        *pNewEnd = 0;
        internalLayout().SetSize(nSize + n);
    }
    return *this;
}

Synopsis

#include <include/EASTL/string.h>

this_type & append(const value_type *pBegin, const value_type *pEnd)

Description

No description yet.

Source

Lines 1707-1741 in include/EASTL/string.h. Line 629 in include/EASTL/string.h.

template <typename T, typename Allocator>
basic_string<T, Allocator>& basic_string<T, Allocator>::append(const value_type* pBegin, const value_type* pEnd)
{
    if(pBegin != pEnd)
    {
        const size_type nOldSize  = internalLayout().GetSize();
        const size_type n         = (size_type)(pEnd - pBegin);
        const size_type nCapacity = capacity();
        const size_type nNewSize = nOldSize + n;
        if(nNewSize > nCapacity)
        {
            const size_type nLength = GetNewCapacity(nCapacity, nNewSize - nCapacity);
            pointer pNewBegin = DoAllocate(nLength + 1);
            pointer pNewEnd = CharStringUninitializedCopy(internalLayout().BeginPtr(), internalLayout().EndPtr(), pNewBegin);
            pNewEnd         = CharStringUninitializedCopy(pBegin,  pEnd,  pNewEnd);
           *pNewEnd         = 0;
            DeallocateSelf();
            internalLayout().SetHeapBeginPtr(pNewBegin);
            internalLayout().SetHeapCapacity(nLength);
            internalLayout().SetHeapSize(nNewSize);
        }
        else
        {
            pointer pNewEnd = CharStringUninitializedCopy(pBegin, pEnd, internalLayout().EndPtr());
            *pNewEnd = 0;
            internalLayout().SetSize(nNewSize);
        }
    }
    return *this;
}





Add Discussion as Guest

Log in