#ifndef AGENT_CPP_H
#define AGENT_CPP_H

#include <vector>

#include "directive.h"

// forward declaration
namespace Url
{
    class Url;
}

namespace Rep
{
    class Agent
    {
    public:
        /* The type for the delay. */
        typedef float delay_t;

        /**
         * Construct an agent.
         */
        explicit Agent(const std::string& host) :
            directives_(), delay_(-1.0), sorted_(true), host_(host) {}

        /**
         * Add an allowed directive.
         */
        Agent& allow(const std::string& query);

        /**
         * Add a disallowed directive.
         */
        Agent& disallow(const std::string& query);

        /**
         * Set the delay for this agent.
         */
        Agent& delay(delay_t value) {
            delay_ = value;
            return *this;
        }

        /**
         * Return the delay for this agent.
         */
        delay_t delay() const { return delay_; }

        /**
         * A vector of the directives, in priority-sorted order.
         */
        const std::vector<Directive>& directives() const;

        /**
         * Return true if the URL (either a full URL or a path) is allowed.
         */
        bool allowed(const std::string& path) const;

        std::string str() const;

    private:
        bool is_external(const Url::Url& url) const;

        mutable std::vector<Directive> directives_;
        delay_t delay_;
        mutable bool sorted_;
        std::string host_;
    };
}

#endif

#ifndef AGENT_CPP_H
#define AGENT_CPP_H

#include <vector>

#include "directive.h"

// forward declaration
namespace Url
{
    class Url;
}

namespace Rep
{
    class Agent
    {
    public:
        /* The type for the delay. */
        typedef float delay_t;

        /**
         * Default constructor
         */
        Agent() : Agent("") {}

        /**
         * Construct an agent.
         */
        explicit Agent(const std::string& host) :
            directives_(), delay_(-1.0), sorted_(true), host_(host) {}

        /**
         * Add an allowed directive.
         */
        Agent& allow(const std::string& query);

        /**
         * Add a disallowed directive.
         */
        Agent& disallow(const std::string& query);

        /**
         * Set the delay for this agent.
         */
        Agent& delay(delay_t value) {
            delay_ = value;
            return *this;
        }

        /**
         * Return the delay for this agent.
         */
        delay_t delay() const { return delay_; }

        /**
         * A vector of the directives, in priority-sorted order.
         */
        const std::vector<Directive>& directives() const;

        /**
         * Return true if the URL (either a full URL or a path) is allowed.
         */
        bool allowed(const std::string& path) const;

        std::string str() const;

    private:
        bool is_external(const Url::Url& url) const;

        mutable std::vector<Directive> directives_;
        delay_t delay_;
        mutable bool sorted_;
        std::string host_;
    };
}

#endif

Add back default constructor for Agent.
Add back default constructor for Agent.

Previously, this was removed in #28, but the Cython bindings in reppy
*really* want there to be a default constructor, so I'm adding it back
for convenience.
