Example #1
0
 const Str Mbd::Value(const Str & qry, ...) {
   StrTpl tpl(qry);
   
   int count = tpl.GetNumParams();
   
   StrParam p;
   
   va_list li;
   va_start(li, qry);
   Str xs(6);
   
   for (int i = 0; i < count; i++) {
     int x = va_arg(li, int);
     xs = x;
     p.Append(xs);
   }
   
   va_end(li);
   
   Str base(qry.Size() + count * 2);
   
   tpl.Build(base, &p);
   
   
   Tree<Str, Str> *v = dict.Seek(base);
   
   if (v != NULL) {
     return v->GetValue();
   }
   
   return "";
 }
Example #2
0
 int Mbd::Count(const Str & qry, ...) {
   StrTpl tpl(qry);
   
   int count = tpl.GetNumParams();
   
   StrParam p;
   
   va_list li;
   va_start(li, qry);
   Str xs(6);
   
   for (int i = 0; i < count; i++) {
     int x = va_arg(li, int);
     xs = x;
     p.Append(xs);
   }
   
   va_end(li);
   
   int newSize = qry.Size();
   newSize += count * 2;
   Str base(newSize);
   
   tpl.Build(base, &p);
   
   Tree<Str, unsigned int> *v = counts.Seek(base);
   
   if (v != NULL) {
     return v->GetValue();
   }
   
   return 0;
 }