// @topic T050m10d25x20 class DString -- using fixed-size array of characters
// @brief class DString implementation

// DString.cpp
#include "DString.h"

DString::DString()
    :
    m_length( 0 )
{
}

size_t DString::length() const
{
    return m_length;
}//DString::DString


std::ostream& operator<<(std::ostream& cout, DString const& str)
{
    for (size_t idx = 0; idx < str.length(); ++idx ) {
        cout << str.m_array[idx];
    }
    return cout;
}//operator<<


std::istream& operator>>(std::istream& cin, DString& str)
{
    str.m_length = 0;
    while ( cin ) {
        int ch = cin.get(); // extract a single character form cin
        if ( ch == '\n' ) break;
        str.m_array[ str.m_length ] = ch;
        ++str.m_length;
    }
    return cin;
}//operator>>