home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / i18n / format.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-19  |  3.2 KB  |  109 lines

  1. /*
  2. ********************************************************************************
  3. *                                                                              *
  4. * COPYRIGHT:                                                                   *
  5. *   (C) Copyright Taligent, Inc.,  1997                                        *
  6. *   (C) Copyright International Business Machines Corporation,  1997-1998      *
  7. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  10. *                                                                              *
  11. ********************************************************************************
  12. *
  13. * File FORMAT.CPP
  14. *
  15. * Modification History:
  16. *
  17. *   Date        Name        Description
  18. *   02/19/97    aliu        Converted from java.
  19. *   03/17/97    clhuang     Implemented with new APIs.
  20. *   03/27/97    helena      Updated to pass the simple test after code review.
  21. *    07/20/98    stephen        Added explicit init values for Field/ParsePosition
  22. ********************************************************************************
  23. */
  24. // *****************************************************************************
  25. // This file was generated from the java source file Format.java
  26. // *****************************************************************************
  27.  
  28. #include "format.h"
  29.  
  30. // *****************************************************************************
  31. // class Format
  32. // *****************************************************************************
  33.  
  34. // -------------------------------------
  35. // default constructor
  36.  
  37. Format::Format()
  38. {
  39. }
  40.  
  41. // -------------------------------------
  42.  
  43. Format::~Format()
  44. {
  45. }
  46.  
  47. // -------------------------------------
  48. // copy constructor
  49.  
  50. Format::Format(const Format& that)
  51. {
  52. }
  53.  
  54. // -------------------------------------
  55. // assignment operator
  56.  
  57. Format&
  58. Format::operator=(const Format& that)
  59. {
  60.     return *this;
  61. }
  62.  
  63. // -------------------------------------
  64. // Formats the obj and append the result in the buffer, toAppendTo.
  65. // This calls the actual implementation in the concrete subclasses.
  66.  
  67. UnicodeString&
  68. Format::format(const Formattable& obj, 
  69.                UnicodeString& toAppendTo, 
  70.                UErrorCode& status) const
  71. {
  72.     if (U_FAILURE(status)) return toAppendTo;
  73.  
  74.     // {sfb} should really be FieldPosition::DONT_CARE, not 0
  75.     // leave at 0 for now, to keep in sync with Java
  76.     FieldPosition pos(0);
  77.  
  78.     return format(obj, toAppendTo, pos, status);
  79. }
  80.   
  81. // -------------------------------------
  82. // Parses the source string and create the corresponding 
  83. // result object.  Checks the parse position for errors.
  84.  
  85. void
  86. Format::parseObject(const UnicodeString& source, 
  87.                     Formattable& result, 
  88.                     UErrorCode& status) const
  89. {
  90.     if (U_FAILURE(status)) return;
  91.  
  92.     ParsePosition parsePosition(0);
  93.     parseObject(source, result, parsePosition);
  94.     if (parsePosition.getIndex() == 0) {
  95.         status = U_INVALID_FORMAT_ERROR;
  96.     }
  97. }
  98.  
  99. // -------------------------------------
  100.  
  101. bool_t
  102. Format::operator==(const Format& that) const
  103. {
  104.     // Add this implementation to make linker happy.
  105.     return TRUE;
  106. }
  107.  
  108. //eof
  109.