|
solarpowerlog trunk
|
00001 /* 00002 * CFormaterWebRootStrip.cpp 00003 * 00004 * Created on: Jan 4, 2010 00005 * Author: tobi 00006 */ 00007 00008 #include "DataFilters/HTMLWriter/formatter/IFormater.h" 00009 #include "DataFilters/HTMLWriter/formatter/CFormaterWebRootStrip.h" 00010 #include "configuration/CConfigHelper.h" 00011 00012 CFormaterWebRootStrip::CFormaterWebRootStrip() 00013 { 00014 } 00015 00016 CFormaterWebRootStrip::~CFormaterWebRootStrip() 00017 { 00018 // TODO Auto-generated destructor stub 00019 } 00020 00021 bool CFormaterWebRootStrip::Format(const std::string &what, std::string &store, 00022 const std::vector<std::string> ¶meters) 00023 { 00024 std::string strip; 00025 size_t pos; 00026 00027 if (parameters.size() < 3) { 00028 strip = "/var/www"; 00029 } else { 00030 strip = parameters[2]; 00031 } 00032 00033 // basic check: what must be bigger than strip. 00034 if (strip.length() > what.length()) 00035 return false; 00036 00037 // make sure that the string is there 00038 pos = what.find(strip); 00039 00040 if (pos != std::string::npos) { 00041 store = what.substr(strip.length(), std::string::npos); 00042 return true; 00043 } 00044 00045 return false; 00046 } 00047