Skip to content

Commit

Permalink
rename KModel::getName to get_module
Browse files Browse the repository at this point in the history
  • Loading branch information
keengo99 committed Jan 16, 2025
1 parent ab7e2a5 commit 6197308
Show file tree
Hide file tree
Showing 87 changed files with 122 additions and 140 deletions.
10 changes: 5 additions & 5 deletions include/KAccessDso.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class KAccessDso
module->ctx.module = access->create_ctx();
return module;
}
const char* getName() {
const char *get_module() const {
return access->name;
}
void getHtml(KWStream& s);
Expand Down Expand Up @@ -73,8 +73,8 @@ class KAccessDsoMark : public KMark
KMark* new_instance() override {
return new KAccessDsoMark(ad->new_instance());
}
const char* getName() override {
return ad->getName();
const char *get_module() const override {
return ad->get_module();
}
void get_html(KWStream& s) override {
return ad->getHtml(s);
Expand Down Expand Up @@ -109,8 +109,8 @@ class KAccessDsoAcl : public KAcl
KAcl* new_instance() override {
return new KAccessDsoAcl(ad->new_instance());
}
const char* getName() override {
return ad->getName();
const char *get_module() const override {
return ad->get_module();
}
void get_html(KWStream& s) override {
return ad->getHtml(s);
Expand Down
4 changes: 2 additions & 2 deletions include/KBlackListMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if (1== atoi(attribute["enable"].c_str())) {
KMark* new_instance() override {
return new KBlackListMark();
}
const char* getName() override {
const char *get_module() const override {
return "black_list";
}
private:
Expand Down Expand Up @@ -112,7 +112,7 @@ class KCheckBlackListMark : public KMark
KMark* new_instance() override {
return new KCheckBlackListMark();
}
const char* getName()override {
const char *get_module() const override {
return "check_black_list";
}
private:
Expand Down
6 changes: 4 additions & 2 deletions include/KCdnRewriteMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class KHostRewriteMark : public KMark
virtual ~KHostRewriteMark();
uint32_t process(KHttpRequest* rq, KHttpObject* obj, KSafeSource& fo) override;
KMark * new_instance() override;
const char *getName() override;
const char* get_module() const override {
return "host_rewrite";
}
void get_display(KWStream& s) override;
void get_html(KWStream& s) override;
void parse_config(const khttpd::KXmlNodeBody* xml) override;
Expand All @@ -30,7 +32,7 @@ class KHostMark : public KMark
virtual ~KHostMark();
uint32_t process(KHttpRequest* rq, KHttpObject* obj, KSafeSource& fo) override;
KMark * new_instance() override;
const char *getName() override;
const char* get_module() const override;
void get_display(KWStream& s) override;
void get_html(KWStream& s) override;
void parse_config(const khttpd::KXmlNodeBody* xml) override;
Expand Down
4 changes: 2 additions & 2 deletions include/KChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class KChain final
void getModelHtml(KModelPtr<T> &ptr, KWStream& s, int type, int index) {
s << "<tr><td><input type=hidden name='begin_sub_form' value='"
<< (type == 0 ? "acl_"_CS : "mark_"_CS)
<< ptr.m->getName() << "'>";
<< ptr.m->get_module() << "'>";
s << "[<a href=\"javascript:delmodel('" << index << "'," << type << ");\">del</a>]";
if (ptr.named.empty()) {
s << "<input type = checkbox name = 'or' value = '1' ";
Expand All @@ -108,7 +108,7 @@ class KChain final
s << "checked";
}
s << ">NOT ";
s << ptr.m->getName();
s << ptr.m->get_module();
} else {
s << "named:" << ptr.named;
}
Expand Down
2 changes: 1 addition & 1 deletion include/KConnectionCloseMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class KConnectionCloseMark : public KMark
KMark *new_instance()override {
return new KConnectionCloseMark();
}
const char *getName() override {
const char *get_module() const override {
return "connection_close";
}
uint32_t process(KHttpRequest* rq, KHttpObject* obj, KSafeSource& fo) override
Expand Down
2 changes: 1 addition & 1 deletion include/KCounterMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class KCounterMark : public KMark
{
return new KCounterMark();
}
const char *getName() override
const char *get_module() const override
{
return "counter";
}
Expand Down
2 changes: 1 addition & 1 deletion include/KFlowMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KFlowMark : public KMark
{
return new KFlowMark();
}
const char *getName() override
const char *get_module() const override
{
return "flow";
}
Expand Down
2 changes: 1 addition & 1 deletion include/KGeoMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class KGeoMark : public KMark
KMark * new_instance() override {
return new KGeoMark;
}
const char *getName() override {
const char *get_module() const override {
return "geo";
}
void flush_timer_callback();
Expand Down
2 changes: 1 addition & 1 deletion include/KHostAliasMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class KHostAliasMark : public KMark
KMark * new_instance()override {
return new KHostAliasMark();
}
const char *getName() override {
const char *get_module() const override {
return "host_alias";
}
private:
Expand Down
2 changes: 1 addition & 1 deletion include/KHttpOnlyCookieMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class KCookieMark : public KMark
{
return new KCookieMark;
}
const char* getName() override
const char *get_module() const override
{
return "cookie";
}
Expand Down
2 changes: 1 addition & 1 deletion include/KIpRateAcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class KIpRateAcl : public KAcl
KAcl *new_instance() override{
return new KIpRateAcl();
}
const char *getName() override{
const char *get_module() const override{
return "ip_rate";
}
bool match(KHttpRequest* rq, KHttpObject* obj) override {
Expand Down
2 changes: 1 addition & 1 deletion include/KIpSpeedLimitMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class KIpSpeedLimitMark : public KMark
{
return new KIpSpeedLimitMark;
}
const char *getName()override
const char* get_module() const override
{
return "ip_speed_limit";
}
Expand Down
2 changes: 1 addition & 1 deletion include/KIpUrlRateAcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class KIpUrlRateAcl : public KAcl
KAcl *new_instance() override {
return new KIpUrlRateAcl();
}
const char *getName() override {
const char *get_module() const override {
return "ip_url_rate";
}
void get_display(KWStream& s) override {
Expand Down
2 changes: 1 addition & 1 deletion include/KIpUrlRateMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KIpUrlRateMark : public KMark
KMark * new_instance() override {
return new KIpUrlRateMark();
}
const char *getName() override {
const char *get_module() const override {
return "ip_url_rate";
}
uint32_t process(KHttpRequest* rq, KHttpObject* obj, KSafeSource& fo) override {
Expand Down
2 changes: 1 addition & 1 deletion include/KMapRedirectMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KMapRedirectMark : public KMark{
virtual ~KMapRedirectMark();
uint32_t process(KHttpRequest* rq, KHttpObject* obj, KSafeSource& fo) override;
KMark *new_instance()override;
const char *getName()override;
const char *get_module() const override;
void get_html(KWStream& s) override;
void get_display(KWStream& s) override;
void parse_config(const khttpd::KXmlNodeBody* xml) override;
Expand Down
2 changes: 1 addition & 1 deletion include/KMarkAcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class KMarkAcl: public KAcl
KAcl *new_instance() override {
return new KMarkAcl();
}
const char *getName() override {
const char *get_module() const override {
return "mark";
}
bool match(KHttpRequest* rq, KHttpObject* obj) override {
Expand Down
2 changes: 1 addition & 1 deletion include/KMarkMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class KMarkMark : public KMark
{
return new KMarkMark;
}
const char *getName() override
const char *get_module() const override
{
return "mark";
}
Expand Down
2 changes: 1 addition & 1 deletion include/KMinObjVerifiedMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KMinObjVerifiedMark : public KMark
{
return new KMinObjVerifiedMark;
}
const char *getName()override
const char* get_module() const override
{
return "min_obj_verified";
}
Expand Down
14 changes: 3 additions & 11 deletions include/KModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ using KSafeSource = std::unique_ptr<KFetchObject>;
class KModel {
public:
KModel() {
//revers = false;
//is_or = false;
isGlobal = true;
ref = 1;
}
virtual const char *getName() = 0;
/* 工厂实例不会调用 parse_config */
virtual const char *get_module() const = 0;
virtual void parse_config(const khttpd::KXmlNodeBody* xml) = 0;
virtual void parse_child(const kconfig::KXmlChanged* changed) {
}
Expand All @@ -60,9 +57,8 @@ class KModel {
}
}
void dump(kgl::serializable* m, bool is_short) {
//m->add("revers", revers);
//m->add("is_or", is_or);
m->add("module", getName());
m->add("refs", get_ref());
m->add("module", get_module());
KStringBuf out;
if (is_short) {
get_display(out);
Expand All @@ -71,10 +67,6 @@ class KModel {
}
m->add("html", out.str());
}
/* 命名模块的名字 */
//KString named;
//bool revers;
//bool is_or;
bool isGlobal;
protected:
volatile uint32_t ref;
Expand Down
2 changes: 1 addition & 1 deletion include/KMultiHostAcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class KMultiHostAcl: public KAcl {
void get_html(KWStream& s) override;
void get_display(KWStream& s) override;
KAcl *new_instance() override;
const char *getName() override;
const char *get_module() const override;
bool match(KHttpRequest* rq, KHttpObject* obj) override;
void parse_config(const khttpd::KXmlNodeBody* xml) override;
private:
Expand Down
2 changes: 1 addition & 1 deletion include/KMultiServerMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class KMultiServerMark : public KMark
KMark* new_instance() override {
return new KMultiServerMark();
}
const char* getName() override {
const char *get_module() const override {
return "multi_server";
}
private:
Expand Down
2 changes: 1 addition & 1 deletion include/KObjFlagAcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class KObjFlagAcl : public KAcl {
KAcl *new_instance() override {
return new KObjFlagAcl();
}
const char *getName() override {
const char *get_module() const override {
return "obj_flag";
}
private:
Expand Down
2 changes: 1 addition & 1 deletion include/KPerIpAcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class KPerIpAcl: public KAcl {
KAcl *new_instance() override {
return new KPerIpAcl();
}
const char *getName() override {
const char *get_module() const override {
return "per_ip";
}

Expand Down
2 changes: 1 addition & 1 deletion include/KPortMapMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class KPortMapMark : public KMark
{
return new KPortMapMark;
}
const char *getName()override
const char* get_module() const override
{
return "port_map";
}
Expand Down
4 changes: 2 additions & 2 deletions include/KQueueMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class KQueueMark : public KMark
KMark* new_instance()override {
return new KQueueMark;
}
const char* getName()override {
const char *get_module() const override {
return "queue";
}
void get_html(KWStream& s) override;
Expand All @@ -56,7 +56,7 @@ class KPerQueueMark : public KMark
KMark* new_instance() override {
return new KPerQueueMark;
}
const char* getName() override {
const char *get_module() const override {
return "per_queue";
}
void get_display(KWStream& s) override;
Expand Down
2 changes: 1 addition & 1 deletion include/KRandAcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KRandAcl : public KAcl
KAcl *new_instance() override {
return new KRandAcl();
}
const char *getName() override {
const char *get_module() const override {
return "rand";
}
bool match(KHttpRequest* rq, KHttpObject* obj) override {
Expand Down
2 changes: 1 addition & 1 deletion include/KRedirectMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class KRedirectMark: public KMark {
virtual ~KRedirectMark();
uint32_t process(KHttpRequest* rq, KHttpObject* obj, KSafeSource& fo) override;
KMark * new_instance()override;
const char *getName()override;
const char * get_module() const override;
void get_display(KWStream& s) override;
void get_html(KWStream& s) override;
void parse_config(const khttpd::KXmlNodeBody* xml) override;
Expand Down
2 changes: 1 addition & 1 deletion include/KRemoveHeaderMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class KRemoveHeaderMark : public KMark
KMark* new_instance() override {
return new KRemoveHeaderMark;
}
const char* getName()override {
const char *get_module() const override {
return "remove_header";
}
void get_html(KWStream& s) override {
Expand Down
2 changes: 1 addition & 1 deletion include/KRemoveParamMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class KRemoveParamMark : public KMark
KMark * new_instance() override {
return new KRemoveParamMark();
}
const char *getName()override {
const char* get_module() const override {
return "remove_param";
}

Expand Down
2 changes: 1 addition & 1 deletion include/KReplaceHeaderMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class KReplaceHeaderMark : public KMark
KMark* new_instance() override {
return new KReplaceHeaderMark;
}
const char* getName() override {
const char *get_module() const override {
return "replace_header";
}
void get_html(KWStream& s) override {
Expand Down
4 changes: 2 additions & 2 deletions include/KReplaceIPMark.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class KReplaceIPMark : public KMark
{
return new KReplaceIPMark;
}
const char *getName()override
const char* get_module() const override
{
return "replace_ip";
}
Expand Down Expand Up @@ -201,7 +201,7 @@ class KParentMark : public KMark
{
return new KParentMark;
}
const char *getName()override
const char * get_module() const override
{
return "parent";
}
Expand Down
2 changes: 1 addition & 1 deletion include/KRewriteMarkEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class KRewriteMarkEx: public KMark {
~KRewriteMarkEx(void);
uint32_t process(KHttpRequest* rq, KHttpObject* obj, KSafeSource& fo) override;
KMark * new_instance() override;
const char *getName() override;
const char * get_module() const override;
void get_display(KWStream& s) override;
void get_html(KWStream& s) override;
static void getEnv(KHttpRequest *rq, char *env, KWStream&s);
Expand Down
Loading

0 comments on commit 6197308

Please sign in to comment.