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 389 by douglas, 2004-12-24T04:02:30-08:00 vs.
Revision 391 by douglas, 2004-12-24T20:31:04-08:00

# Line 317 | Line 317 | void Represent::output(xml::TextWriter&
317   template <typename Type>
318   Type Represent::input(const Item& item)
319   {
320 <        // XXX: implement
321 <        
322 <        return lexical_cast<Type>(item.data);
323 < }
324 <
325 < template <>
326 < bool Represent::input(const Item& item)
327 < {
328 <        // XXX: implement
320 >        bool signed_(etl::Limits<Type>::IsSigned);
321  
322 <        try { return lexical_cast<bool>(item.data); } catch (ext::Exception) { return false; }
322 >        switch (item.input)
323 >        {
324 >        default:
325 >                try { return lexical_cast<Type>(item.data); } catch (ext::Exception) { return 0; }
326 >        case InputType::INPUT_Binary:
327 >                return Binary(item.data, signed_).convert<Type>(signed_);
328 >        case InputType::INPUT_Hexadecimal:
329 >                return Hexadecimal(item.data, signed_).convert<Type>(signed_);
330 >        }
331   }
332  
333   template <>
334   char Represent::input(const Item& item)
335   {
336 <        // XXX: implement
337 <        
338 <        return item.data.First();
336 >        switch (item.input)
337 >        {
338 >        default:
339 >                return item.data.First();
340 >        case InputType::INPUT_Binary:
341 >                return Binary(item.data, false).convert<char>(false);
342 >        case InputType::INPUT_Hexadecimal:
343 >                return Hexadecimal(input.data, false).convert<char>(false);
344 >        }
345   }
346  
347 < // XXX: constructing a string from Binary or Hexadecimal seems to dangerous
347 > // XXX: constructing a string from Binary or Hexadecimal seems too dangerous
348   template <>
349   std::string Represent::input(const Item& item)
350   {
351          return item.data;
352   }
353  
354 < // XXX: constructing a string from Binary or Hexadecimal seems to dangerous
354 > // XXX: constructing a string from Binary or Hexadecimal seems too dangerous
355   template <>
356   ext::String Represent::input(const Item& item)
357   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines