diff --git a/CGIFormattedData.cpp b/CGIFormattedData.cpp new file mode 100644 index 0000000..13448ad --- /dev/null +++ b/CGIFormattedData.cpp @@ -0,0 +1,27 @@ +#include "CGIFormattedData.h" +#include "ZString.h" + +namespace coreutils { + + CGIFormattedData::CGIFormattedData() {} + + CGIFormattedData::CGIFormattedData(ZString cgiData) { + cgiData.split("&"); + for(int ix = 1; ix < cgiData.getList().size(); ++ix) { + cgiData[0].split("="); + data[cgiData[0]] = cgiData[1]; + data[cgiData[0]].fromCGI(); + } + } + + ZString CGIFormattedData::operator=(ZString cgiData) { + cgiData.split("&"); + for(int ix = 1; ix < cgiData.getList().size(); ++ix) { + cgiData[0].split("="); + data[cgiData[0]] = cgiData[1]; + data[cgiData[0]].fromCGI(); + } + return cgiData; + } + +} diff --git a/CGIFormattedData.h b/CGIFormattedData.h new file mode 100644 index 0000000..e6a3fc8 --- /dev/null +++ b/CGIFormattedData.h @@ -0,0 +1,29 @@ +#ifndef __CGIFormattedData_h__ +# define __CGIFormattedData_h__ + +# include "MString.h" +# include + +namespace coreutils { + + /// + /// Use the CGIFormattedData object to store and process data that + /// interfaces to the CGI format. Value pairs are accessible using + /// a common map interface. + /// + + class CGIFormattedData { + + public: + CGIFormattedData(); + CGIFormattedData(ZString cgiData); + + ZString operator=(ZString cgiData); + + std::map data; + + }; + +} + +#endif