ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Represent/Represent.cpp
(Generate patch)

Comparing Represent/Represent.cpp (file contents):
Revision 394 by douglas, 2004-12-24T22:39:00-08:00 vs.
Revision 400 by douglas, 2004-12-27T19:19:23-08:00

# Line 199 | Line 199 | void Represent::output(xml::TextWriter&
199  
200          _rfor (MultiMapConstIterator, delete_, cgi.lower_bound("delete"), cgi.upper_bound("delete")) items.RemoveAt(lexical_cast<size_t>(delete_->second));
201  
202 <        if (items.First().data.IsEmpty()) items.RemoveFirst();
202 >        if (!items.IsEmpty() && items.First().data.IsEmpty()) items.RemoveFirst();
203  
204          size_t index(0);
205  
# Line 359 | Line 359 | char Represent::input(const Item& item)
359          }
360   }
361  
362 // XXX: constructing a string from Binary or Hexadecimal seems too dangerous
362   template <>
363   std::string Represent::input(const Item& item)
364   {
365 <        return item.data;
365 >        std::string string;
366 >
367 >        switch (item.input)
368 >        {
369 >        default:
370 >                return item.data;
371 >        case InputType::INPUT_Binary:
372 >                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string += Binary(*atom, false).convert<char>(false);
373 >                break;
374 >        case InputType::INPUT_Hexadecimal:
375 >                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string += Hexadecimal(*atom, false).convert<char>(false);
376 >        }
377 >
378 >        return string;
379   }
380  
369 // XXX: constructing a string from Binary or Hexadecimal seems too dangerous
381   template <>
382   ext::String Represent::input(const Item& item)
383   {
384 <        return item.data;
384 >        ext::String string;
385 >
386 >        switch (item.input)
387 >        {
388 >        default:
389 >                return item.data;
390 >        case InputType::INPUT_Binary:
391 >                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string.InsertLast(Binary(*atom, false).convert<uint32_t>(false));
392 >                break;
393 >        case InputType::INPUT_Hexadecimal:
394 >                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string.InsertLast(Hexadecimal(*atom, false).convert<uint32_t>(false));
395 >        }
396 >
397 >        return string;
398   }
399  
400   template <typename Type>
# Line 379 | Line 403 | void Represent::normal(xml::TextWriter&
403          xhtml.OutputText(lexical_cast<ext::String>(type));
404   }
405  
382 // XXX: damn, this one is really quite screwy
406   template <>
407   void Represent::normal(xml::TextWriter& xhtml, const char& char_)
408   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines