5. Which design pattern is used in the following code?

#include <cassert>
#include <ostream>
#include <string>

class Archive
{
public:
    virtual void start_record() = 0;
    virtual void store_field(const std::string &name,
                             const std::string &value) = 0;
    virtual void finish_record() = 0;
    virtual ~Archive() { }
};

struct ContactData
{
    std::string first_name;
    std::string last_name;
    std::string phone;
    std::string email;
};

class ContactArchiver
{
public:
    ContactArchiver(Archive *a)
        : m_archive(a)
    {
        assert(a != nullptr);
    }

public:
    void store(const ContactData &c)
    {
        assert(m_archive != nullptr);

        m_archive->start_record();
        m_archive->store_field("first name", c.first_name);
        m_archive->store_field("last name", c.last_name);
        m_archive->store_field("phone", c.phone);
        m_archive->store_field("email", c.email);
        m_archive->finish_record();
    }

private:
    Archive *m_archive;
};

class StreamArchive
    : public Archive
{
public:
    StreamArchive(std::ostream &s,
                  const std::string &record_name = std::string())
        : m_ostream(s)
        , m_record_name(record_name)
    { }

public:
    void start_record() { m_ostream << m_record_name << "( "; }

    void store_field(const std::string &name, const std::string &value)
    {
        m_ostream << name << ": " << value << "; ";
    }

    void finish_record() { m_ostream << ")" << std::endl; }

public:
    void set_record_name(const std::string &n) { m_record_name = n; }

private:
    std::ostream &m_ostream;
    std::string m_record_name;
};

class DbArchive
    : public Archive
{
public:
    DbArchive(/* db connection */) { }

public:
    void start_record() { /* begin transaction */ }

    void store_field(const std::string &name, const std::string &value)
    { /* insert into table, rollback on error */ }

    void finish_record() { /* end transaction */ }

private:
    /* db connection object */
};