Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of carob (include/Common.hpp src/Common.cpp): msg#00122

db.carob.cvs

Subject: CVS update of carob (include/Common.hpp src/Common.cpp)

Date: Wednesday, March 22, 2006 @ 18:54:23
Author: gilles
Path: /cvsroot/carob/carob

Modified: include/Common.hpp (1.40 -> 1.41) src/Common.cpp (1.35 -> 1.36)

Introduced decimal point global variables:
. user decimal point will be the default decimal separator in user's current
locale (if any) at library init time
. controller decimal point is the "standard" decimal separator (ie. '.') that
is used by the controller to parse numbers (eg. floats)
Added toWString implem for chars + fixed javadoc


--------------------+
include/Common.hpp | 19 +++++++++++++++----
src/Common.cpp | 9 +++++++++
2 files changed, 24 insertions(+), 4 deletions(-)


Index: carob/include/Common.hpp
diff -u carob/include/Common.hpp:1.40 carob/include/Common.hpp:1.41
--- carob/include/Common.hpp:1.40 Wed Mar 22 18:26:06 2006
+++ carob/include/Common.hpp Wed Mar 22 18:54:23 2006
@@ -88,6 +88,14 @@
#endif
;

+// Decimal point (decimal separator)
+extern wchar_t userDecimalPoint;
+/**
+ * The controller uses the default decimal point separator for parsing numbers,
+ * so we have to send him the right one, ie. the default C one.
+ */
+extern wchar_t controllerDecimalPoint;
+
/** The current log level (set by setLogLevel) */
extern LogLevel currentLogLevel;

@@ -148,10 +156,12 @@
/**
* Converts any type to wstring
* Implemented so far:
+ * char
* uint16_t
* int16_t
* uint32_t
* int64_t
+ * uint64_t
* int
* long
* float
@@ -167,10 +177,11 @@
* eg. 123abc will be transformed to 123
* Function found at http://www.codeguru.com/forum/showthread.php?t=231054
* Types implemented so far:
- * int
- * int64_t
- * float
- * double
+ * int
+ * int64_t
+ * uint64_t
+ * float
+ * double
*
* @return true if the conversion succeeded, false otherwise
*/
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.35 carob/src/Common.cpp:1.36
--- carob/src/Common.cpp:1.35 Fri Mar 17 20:46:40 2006
+++ carob/src/Common.cpp Wed Mar 22 18:54:23 2006
@@ -298,6 +298,12 @@
const CarobNS::MBSCodec CarobNS::StaticCodecs::user_codec(tryuserlocale());
const CarobNS::MBSCodec CarobNS::StaticCodecs::utf8_codec(tryUTF8locale());

+// decimal point initialization
+wchar_t CarobNS::userDecimalPoint =
+ std::use_facet<std::numpunct<wchar_t> >(tryuserlocale()).decimal_point();
+wchar_t CarobNS::controllerDecimalPoint =
+ std::use_facet<std::numpunct<wchar_t> >(std::locale("C")).decimal_point();
+
//Can this be factorized with ParameterStatement ?
template <class T> wstring CarobNS::toWString(const T& t)
{
@@ -306,6 +312,8 @@
return buffer.str();
}
// Explicit instantiation for types actually used
+// Don't forget to update javadoc when changing this
+template wstring CarobNS::toWString<char>(const char&);
template wstring CarobNS::toWString<uint16_t>(const uint16_t&);
template wstring CarobNS::toWString<int16_t>(const int16_t&);
template wstring CarobNS::toWString<uint32_t>(const uint32_t&);
@@ -322,6 +330,7 @@
return !(iss >> std::skipws >> t).fail();
}
// Explicit instantiation for types actually used
+// Don't forget to update javadoc when changing this
template bool CarobNS::wstringTo<int>(int&, const std::wstring&);
template bool CarobNS::wstringTo<int64_t>(int64_t&, const std::wstring&);
template bool CarobNS::wstringTo<uint64_t>(uint64_t&, const std::wstring&);


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo