--- Represent/Represent.cpp 2004/12/25 06:32:04 393 +++ Represent/Represent.cpp 2004/12/28 03:19:23 400 @@ -199,6 +199,8 @@ void Represent::output(xml::TextWriter& _rfor (MultiMapConstIterator, delete_, cgi.lower_bound("delete"), cgi.upper_bound("delete")) items.RemoveAt(lexical_cast(delete_->second)); + if (!items.IsEmpty() && items.First().data.IsEmpty()) items.RemoveFirst(); + size_t index(0); _foreach (ext::Vector, item, items) switch (item->type) @@ -357,18 +359,42 @@ char Represent::input(const Item& item) } } -// XXX: constructing a string from Binary or Hexadecimal seems too dangerous template <> std::string Represent::input(const Item& item) { - return item.data; + std::string string; + + switch (item.input) + { + default: + return item.data; + case InputType::INPUT_Binary: + _foreach (_L, atom, item.data.Split(' ')) string += Binary(*atom, false).convert(false); + break; + case InputType::INPUT_Hexadecimal: + _foreach (_L, atom, item.data.Split(' ')) string += Hexadecimal(*atom, false).convert(false); + } + + return string; } -// XXX: constructing a string from Binary or Hexadecimal seems too dangerous template <> ext::String Represent::input(const Item& item) { - return item.data; + ext::String string; + + switch (item.input) + { + default: + return item.data; + case InputType::INPUT_Binary: + _foreach (_L, atom, item.data.Split(' ')) string.InsertLast(Binary(*atom, false).convert(false)); + break; + case InputType::INPUT_Hexadecimal: + _foreach (_L, atom, item.data.Split(' ')) string.InsertLast(Hexadecimal(*atom, false).convert(false)); + } + + return string; } template @@ -377,7 +403,6 @@ void Represent::normal(xml::TextWriter& xhtml.OutputText(lexical_cast(type)); } -// XXX: damn, this one is really quite screwy template <> void Represent::normal(xml::TextWriter& xhtml, const char& char_) {