diff --git a/winixd/core/request.cpp b/winixd/core/request.cpp index 6545957..e0bb1c5 100644 --- a/winixd/core/request.cpp +++ b/winixd/core/request.cpp @@ -541,6 +541,90 @@ const std::wstring & Request::ParamValue(const std::wstring & param_name) } +void Request::AddParam(const std::wstring & param_name, const std::wstring & param_value) +{ + bool found = false; + ParamTab::iterator i; + + for(i=param_tab.begin() ; i!=param_tab.end() ; ++i) + { + if( i->name == param_name ) + { + i->value = param_value; + found = true; + } + } + + if( !found ) + { + Param param; + param.name = param_name; + param.value = param_value; + param_tab.push_back(param); + } +} + + +void Request::AddParam(const wchar_t * param_name, const wchar_t * param_value) +{ + bool found = false; + ParamTab::iterator i; + + for(i=param_tab.begin() ; i!=param_tab.end() ; ++i) + { + if( i->name == param_name ) + { + i->value = param_value; + found = true; + } + } + + if( !found ) + { + Param param; + param.name = param_name; + param.value = param_value; + param_tab.push_back(param); + } +} + + +void Request::RemoveParam(const wchar_t * param_name) +{ + ParamTab::iterator i; + + for(size_t i=0 ; i < param_tab.size() ; ) + { + if( param_tab[i].name == param_name ) + { + param_tab.erase(param_tab.begin() + i); + } + else + { + ++i; + } + } +} + + +void Request::RemoveParam(const std::wstring & param_name) +{ + ParamTab::iterator i; + + for(size_t i=0 ; i < param_tab.size() ; ) + { + if( param_tab[i].name == param_name ) + { + param_tab.erase(param_tab.begin() + i); + } + else + { + ++i; + } + } +} + + void Request::current_dir(morm::Wrapper & wrapper) diff --git a/winixd/core/request.h b/winixd/core/request.h index 9f7f082..1103002 100644 --- a/winixd/core/request.h +++ b/winixd/core/request.h @@ -437,6 +437,12 @@ public: std::wstring * ParamValuep(const wchar_t * param_name); // returns nullptr if there is no such a parameter std::wstring * ParamValuep(const std::wstring & param_name); // returns nullptr if there is no such a parameter + void AddParam(const std::wstring & param_name, const std::wstring & param_value); + void AddParam(const wchar_t * param_name, const wchar_t * param_value); + + void RemoveParam(const wchar_t * param_name); + void RemoveParam(const std::wstring & param_name); + bool IsPostVar(const wchar_t * var); bool IsPostVar(const std::wstring & var); const std::wstring & PostVar(const wchar_t * var); // returns an empty string if there is no such a parameter