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/src (ParameterStatement.cpp): msg#00201

db.carob.cvs

Subject: CVS update of carob/src (ParameterStatement.cpp)

Date: Friday, January 27, 2006 @ 19:03:19
Author: marc
Path: /cvsroot/carob/carob/src

Modified: ParameterStatement.cpp (1.14 -> 1.15)

Moved setString() code to its template specialization. CAROB-55.


------------------------+
ParameterStatement.cpp | 32 ++++++++++++++++++++++++++++----
1 files changed, 28 insertions(+), 4 deletions(-)


Index: carob/src/ParameterStatement.cpp
diff -u carob/src/ParameterStatement.cpp:1.14
carob/src/ParameterStatement.cpp:1.15
--- carob/src/ParameterStatement.cpp:1.14 Fri Jan 27 18:33:58 2006
+++ carob/src/ParameterStatement.cpp Fri Jan 27 19:03:19 2006
@@ -153,7 +153,7 @@
* Stream filter: intercept (only) one value, modify it before printing it,
and returns the
* filtered stream before disappearing.
*/
-template <class T, class Ch>
+template <class T, class Ch = wchar_t>
class oneShotFilter
{
basic_ostream<Ch>& wrapped_stream;
@@ -301,11 +301,31 @@
public:
void doManip(basic_ostream<Ch>& s) const
{
+ // see: java.lang.Boolean#toBoolean()
s.imbue(locC);
s << std::boolalpha;
};
};

+// template specialization for wstring
+template <>
+class oneShotFilter<wstring>
+{
+ basic_ostream<wchar_t>& wrapped_stream;
+public:
+ oneShotFilter(basic_ostream<wchar_t>& s) : wrapped_stream(s) { } ;
+ basic_ostream<wchar_t>&
+ // this is the actual filtering operator
+ operator<< (wstring value)
+ {
+ wrapped_stream <<
+ (value == NULL_TAG ? NULL_STRING_TAG : replaceAll(value, TAG_MARKER,
TAG_MARKER_ESCAPE));
+ // then return the underlying stream (we filter only once!)
+ return wrapped_stream;
+ }
+};
+
+

} // namespace CarobNS

@@ -361,6 +381,11 @@
set<std::wstring>(parameterIndex, NULL_TAG, emptyString);
}

+
+// Don't add any code in here, use template specializations
+// above. CAROB-55: We may deprecate these methods in the future in
+// profit of the underlying templates
+
void ParameterStatement::setBoolean(const int parameterIndex, const bool x)
throw (DriverException, UnexpectedException)
{
@@ -406,12 +431,11 @@
void ParameterStatement::setBigDecimal(const int parameterIndex, const
BigDecimal &x)
throw (DriverException, UnexpectedException)
{
- set<wstring>(parameterIndex, BIG_DECIMAL_TAG, x);
+ set<wstring>(parameterIndex, BIG_DECIMAL_TAG, x); // FIXME: should be
set<BigDecimal>, else explain
}

void ParameterStatement::setString(const int parameterIndex, const
std::wstring &x)
throw (DriverException, UnexpectedException)
{
- set<wstring>(parameterIndex, STRING_TAG,
- x == NULL_TAG ? NULL_STRING_TAG : replaceAll(x, TAG_MARKER,
TAG_MARKER_ESCAPE));
+ set<wstring>(parameterIndex, STRING_TAG, x);
}


<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