2016-03-29 16:58:52 +02:00
|
|
|
#ifndef GB_ROBOTRULE_H
|
|
|
|
#define GB_ROBOTRULE_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2016-04-19 16:03:11 +02:00
|
|
|
#include <string>
|
2016-03-29 16:58:52 +02:00
|
|
|
|
|
|
|
class Url;
|
|
|
|
|
|
|
|
class RobotRule {
|
|
|
|
public:
|
|
|
|
RobotRule( bool isAllow, const char *path, int32_t pathLen );
|
|
|
|
|
|
|
|
bool isMatching( Url *url ) const;
|
|
|
|
|
|
|
|
bool isAllow() const {
|
|
|
|
return m_isAllow;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t getPathLen() const {
|
|
|
|
return m_pathLen;
|
|
|
|
}
|
|
|
|
|
|
|
|
void print( int level = 0 ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_isAllow;
|
2016-04-19 16:03:11 +02:00
|
|
|
|
2016-03-29 16:58:52 +02:00
|
|
|
const char *m_path;
|
|
|
|
int32_t m_pathLen;
|
2016-04-19 16:03:11 +02:00
|
|
|
std::string m_pathNormalized;
|
2016-03-29 16:58:52 +02:00
|
|
|
|
|
|
|
bool m_wildcardFound;
|
2016-03-31 00:03:49 +02:00
|
|
|
int32_t m_wildcardCount;
|
|
|
|
|
2016-03-29 16:58:52 +02:00
|
|
|
bool m_lineAnchorFound;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool operator> ( const RobotRule& lhs, const RobotRule& rhs ) {
|
|
|
|
return ( lhs.getPathLen() > rhs.getPathLen() );
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // GB_ROBOTRULE_H
|