// @topic T060m10d25x10 class DString -- using dynamic array of characters
// @brief class DString declaration

// DString.h
#ifndef DSTRING_H_INCLUDED
#define DSTRING_H_INCLUDED

#include <iostream>

class DString {
    // friends of this class have access to all private members of this class:
    friend std::ostream& operator<<(std::ostream& cout, DString const& str);
    friend std::istream& operator>>(std::istream& cin, DString& str);

    // data members
    static const size_t INITIAL_CAPACITY = 1;
    char* m_array;
    size_t m_length; // logical length of the string
    size_t m_capacity; // current capacity of the object

public:
    // constructors
    DString();
    DString( char const* pstr );

    // operations
    size_t length() const;
    size_t capacity() const;
    void allocate( size_t capacity );

};//class DString

// free functions that supplement DString:
std::ostream& operator<<( std::ostream& cout, DString const& str );
std::istream& operator>>(std::istream& cin, DString& str);

#endif //DSTRING_H_INCLUDED