/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2008-2013, Tomasz Sowa * All rights reserved. * */ #include "request.h" #include "log.h" #include "plugin.h" #include "misc.h" Request::Request() : char_empty(0) { id = 0; } void Request::SetConfig(Config * pconfig) { config = pconfig; } void Request::ClearOutputStreams() { out_streams.resize(16); // !! IMPROVE ME add as a constant somewhere for(size_t i=0 ; isecond; } const std::wstring & Request::PostVar(const std::wstring & var) { PostTab::iterator p = post_tab.find(var); if( p == post_tab.end() ) return str_empty; return p->second; } bool Request::PostVar(const wchar_t * var, std::wstring & result) { PostTab::iterator p = post_tab.find(var); if( p == post_tab.end() ) { result.clear(); return false; } result = p->second; return true; } bool Request::PostVar(const std::wstring & var, std::wstring & result) { PostTab::iterator p = post_tab.find(var); if( p == post_tab.end() ) { result.clear(); return false; } result = p->second; return true; } std::wstring * Request::PostVarp(const wchar_t * var) { PostTab::iterator p = post_tab.find(var); if( p == post_tab.end() ) return 0; return &p->second; } std::wstring * Request::PostVarp(const std::wstring & var) { PostTab::iterator p = post_tab.find(var); if( p == post_tab.end() ) return 0; return &p->second; } bool Request::AllPostVarEmpty() { PostTab::iterator i; for(i=post_tab.begin() ; i!=post_tab.end() ; ++i) if( !i->second.empty() ) return false; return true; } bool Request::IsParam(const wchar_t * param_name) { ParamTab::iterator i; for(i=param_tab.begin() ; i!=param_tab.end() ; ++i) { if( i->name == param_name ) return true; } return false; } bool Request::IsParam(const std::wstring & param_name) { ParamTab::iterator i; for(i=param_tab.begin() ; i!=param_tab.end() ; ++i) { if( i->name == param_name ) return true; } return false; } const std::wstring & Request::ParamValue(const wchar_t * param_name) { ParamTab::iterator i; for(i=param_tab.begin() ; i!=param_tab.end() ; ++i) { if( i->name == param_name ) return i->value; } return str_empty; } const std::wstring & Request::ParamValue(const std::wstring & param_name) { return ParamValue(param_name.c_str()); }