winix/core/acceptencodingparser.h

94 lines
1.1 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_acceptencodingparser
#define headerfile_winix_core_acceptencodingparser
#include "acceptbaseparser.h"
#include "log.h"
namespace Winix
{
class AcceptEncodingParser : public AcceptBaseParser
{
public:
bool AcceptDeflate()
{
return accept_deflate;
}
bool AcceptGzip()
{
return accept_gzip;
}
void ParseAndLog(const char * str)
{
Parse(str);
if( accept_deflate || accept_gzip )
{
log << log3 << "AEP: ";
if( accept_deflate )
{
log << "accept deflate";
if( accept_gzip )
log << ", ";
}
if( accept_gzip )
log << "accept gzip";
log << logend;
}
}
private:
void Init()
{
accept_deflate = false;
accept_gzip = false;
}
void Param(const std::string & param, double q)
{
if( param=="deflate" && q!=0.0 )
{
accept_deflate = true;
}
if( param=="gzip" && q!=0.0 )
{
accept_gzip = true;
}
}
bool accept_deflate;
bool accept_gzip;
};
} // namespace Winix
#endif