00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(_xyzzy_stringtmpl_hxx_)
00023 # define _xyzzy_stringtmpl_hxx_
00024
00025 #include <string>
00026 #include <map>
00027 #include <iostream>
00028 #include "xyzzy/array.hxx"
00029
00030 namespace xyzzy
00031 {
00032 using namespace std;
00033
00034 class TStringTmpl
00035 {
00036 public:
00037 explicit TStringTmpl();
00038
00039 explicit TStringTmpl(string fname);
00040
00041 void addTmpl(string ix, string tmpl);
00042
00043 void setParm(string parm, string val);
00044
00045 void resetParms(PTRcArray<string> parms);
00046
00047 string& operator[](string parm)
00048 {
00049 return m_parmVals[parm];
00050 }
00051
00052 string emit(string ix, int indentBy = 0);
00053
00054 ostream&
00055 iterateOver(ostream &os, string ix, string parmIx,
00056 PTRcArray<string> vals);
00057
00058 private:
00059 void init(string fname);
00060
00061 map<string, string> m_tmpls;
00062 map<string, string> m_parmVals;
00063 };
00064 };
00065
00066 #endif //# define _xyzzy_stringtmpl_hxx_