Skip to content

Commit

Permalink
make playdar_response::init private (safer that way)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougma committed Jun 17, 2009
1 parent 64fde6d commit 151a5d6
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions includes/playdar/playdar_response.h
Expand Up @@ -39,7 +39,31 @@ class playdar_response {
{
init( s.c_str(), isBody );
}

void add_header( const std::string& k, const std::string& v, bool replace = true )
{
if( replace || m_headers.find(k) == m_headers.end() )
m_headers[k] = v;
}

void set_response_code( const int code )
{
m_responseCode = code;
}

operator const std::string &() const
{
return m_string;
}

const std::string& str() const{ return m_string; }

int response_code() const{ return m_responseCode; }
const std::map<std::string,std::string>& headers() const{ return m_headers; }

bool is_valid(){ return m_valid; }

private:
void init( const char* s, bool isBody )
{
add_header( "Content-Type", "text/html" );
Expand Down Expand Up @@ -76,30 +100,6 @@ class playdar_response {
m_string = r.str();
}

void add_header( const std::string& k, const std::string& v, bool replace = true )
{
if( replace || m_headers.find(k) == m_headers.end() )
m_headers[k] = v;
}

void set_response_code( const int code )
{
m_responseCode = code;
}

operator const std::string &() const
{
return m_string;
}

const std::string& str() const{ return m_string; }

int response_code() const{ return m_responseCode; }
const std::map<std::string,std::string>& headers() const{ return m_headers; }

bool is_valid(){ return m_valid; }

private:
std::string m_string;
std::map<std::string,std::string> m_headers;
int m_responseCode;
Expand Down

0 comments on commit 151a5d6

Please sign in to comment.