proj home

Files   Classes   Functions   Hierarchy  

tokenizerlocal.h

Go to the documentation of this file.
00001 #ifndef TOKENIZERLOCAL
00002 #define TOKENIZERLOCAL
00003 
00004 #include <tokenizer.h>
00005 
00021 class tokenizerlocal
00022 {
00024   static long int countermax;
00025 public:
00026 
00028   tokenizer& ref;
00029 
00031   tokenizerlocal* parent;
00032 
00034   liststringi i1;
00036   liststringi i2;
00038   liststringi iend;
00039 
00041   stringc debug01() const;
00042 
00044   tokenizerlocal(tokenizer& ref_);
00046   tokenizerlocal(tokenizerlocal& tl);
00047 
00048   /* Explicit control of begin and end atoms 
00049      - no angle brackets added. */
00050   boolc atomize_next(stringc & atom1, stringc& atom2);
00051 
00053   void reset();
00054 
00056   void reset(tokenizerlocal& tkl);
00057 
00059   void endpointcontract();
00061   void endpointexpand();
00063   void endpointreset();
00064 
00066   boolc operator ! () const; 
00068   stringc & operator() () const; 
00070   void operator ++ (); 
00071   
00073   boolc readtag(string& val, stringc& tag);
00075   boolc writetag(stringc& val, stringc& tag);
00077   boolc erasetag(stringc& tag);
00078 
00079 
00082   boolc scopesearch(stringc& tag);
00083 
00084   /* From the current position scope and read the tag. */
00085   boolc read(string& str, stringc& tag1);
00086   boolc read(string& str, stringc& tag1, stringc& tag2);
00087   boolc read(string& str, stringc& tag1, stringc& tag2, stringc& tag3);
00088   boolc read(string& str, stringc& tag1, stringc& tag2, stringc& tag3, stringc& tag4);
00089   boolc read(string& str, stringc& tag1, stringc& tag2, stringc& tag3, stringc& tag4, stringc& tag5);
00090   boolc read(string& str, stringc& tag1, stringc& tag2, stringc& tag3, stringc& tag4, stringc& tag5, stringc& tag6);
00091 
00093   boolc boundscope(stringc& tag1); 
00094 
00095   /* Find and atomize next <tag1> and </tag1>. */
00096   boolc scope(stringc& tag1); 
00097   /* Find and atomize matching tags in order. */
00098   boolc scope(stringc& tag1, stringc& tag2);
00099   /* Find and atomize matching tags in order. */
00100   boolc scope(stringc& tag1, stringc& tag2, stringc& tag3 );
00101   /* Find and atomize matching tags in order. */
00102   boolc scope(stringc& tag1, stringc& tag2, stringc& tag3, stringc& tag4 );
00103   /* Find and atomize matching tags in order. */
00104   boolc scope(stringc& tag1, stringc& tag2, stringc& tag3, stringc& tag4, stringc& tag5 );
00105   /* Find and atomize matching tags in order. */
00106   boolc scope(stringc& tag1, stringc& tag2, stringc& tag3, stringc& tag4, stringc& tag5, stringc& tag6);
00107 
00108 };
00109 
00110 
00135 class tokenizerlocalvar : public tokenizerlocal
00136 {
00137 public:
00138 
00140   boolc operator ! (); 
00141 
00143   string objtag;
00144 
00146   tokenizerlocalvar
00147   (
00148     tokenizerlocal& tkl, 
00149     stringc& objtag_
00150   );
00151 
00152 };
00153 
00154 
00155 
00156 
00157 /*
00158 Issues
00159 
00160 * Handle attributes by pre-processing the attributes
00161   into the more primitive xml.
00162 
00163 <Sandwich class_id="0" tracking_level="0" version="0">
00164 ...
00165 </Sandwich>
00166  becomes
00167 <Sandwich>
00168  <Sandwich.attrib>
00169   <x>
00170    <l>class_id</l>
00171    <r>0</r>
00172   </x>
00173   <x>
00174    <l>tracking_level</l>
00175    <r>0</r>
00176   </x>
00177   <x>
00178    <l>version</l>
00179    <r>0</r>
00180   </x>
00181  </Sandwich.attrib>
00182 ....
00183 </Sandwich>
00184 
00185 * Possible extension: template ref so this class may
00186  be either a reference or contain the tokenizer!
00187  This would be good for the splice_into which could
00188  send instead to the tokenizerlocal. 
00189  (one line rather than multiple lines, easier to use)
00190  This is probably too complex for the gain, the object
00191  /class would have to often be used.
00192 
00193 * Human readable xml - automated spacing for nested tags.
00194  One space indent. Indent when a new tag encountered,
00195   push the new tag to a tag stack. Keep current count
00196   of depth.
00197 
00198 
00199 */
00200 
00210 /*
00211 class tokenizerscope : public tokenizerlocal
00212 {
00213 public:
00214 
00215   // Outer scope. 
00216   tokenizerlocal& tl;
00217 
00218   // Scope tag. 
00219   string scopetag;
00220 
00221   // Set the scope to tl. 
00222   void reset();
00223 
00224   // Iterate through scopetag objects. 
00225   boolc operator ! ();
00226 
00227   // Constructor. 
00228   tokenizerscope(tokenizerlocal& tl_,stringc & scopetag_="");
00229   tokenizerscope(tokenizer& tk,stringc & scopetag_);
00230 
00231 };
00232 
00233 */
00234 
00235 #endif
00236 
00237 

Generated on Fri Mar 4 00:49:29 2011 for Chelton Evans Source by  doxygen 1.5.8