From: Christian P. <cp...@us...> - 2005-07-08 08:15:51
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19784/include/pclasses/Unicode Modified Files: NumberFormat.h String.h Added Files: DateTimeFormat.h Log Message: - Added Unicode::DateTimeFormat - Added String::realSize() to determine String's internal char count - Fixed Unicode::Converter - Changed Unicode::NumberFormat text-attributes from Char to String --- NEW FILE: DateTimeFormat.h --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_Unicode_DateTimeFormat_h #define P_Unicode_DateTimeFormat_h #include <pclasses/Export.h> #include <pclasses/Exception.h> #include <pclasses/DateTime.h> #include <pclasses/Unicode/UnicodeError.h> #include <pclasses/Unicode/String.h> #include <memory> namespace P { namespace Unicode { class PUNICODE_EXPORT DateTimeFormat { public: enum Style { Full, Long, Medium, Short }; typedef std::pair<Style, Style> StylePair; DateTimeFormat(Style dateStyle, Style timeStyle, const char* locale) throw(OutOfMemory, UnicodeError); ~DateTimeFormat() throw(); void setDateTimeStyle(Style dateStyle, Style timeStyle) throw(); StylePair dateTimeStyle() const throw(); void setDateStyle(Style dateStyle) throw(); Style dateStyle() const throw(); void setTimeStyle(Style timeStyle) throw(); Style timeStyle() const throw(); String format(const Date& date) const throw(OutOfMemory, UnicodeError); String format(const Time& time) const throw(OutOfMemory, UnicodeError); String format(const DateTime& dt) const throw(OutOfMemory, UnicodeError); private: void* _private; }; } // !namespace Unicode } // !namespace P #endif Index: String.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Unicode/String.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- String.h 1 Jul 2005 13:55:10 -0000 1.9 +++ String.h 8 Jul 2005 08:15:42 -0000 1.10 @@ -84,7 +84,9 @@ //! Test if the String is empty bool empty() const throw(); + size_t size() const throw(); + size_t realSize() const throw(); size_t capacity() const throw(); void reserve(size_t sz); Index: NumberFormat.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Unicode/NumberFormat.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NumberFormat.h 6 Jul 2005 12:59:09 -0000 1.1 +++ NumberFormat.h 8 Jul 2005 08:15:42 -0000 1.2 @@ -22,9 +22,11 @@ #define P_Unicode_NumberFormat_h #include <pclasses/Export.h> +#include <pclasses/Exception.h> #include <pclasses/Unicode/UnicodeError.h> #include <pclasses/Unicode/Char.h> #include <pclasses/Unicode/String.h> +#include <memory> namespace P { @@ -41,10 +43,12 @@ Ordinal }; - NumberFormat(Style s, const char* locale); + NumberFormat(Style s, const char* locale) + throw(OutOfMemory, UnicodeError); + ~NumberFormat() throw(); - void setWidth(unsigned int width); + void setWidth(unsigned int width) throw(); unsigned int width() const throw(); enum PadPosition { @@ -54,27 +58,27 @@ AfterSuffix }; - void setPadPosition(PadPosition p); + void setPadPosition(PadPosition p) throw(); PadPosition padPosition() const throw(); - void setPadChar(Char ch); - Char padChar() const throw(); + void setPadChar(const String& str) throw(UnicodeError); + String padChar() const throw(OutOfMemory, UnicodeError); - void setPositivePrefix(Char ch); - Char positivePrefix(); + void setPositivePrefix(const String& str) throw(UnicodeError); + String positivePrefix() const throw(OutOfMemory, UnicodeError); - void setPositiveSuffix(Char ch); - Char positiveSuffix(); + void setPositiveSuffix(const String& str) throw(UnicodeError); + String positiveSuffix() const throw(OutOfMemory, UnicodeError); - void setNegativePrefix(Char ch); - Char negativePrefix(); + void setNegativePrefix(const String& str) throw(UnicodeError); + String negativePrefix() const throw(OutOfMemory, UnicodeError); - void setNegativeSuffix(Char ch); - Char negativeSuffix(); + void setNegativeSuffix(const String& str) throw(UnicodeError); + String negativeSuffix() const throw(OutOfMemory, UnicodeError); - String format(Int32 val) throw(UnicodeError); - String format(Int64 val) throw(UnicodeError); - String format(double val) throw(UnicodeError); + String format(Int32 val) throw(OutOfMemory, UnicodeError); + String format(Int64 val) throw(OutOfMemory, UnicodeError); + String format(double val) throw(OutOfMemory, UnicodeError); private: void* _private; |