Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas on 2013-05-09
Status: Merged
Approved by: Matthias Brantner on 2013-05-09
Approved revision: 11205
Merged at revision: 11445
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 3663 lines (+694/-521)
52 files modified
bin/zorbacmd.cpp (+0/-1)
include/zorba/internal/ztd.h (+8/-3)
src/api/serialization/serializer.cpp (+2/-2)
src/api/zorba_functions.cpp (+1/-1)
src/compiler/parser/symbol_table.cpp (+4/-4)
src/compiler/parser/xqdoc_comment.cpp (+3/-3)
src/compiler/translator/translator.cpp (+2/-2)
src/runtime/core/constructors.cpp (+1/-1)
src/runtime/durations_dates_times/format_dateTime.cpp (+6/-6)
src/runtime/numerics/format_number.cpp (+1/-1)
src/runtime/qnames/qnames_impl.cpp (+4/-4)
src/runtime/strings/strings_impl.cpp (+2/-2)
src/store/naive/atomic_items.cpp (+1/-1)
src/store/naive/simple_item_factory.cpp (+2/-2)
src/types/casting.cpp (+10/-10)
src/types/schema/XercesParseUtils.cpp (+23/-23)
src/types/schema/schema.cpp (+1/-1)
src/types/schema/validate.cpp (+1/-1)
src/unit_tests/test_string.cpp (+17/-17)
src/util/ascii_util.cpp (+1/-1)
src/util/ascii_util.h (+151/-79)
src/util/ascii_util.tcc (+26/-42)
src/util/base64_util.h (+12/-6)
src/util/error_util.h (+1/-4)
src/util/fs_util.h (+20/-54)
src/util/hexbinary_util.cpp (+2/-2)
src/util/hexbinary_util.h (+9/-5)
src/util/icu_streambuf.cpp (+1/-1)
src/util/json_util.h (+1/-3)
src/util/passthru_streambuf.cpp (+1/-1)
src/util/stl_util.h (+1/-1)
src/util/stream_util.cpp (+1/-1)
src/util/string_util.cpp (+3/-3)
src/util/string_util.h (+95/-49)
src/util/time_parse.cpp (+3/-3)
src/util/time_parse.h (+5/-13)
src/util/time_util.h (+1/-4)
src/util/unicode_util.h (+3/-2)
src/util/uri_util.h (+28/-13)
src/util/uri_util.tcc (+4/-1)
src/util/utf8_util.h (+138/-69)
src/util/utf8_util.tcc (+24/-9)
src/util/utf8_util_base.h (+1/-4)
src/util/xml_util.h (+36/-14)
src/zorbatypes/URI.cpp (+2/-2)
src/zorbatypes/binary.cpp (+1/-1)
src/zorbatypes/datetime/datetimetype.cpp (+16/-16)
src/zorbatypes/datetime/duration.cpp (+7/-7)
src/zorbatypes/datetime/timezone.cpp (+3/-3)
src/zorbatypes/decimal.cpp (+1/-1)
src/zorbatypes/floatimpl.cpp (+2/-2)
src/zorbautils/locale.h (+5/-20)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner 2013-05-09 Approve on 2013-05-09
Paul J. Lucas Approve on 2013-05-09
Review via email: mp+163078@code.launchpad.net

Commit Message

Util function argument bullet-proofing and clean-up.

Description of the Change

Util function argument bullet-proofing and clean-up.

To post a comment you must log in.
Paul J. Lucas (paul-lucas) :
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-05-09T00-53-05.805Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve.

review: Approve
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-05-09T14-41-54.794Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/zorbacmd.cpp'
2--- bin/zorbacmd.cpp 2013-03-21 23:41:00 +0000
3+++ bin/zorbacmd.cpp 2013-05-09 00:49:28 +0000
4@@ -662,7 +662,6 @@
5 TimingInfo& timing)
6 {
7 unsigned long lNumExecutions = properties.multiple();
8- bool lIndent = properties.indent();
9 bool doTiming = properties.timing();
10 bool serializePlan = properties.serializePlan();
11 bool savePlan = properties.savePlan();
12
13=== modified file 'include/zorba/internal/ztd.h'
14--- include/zorba/internal/ztd.h 2013-02-07 17:24:36 +0000
15+++ include/zorba/internal/ztd.h 2013-05-09 00:49:28 +0000
16@@ -258,6 +258,11 @@
17 ZORBA_DECL_HAS_MEM_FN( str );
18 ZORBA_DECL_HAS_MEM_FN( toString );
19
20+#define ZORBA_HAS_C_STR(T) \
21+ ::zorba::internal::ztd::has_c_str<T,char const* (T::*)() const>::value
22+
23+#define ZORBA_IS_STRING(T) ZORBA_HAS_C_STR(T)
24+
25 /**
26 * \internal
27 * Tests whether a given type \a T is a C string type.
28@@ -310,7 +315,7 @@
29 */
30 template<class T> inline
31 typename std::enable_if<!has_insertion_operator<T>::value
32- && has_c_str<T,char const* (T::*)() const>::value,
33+ && ZORBA_HAS_C_STR(T),
34 std::string>::type
35 to_string( T const &t ) {
36 return t.c_str();
37@@ -331,7 +336,7 @@
38 */
39 template<class T> inline
40 typename std::enable_if<!has_insertion_operator<T>::value
41- && !has_c_str<T,char const* (T::*)() const>::value
42+ && !ZORBA_HAS_C_STR(T)
43 && has_str<T,std::string (T::*)() const>::value
44 && !has_toString<T,std::string (T::*)() const>::value,
45 std::string>::type
46@@ -354,7 +359,7 @@
47 */
48 template<class T> inline
49 typename std::enable_if<!has_insertion_operator<T>::value
50- && !has_c_str<T,char const* (T::*)() const>::value
51+ && !ZORBA_HAS_C_STR(T)
52 && !has_str<T,std::string (T::*)() const>::value
53 && has_toString<T,std::string (T::*)() const>::value,
54 std::string>::type
55
56=== modified file 'src/api/serialization/serializer.cpp'
57--- src/api/serialization/serializer.cpp 2013-05-08 20:14:47 +0000
58+++ src/api/serialization/serializer.cpp 2013-05-09 00:49:28 +0000
59@@ -568,7 +568,7 @@
60
61 // Put a space between consecutive text nodes (or a text node and an
62 // atomic item), unless the text node contains whitespace only.
63- if (!ascii::is_whitespace(text.c_str()))
64+ if (!ascii::is_space(text.c_str()))
65 {
66 thePreviousItemKind = PREVIOUS_ITEM_WAS_TEXT;
67 }
68@@ -729,7 +729,7 @@
69 // Ignore whitespace text nodes when doing indentation
70 if (!ser->indent ||
71 child->getNodeKind() != store::StoreConsts::textNode ||
72- !ascii::is_whitespace(child->getStringValue().c_str()))
73+ !ascii::is_space(child->getStringValue().c_str()))
74 {
75 emit_node(child, depth);
76 prev_node_kind = child->getNodeKind();
77
78=== modified file 'src/api/zorba_functions.cpp'
79--- src/api/zorba_functions.cpp 2013-02-07 17:24:36 +0000
80+++ src/api/zorba_functions.cpp 2013-05-09 00:49:28 +0000
81@@ -28,7 +28,7 @@
82 ///////////////////////////////////////////////////////////////////////////////
83
84 void trim( String &s ) {
85- ascii::trim_whitespace( s );
86+ ascii::trim_space( s );
87 }
88
89 void trim( String &s, char const *chars ) {
90
91=== modified file 'src/compiler/parser/symbol_table.cpp'
92--- src/compiler/parser/symbol_table.cpp 2013-05-08 20:14:47 +0000
93+++ src/compiler/parser/symbol_table.cpp 2013-05-09 00:49:28 +0000
94@@ -113,12 +113,12 @@
95 {
96 if (do_trim_start)
97 {
98- text = ascii::trim_start_whitespace(text, &length);
99+ text = ascii::trim_start_space(text, &length);
100 }
101
102 if (do_trim_end)
103 {
104- length = ascii::trim_end_whitespace(text, length);
105+ length = ascii::trim_end_space(text, length);
106 }
107
108 if (!is_eqname)
109@@ -146,13 +146,13 @@
110 off_t symbol_table::put_uri(char const* text, size_t length)
111 {
112 // trim whitespace
113- text = ascii::trim_whitespace(text, &length);
114+ text = ascii::trim_space(text, &length);
115
116 // normalize whitespace
117 string result;
118 if (! decode_string (text, length, &result))
119 return -1;
120- ascii::normalize_whitespace( result );
121+ ascii::normalize_space( result );
122
123 return heap.put (result.c_str (), 0, result.length ());
124 }
125
126=== modified file 'src/compiler/parser/xqdoc_comment.cpp'
127--- src/compiler/parser/xqdoc_comment.cpp 2013-02-07 17:24:36 +0000
128+++ src/compiler/parser/xqdoc_comment.cpp 2013-05-09 00:49:28 +0000
129@@ -78,7 +78,7 @@
130
131 // if the line contains an annotation, than we finish the description
132 zstring lTmp;
133- ascii::trim_whitespace( lLine, &lTmp );
134+ ascii::trim_space( lLine, &lTmp );
135 if ( !lTmp.empty() && lTmp[0] == '@' ) {
136 lDescriptionState = false;
137 if (!lAnntotation.empty()) {
138@@ -102,7 +102,7 @@
139 XQDocComment::startsWithColon(zstring& aLine)
140 {
141 zstring temp;
142- ascii::trim_whitespace( aLine, &temp );
143+ ascii::trim_space( aLine, &temp );
144
145 if ( !temp.empty() && temp[0] == ':' ) {
146 aLine = temp.substr(1);
147@@ -126,7 +126,7 @@
148 }
149
150 ascii::to_lower( lName );
151- ascii::normalize_whitespace( lValue );
152+ ascii::normalize_space( lValue );
153
154 if ("version" == lName) {
155 theVersion = lValue;
156
157=== modified file 'src/compiler/translator/translator.cpp'
158--- src/compiler/translator/translator.cpp 2013-05-08 20:14:47 +0000
159+++ src/compiler/translator/translator.cpp 2013-05-09 00:49:28 +0000
160@@ -13567,7 +13567,7 @@
161 if (lPrevIsBoundary)
162 {
163 zstring content = v.get_elem_content().str();
164- utf8::trim_whitespace(content);
165+ utf8::trim_space(content);
166
167 // Filtering out of whitespaces
168 if (content.empty())
169@@ -14800,7 +14800,7 @@
170 // is not in the lexical space of NCName, a type error is raised [err:XPTY0004]
171
172 zstring lNormalizedTarget;
173- ascii::normalize_whitespace(target, &lNormalizedTarget);
174+ ascii::normalize_space(target, &lNormalizedTarget);
175
176 if (!GenericCast::castableToNCName(lNormalizedTarget))
177 {
178
179=== modified file 'src/runtime/core/constructors.cpp'
180--- src/runtime/core/constructors.cpp 2013-03-15 08:22:41 +0000
181+++ src/runtime/core/constructors.cpp 2013-05-09 00:49:28 +0000
182@@ -687,7 +687,7 @@
183 // normalize value of xml:id
184 if (isId)
185 {
186- ascii::normalize_whitespace(lexicalValue);
187+ ascii::normalize_space(lexicalValue);
188 }
189
190 GENV_ITEMFACTORY->createUntypedAtomic(typedValue, lexicalValue);
191
192=== modified file 'src/runtime/durations_dates_times/format_dateTime.cpp'
193--- src/runtime/durations_dates_times/format_dateTime.cpp 2013-05-04 20:23:57 +0000
194+++ src/runtime/durations_dates_times/format_dateTime.cpp 2013-05-09 00:49:28 +0000
195@@ -630,7 +630,7 @@
196 zstring::const_iterator *i,
197 modifier *mod, QueryLoc const &loc ) {
198 zstring::const_iterator &j = *i;
199- ascii::skip_whitespace( picture_str, &j );
200+ ascii::skip_space( picture_str, &j );
201 if ( j == picture_str.end() || *j == ',' ) {
202 //
203 // Assume that the ',' is the start of the width modifier (hence there is
204@@ -875,7 +875,7 @@
205 zstring::const_iterator *i, modifier *mod,
206 QueryLoc const &loc ) {
207 zstring::const_iterator &j = *i;
208- ascii::skip_whitespace( picture_str, &j );
209+ ascii::skip_space( picture_str, &j );
210 if ( j == picture_str.end() )
211 return;
212
213@@ -965,10 +965,10 @@
214 QueryLoc const &loc ) {
215 zstring::const_iterator &j = *i;
216
217- ascii::skip_whitespace( picture_str, &j );
218+ ascii::skip_space( picture_str, &j );
219 if ( j == picture_str.end() || (*j != ',' && *j != ';') )
220 return;
221- ascii::skip_whitespace( picture_str, &++j );
222+ ascii::skip_space( picture_str, &++j );
223 if ( j == picture_str.end() )
224 goto bad_width_modifier;
225 if ( *j == '*' ) {
226@@ -987,10 +987,10 @@
227
228 mod->max_width = 0;
229
230- ascii::skip_whitespace( picture_str, &j );
231+ ascii::skip_space( picture_str, &j );
232 if ( j == picture_str.end() || *j != '-' )
233 return;
234- ascii::skip_whitespace( picture_str, &++j );
235+ ascii::skip_space( picture_str, &++j );
236 if ( j == picture_str.end() )
237 goto bad_width_modifier;
238 if ( *j == '*' )
239
240=== modified file 'src/runtime/numerics/format_number.cpp'
241--- src/runtime/numerics/format_number.cpp 2013-05-04 14:06:36 +0000
242+++ src/runtime/numerics/format_number.cpp 2013-05-09 00:49:28 +0000
243@@ -786,7 +786,7 @@
244 } else {
245
246 zstring format_name( format_name_item->getStringValue() );
247- ascii::trim_whitespace( format_name );
248+ ascii::trim_space( format_name );
249 zstring prefix, local;
250 if ( !xml::split_name( format_name, &prefix, &local ) ||
251 prefix.empty() ) {
252
253=== modified file 'src/runtime/qnames/qnames_impl.cpp'
254--- src/runtime/qnames/qnames_impl.cpp 2013-02-07 17:24:36 +0000
255+++ src/runtime/qnames/qnames_impl.cpp 2013-05-09 00:49:28 +0000
256@@ -58,7 +58,7 @@
257 {
258 itemQName->getStringValue2(qname);
259
260- ascii::trim_whitespace(qname);
261+ ascii::trim_space(qname);
262
263 index = qname.find(":", 0, 1);
264
265@@ -135,14 +135,14 @@
266 {
267 itemURI->getStringValue2(resNs);
268
269- ascii::trim_whitespace(resNs);
270+ ascii::trim_space(resNs);
271 }
272
273 consumeNext(itemQName, theChild1.getp(), planState );
274
275 itemQName->getStringValue2(qname);
276
277- ascii::trim_whitespace(qname);
278+ ascii::trim_space(qname);
279
280 index = qname.find(":", 0, 1);
281
282@@ -295,7 +295,7 @@
283 else
284 {
285 itemPrefix->getStringValue2(prefix);
286- ascii::trim_whitespace(prefix);
287+ ascii::trim_space(prefix);
288 }
289
290 if (!consumeNext(itemElem, theChildren[1].getp(), planState ))
291
292=== modified file 'src/runtime/strings/strings_impl.cpp'
293--- src/runtime/strings/strings_impl.cpp 2013-05-06 14:27:15 +0000
294+++ src/runtime/strings/strings_impl.cpp 2013-05-09 00:49:28 +0000
295@@ -767,7 +767,7 @@
296 if (consumeNext(item, theChildren [0].getp(), planState))
297 {
298 item->getStringValue2(resStr);
299- ascii::normalize_whitespace(resStr);
300+ ascii::normalize_space(resStr);
301 STACK_PUSH(GENV_ITEMFACTORY->createString(result, resStr), state);
302 }
303 else
304@@ -811,7 +811,7 @@
305 ZORBA_ASSERT(false);
306
307 item1->getStringValue2(normForm);
308- ascii::trim_whitespace(normForm);
309+ ascii::trim_space(normForm);
310 zstring tmp(normForm);
311 utf8::to_upper(tmp, &normForm);
312 }
313
314=== modified file 'src/store/naive/atomic_items.cpp'
315--- src/store/naive/atomic_items.cpp 2013-05-08 20:14:47 +0000
316+++ src/store/naive/atomic_items.cpp 2013-05-09 00:49:28 +0000
317@@ -570,7 +570,7 @@
318 bool UntypedAtomicItem::castToBoolean(store::Item_t& result) const
319 {
320 zstring str;
321- ascii::trim_whitespace(theValue, &str);
322+ ascii::trim_space(theValue, &str);
323 bool value = true;
324
325 if (ZSTREQ(str, "false") || ZSTREQ(str, "0"))
326
327=== modified file 'src/store/naive/simple_item_factory.cpp'
328--- src/store/naive/simple_item_factory.cpp 2013-04-17 18:37:33 +0000
329+++ src/store/naive/simple_item_factory.cpp 2013-05-09 00:49:28 +0000
330@@ -1222,7 +1222,7 @@
331 zstring prefix;
332 zstring local;
333
334- ascii::trim_whitespace(str);
335+ ascii::trim_space(str);
336 zstring::size_type pos = str.rfind(":", str.size(), 1);
337
338 if (pos != zstring::npos)
339@@ -2202,7 +2202,7 @@
340 zstring& textValue,
341 std::vector<zstring>& atomicTextValues)
342 {
343- ascii::normalize_whitespace(textValue);
344+ ascii::normalize_space(textValue);
345
346 zstring::size_type start = 0;
347 zstring::size_type i = 0;
348
349=== modified file 'src/types/casting.cpp'
350--- src/types/casting.cpp 2013-05-08 20:14:47 +0000
351+++ src/types/casting.cpp 2013-05-09 00:49:28 +0000
352@@ -576,7 +576,7 @@
353 zstring::size_type len = strval.size();
354 zstring::size_type pos = 0;
355
356- ascii::skip_whitespace(str, len, &pos);
357+ ascii::skip_space(str, len, &pos);
358
359 str += pos;
360
361@@ -606,7 +606,7 @@
362 }
363
364 pos = str - strval.c_str();
365- ascii::skip_whitespace(strval.c_str(), len, &pos);
366+ ascii::skip_space(strval.c_str(), len, &pos);
367
368 if (pos != len)
369 {
370@@ -661,7 +661,7 @@
371
372 T1_TO_T2(str, QN)
373 {
374- ascii::trim_whitespace(strval);
375+ ascii::trim_space(strval);
376
377 zstring::size_type idx = strval.find(":");
378 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);
379@@ -713,7 +713,7 @@
380
381 T1_TO_T2(str, NOT)
382 {
383- ascii::trim_whitespace(strval);
384+ ascii::trim_space(strval);
385
386 zstring uri;
387 zstring prefix;
388@@ -1736,7 +1736,7 @@
389 char ch;
390 zstring::size_type sz = strval.size();
391
392- ascii::trim_whitespace(strval);
393+ ascii::trim_space(strval);
394
395 bool spaceSeen = false;
396
397@@ -1783,7 +1783,7 @@
398 }
399 case store::XS_NMTOKEN:
400 {
401- ascii::trim_whitespace(strval);
402+ ascii::trim_space(strval);
403
404 if (GenericCast::instance()->castableToNMToken(strval))
405 {
406@@ -1794,7 +1794,7 @@
407 }
408 case store::XS_NAME:
409 {
410- ascii::trim_whitespace(strval);
411+ ascii::trim_space(strval);
412
413 if (GenericCast::instance()->castableToName(strval))
414 {
415@@ -1805,8 +1805,8 @@
416 }
417 case store::XS_NCNAME:
418 {
419- ascii::normalize_whitespace(strval);
420- ascii::trim_whitespace(strval);
421+ ascii::normalize_space(strval);
422+ ascii::trim_space(strval);
423
424 if (GenericCast::castableToNCName(strval))
425 {
426@@ -2665,7 +2665,7 @@
427 zstring strval;
428 item->getStringValue2(strval);
429
430- ascii::trim_whitespace(strval);
431+ ascii::trim_space(strval);
432
433 zstring::size_type idx = strval.find(":");
434 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);
435
436=== modified file 'src/types/schema/XercesParseUtils.cpp'
437--- src/types/schema/XercesParseUtils.cpp 2013-05-08 20:14:47 +0000
438+++ src/types/schema/XercesParseUtils.cpp 2013-05-09 00:49:28 +0000
439@@ -463,7 +463,7 @@
440 // remove following if xs:float will be represented by a C float
441 //textValue = textValue.trim(" \n\r\t",4);
442 zstring textValue2;
443- utf8::normalize_whitespace(textValue, &textValue2);
444+ utf8::normalize_space(textValue, &textValue2);
445 try
446 {
447 xs_float const n(textValue2.c_str());
448@@ -501,7 +501,7 @@
449 // remove following if xs:float will be represented by a C float
450 //textValue = textValue.trim(" \n\r\t",4);
451 zstring textValue2;
452- utf8::normalize_whitespace(textValue, &textValue2);
453+ utf8::normalize_space(textValue, &textValue2);
454 store::ItemFactory* factory = GENV_ITEMFACTORY;
455 try {
456 xs_double const n(textValue2.c_str());
457@@ -550,7 +550,7 @@
458 {
459 // optimization posible since there is no pattern to be checked
460 zstring textValue2;
461- utf8::normalize_whitespace(textValue, &textValue2);
462+ utf8::normalize_space(textValue, &textValue2);
463 store::ItemFactory* factory = GENV_ITEMFACTORY;
464 return factory->createString(result, textValue2);
465 }
466@@ -562,7 +562,7 @@
467 {
468 // optimization posible since there is no pattern to be checked
469 zstring textValue2;
470- utf8::normalize_whitespace(textValue, &textValue2);
471+ utf8::normalize_space(textValue, &textValue2);
472 store::ItemFactory* factory = GENV_ITEMFACTORY;
473
474 return factory->createNormalizedString(result, textValue2);
475@@ -580,7 +580,7 @@
476 //return true;
477
478 zstring textValue2;
479- utf8::normalize_whitespace(textValue, &textValue2);
480+ utf8::normalize_space(textValue, &textValue2);
481 XMLCh* content = XMLString::transcode(textValue2.c_str());
482 XSValue::DataType datatype = XSValue::dt_token;
483 XSValue::Status status = XSValue::st_Init;
484@@ -607,7 +607,7 @@
485 store::Item_t &result)
486 {
487 zstring textValue2;
488- utf8::normalize_whitespace(textValue, &textValue2);
489+ utf8::normalize_space(textValue, &textValue2);
490
491 XMLCh* content = XMLString::transcode(textValue2.c_str());
492 XSValue::DataType datatype = XSValue::dt_NMTOKEN;
493@@ -635,7 +635,7 @@
494 store::Item_t &result)
495 {
496 zstring textValue2;
497- utf8::normalize_whitespace(textValue, &textValue2);
498+ utf8::normalize_space(textValue, &textValue2);
499
500 XMLCh* content = XMLString::transcode(textValue2.c_str());
501 XSValue::DataType datatype = XSValue::dt_Name;
502@@ -664,7 +664,7 @@
503 store::Item_t &result)
504 {
505 zstring textValue2;
506- utf8::normalize_whitespace(textValue, &textValue2);
507+ utf8::normalize_space(textValue, &textValue2);
508
509 XMLCh* content = XMLString::transcode(textValue2.c_str());
510 XSValue::DataType datatype = XSValue::dt_NCName;
511@@ -692,7 +692,7 @@
512 store::Item_t &result)
513 {
514 zstring textValue2;
515- utf8::normalize_whitespace(textValue, &textValue2);
516+ utf8::normalize_space(textValue, &textValue2);
517
518 XMLCh* content = XMLString::transcode(textValue.c_str());
519 XSValue::DataType datatype = XSValue::dt_ID;
520@@ -720,7 +720,7 @@
521 store::Item_t &result)
522 {
523 zstring textValue2;
524- utf8::normalize_whitespace(textValue, &textValue2);
525+ utf8::normalize_space(textValue, &textValue2);
526
527 XMLCh* content = XMLString::transcode(textValue.c_str());
528 XSValue::DataType datatype = XSValue::dt_IDREF;
529@@ -748,7 +748,7 @@
530 store::Item_t &result)
531 {
532 zstring textValue2;
533- utf8::normalize_whitespace(textValue, &textValue2);
534+ utf8::normalize_space(textValue, &textValue2);
535
536 XMLCh* content = XMLString::transcode(textValue2.c_str());
537 XSValue::DataType datatype = XSValue::dt_ENTITY;
538@@ -776,7 +776,7 @@
539 store::Item_t &result)
540 {
541 zstring textValue2;
542- utf8::normalize_whitespace(textValue, &textValue2);
543+ utf8::normalize_space(textValue, &textValue2);
544
545 XMLCh* content = XMLString::transcode(textValue2.c_str());
546 XSValue::DataType datatype = XSValue::dt_NOTATION;
547@@ -834,7 +834,7 @@
548 //return factory->createDateTime(result, year, month, day, hour, minute, sec);
549 xs_dateTime dt;
550 zstring textValue2;
551- utf8::normalize_whitespace(textValue, &textValue2);
552+ utf8::normalize_space(textValue, &textValue2);
553
554 // Warning: parsing code is not using Xerces
555 if (0 == DateTime::parseDateTime(textValue2.c_str(), textValue2.size(), dt))
556@@ -874,7 +874,7 @@
557 //return factory->createDate(result, tValue);
558 xs_date d;
559 zstring textValue2;
560- utf8::normalize_whitespace(textValue, &textValue2);
561+ utf8::normalize_space(textValue, &textValue2);
562
563 // Warning: parsing code is not using Xerces
564 if (0 == DateTime::parseDate(textValue2.c_str(), textValue2.size(), d))
565@@ -919,7 +919,7 @@
566 //return factory->createTime(result, tValue);
567 xs_time t;
568 zstring textValue2;
569- utf8::normalize_whitespace(textValue, &textValue2);
570+ utf8::normalize_space(textValue, &textValue2);
571
572 // Warning: parsing code is not using Xerces
573 if (0 == DateTime::parseTime(textValue2.c_str(), textValue2.size(), t))
574@@ -954,7 +954,7 @@
575 xs_gYearMonth tValue;
576
577 zstring textValue2;
578- utf8::normalize_whitespace(textValue, &textValue2);
579+ utf8::normalize_space(textValue, &textValue2);
580
581 // Warning: parsing code is not using Xerces
582 if (DateTime::parseGYearMonth(textValue2.c_str(), textValue2.size(), tValue))
583@@ -988,7 +988,7 @@
584 xs_gYear tValue;
585
586 zstring textValue2;
587- utf8::normalize_whitespace(textValue, &textValue2);
588+ utf8::normalize_space(textValue, &textValue2);
589
590 // Warning: parsing code is not using Xerces
591 if (DateTime::parseGYear(textValue2.c_str(), textValue2.size(), tValue))
592@@ -1022,7 +1022,7 @@
593 store::ItemFactory* factory = GENV_ITEMFACTORY;
594 xs_gMonthDay tValue;
595 zstring textValue2;
596- utf8::normalize_whitespace(textValue, &textValue2);
597+ utf8::normalize_space(textValue, &textValue2);
598
599 // Warning: parsing code is not using Xerces
600 if (DateTime::parseGMonthDay(textValue2.c_str(), textValue2.size(), tValue))
601@@ -1055,7 +1055,7 @@
602 store::ItemFactory* factory = GENV_ITEMFACTORY;
603 xs_gDay tValue;
604 zstring textValue2;
605- utf8::normalize_whitespace(textValue, &textValue2);
606+ utf8::normalize_space(textValue, &textValue2);
607
608 // Warning: parsing code is not using Xerces
609 if (DateTime::parseGDay(textValue2.c_str(), textValue2.size(), tValue))
610@@ -1088,7 +1088,7 @@
611 store::ItemFactory* factory = GENV_ITEMFACTORY;
612 xs_gMonth tValue;
613 zstring textValue2;
614- utf8::normalize_whitespace(textValue, &textValue2);
615+ utf8::normalize_space(textValue, &textValue2);
616
617 // Warning: parsing code is not using Xerces
618 if (DateTime::parseGMonth(textValue2.c_str(), textValue2.size(), tValue))
619@@ -1127,7 +1127,7 @@
620 store::ItemFactory* factory = GENV_ITEMFACTORY;
621 Duration tValue;
622 zstring textValue2;
623- utf8::normalize_whitespace(textValue, &textValue2);
624+ utf8::normalize_space(textValue, &textValue2);
625
626 // Warning: parsing code is not using Xerces
627 if (0 == Duration::parseDuration(textValue2.c_str(), textValue2.size(), tValue))
628@@ -1263,7 +1263,7 @@
629
630 store::ItemFactory* factory = GENV_ITEMFACTORY;
631 zstring textValue2;
632- utf8::normalize_whitespace(textValue, &textValue2);
633+ utf8::normalize_space(textValue, &textValue2);
634
635 return factory->createAnyURI(result, textValue2);
636 }
637@@ -1289,7 +1289,7 @@
638
639 store::ItemFactory* factory = GENV_ITEMFACTORY;
640 zstring textValue2;
641- utf8::normalize_whitespace(textValue, &textValue2);
642+ utf8::normalize_space(textValue, &textValue2);
643
644 // todo: get the right namespace from the current context
645 zstring lNamespace;
646
647=== modified file 'src/types/schema/schema.cpp'
648--- src/types/schema/schema.cpp 2013-05-02 00:18:56 +0000
649+++ src/types/schema/schema.cpp 2013-05-09 00:49:28 +0000
650@@ -1839,7 +1839,7 @@
651 std::vector<zstring>& atomicTextValues)
652 {
653 zstring normalizedTextValue;
654- utf8::normalize_whitespace(textValue, &normalizedTextValue);
655+ utf8::normalize_space(textValue, &normalizedTextValue);
656
657 size_t start = 0;
658 size_t i = 0;
659
660=== modified file 'src/types/schema/validate.cpp'
661--- src/types/schema/validate.cpp 2013-04-23 20:38:23 +0000
662+++ src/types/schema/validate.cpp 2013-05-09 00:49:28 +0000
663@@ -732,7 +732,7 @@
664
665 // XQ XP Datamodel Spec: http://www.w3.org/TR/xpath-datamodel/
666 // section 6.7.4 Construction from a PSVI
667- if ( !utf8::is_whitespace(textNodeValue) )
668+ if ( !utf8::is_space(textNodeValue) )
669 {
670 zstring empty;
671 GENV_ITEMFACTORY->createTextNode(validatedTextNode,
672
673=== modified file 'src/unit_tests/test_string.cpp'
674--- src/unit_tests/test_string.cpp 2013-02-07 17:24:36 +0000
675+++ src/unit_tests/test_string.cpp 2013-05-09 00:49:28 +0000
676@@ -330,16 +330,16 @@
677 }
678
679 template<class StringType>
680-static void test_normalize_whitespace() {
681+static void test_normalize_space() {
682 StringType const s( " hello world " );
683 StringType u;
684
685- ascii::normalize_whitespace( s, &u );
686+ ascii::normalize_space( s, &u );
687 ASSERT_TRUE( u == "hello world" );
688
689 utf8_string<StringType const> const s8( s );
690 utf8_string<StringType> u8( u );
691- utf8::normalize_whitespace( s8, &u8 );
692+ utf8::normalize_space( s8, &u8 );
693 ASSERT_TRUE( u8 == "hello world" );
694 }
695
696@@ -493,14 +493,14 @@
697 ASSERT_TRUE( !utf8::ends_with( u_ab, "a" ) );
698 }
699
700-static void test_skip_whitespace() {
701+static void test_skip_space() {
702 char const s[] = " hello world";
703 ascii::size_type const s_len = ::strlen( s );
704 ascii::size_type pos = 0;
705- ascii::skip_whitespace( s, s_len, &pos );
706+ ascii::skip_space( s, s_len, &pos );
707 ASSERT_TRUE( pos == 2 );
708 pos = 7;
709- ascii::skip_whitespace( s, s_len, &pos );
710+ ascii::skip_space( s, s_len, &pos );
711 ASSERT_TRUE( pos == 8 );
712 }
713
714@@ -673,16 +673,16 @@
715 }
716
717 template<class StringType>
718-static void test_trim_whitespace() {
719+static void test_trim_space() {
720 StringType const s( " hello world " );
721 StringType u;
722
723- ascii::trim_whitespace( s, &u );
724+ ascii::trim_space( s, &u );
725 ASSERT_TRUE( u == "hello world" );
726
727 utf8_string<StringType const> const s8( s );
728 utf8_string<StringType> u8( u );
729- utf8::trim_whitespace( s8, &u8 );
730+ utf8::trim_space( s8, &u8 );
731 ASSERT_TRUE( u8 == "hello world" );
732 }
733
734@@ -854,10 +854,10 @@
735 test_next_match();
736 test_next_token();
737
738- test_normalize_whitespace<string>();
739- test_normalize_whitespace<zstring>();
740- test_normalize_whitespace<zstring_p>();
741- test_normalize_whitespace<String>();
742+ test_normalize_space<string>();
743+ test_normalize_space<zstring>();
744+ test_normalize_space<zstring_p>();
745+ test_normalize_space<String>();
746
747 test_replace_all<string>();
748 test_replace_all<String>();
749@@ -872,7 +872,7 @@
750 test_reverse<zstring_p>( utf8_aeiou_acute );
751 test_reverse<String>( utf8_aeiou_acute );
752
753- test_skip_whitespace();
754+ test_skip_space();
755
756 test_split<string>( "a", "b" );
757 test_split<zstring>( "a", "b" );
758@@ -911,9 +911,9 @@
759
760 test_trim_start();
761 test_trim_end();
762- test_trim_whitespace<string>();
763- test_trim_whitespace<zstring>();
764- test_trim_whitespace<String>();
765+ test_trim_space<string>();
766+ test_trim_space<zstring>();
767+ test_trim_space<String>();
768
769 test_uri_encode<string>();
770 test_uri_encode<String>();
771
772=== modified file 'src/util/ascii_util.cpp'
773--- src/util/ascii_util.cpp 2013-03-19 04:22:49 +0000
774+++ src/util/ascii_util.cpp 2013-05-09 00:49:28 +0000
775@@ -30,7 +30,7 @@
776
777 ///////////////////////////////////////////////////////////////////////////////
778
779-bool is_whitespace( char const *s ) {
780+bool is_space( char const *s ) {
781 for ( ; *s; ++s ) {
782 if ( !is_space( *s ) )
783 return false;
784
785=== modified file 'src/util/ascii_util.h'
786--- src/util/ascii_util.h 2013-05-06 22:57:08 +0000
787+++ src/util/ascii_util.h 2013-05-09 00:49:28 +0000
788@@ -73,7 +73,7 @@
789 *
790 * @param s The string to append to.
791 */
792- explicit back_ascii_insert_iterator( StringType &s ) : base_type( s ) {
793+ explicit back_ascii_insert_iterator( StringType *s ) : base_type( s ) {
794 }
795
796 back_ascii_insert_iterator& operator=( value_type c );
797@@ -86,7 +86,7 @@
798 * @param out The output string.
799 */
800 template<class StringType> inline back_ascii_insert_iterator<StringType>
801-back_ascii_inserter( StringType &out ) {
802+back_ascii_inserter( StringType *out ) {
803 return back_ascii_insert_iterator<StringType>( out );
804 }
805
806@@ -102,7 +102,8 @@
807 * @return Returns \c true only if the character is an ASCII character.
808 */
809 template<typename CharType> inline
810-bool is_ascii( CharType c ) {
811+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
812+is_ascii( CharType c ) {
813 #ifdef WIN32
814 return __isascii( c );
815 #else
816@@ -120,7 +121,8 @@
817 * @return Returns \c true only if the character is an alphabetic character.
818 */
819 template<typename CharType> inline
820-bool is_alpha( CharType c ) {
821+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
822+is_alpha( CharType c ) {
823 return is_ascii( c ) && isalpha( c );
824 }
825
826@@ -134,7 +136,8 @@
827 * @return Returns \c true only if the character is an alpha-numeric character.
828 */
829 template<typename CharType> inline
830-bool is_alnum( CharType c ) {
831+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
832+is_alnum( CharType c ) {
833 return is_ascii( c ) && isalnum( c );
834 }
835
836@@ -148,7 +151,8 @@
837 * @return Returns \c true only if the character is a control character.
838 */
839 template<typename CharType> inline
840-bool is_cntrl( CharType c ) {
841+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
842+is_cntrl( CharType c ) {
843 return is_ascii( c ) && iscntrl( c );
844 }
845
846@@ -162,7 +166,8 @@
847 * @return Returns \c true only if the character is a decimal digit.
848 */
849 template<typename CharType> inline
850-bool is_digit( CharType c ) {
851+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
852+is_digit( CharType c ) {
853 return is_ascii( c ) && isdigit( c );
854 }
855
856@@ -176,7 +181,8 @@
857 * @return Returns \c true only if the character is a printing character.
858 */
859 template<typename CharType> inline
860-bool is_print( CharType c ) {
861+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
862+is_print( CharType c ) {
863 return is_ascii( c ) && isprint( c );
864 }
865
866@@ -190,7 +196,8 @@
867 * @return Returns \c true only if the character is a punctuation character.
868 */
869 template<typename CharType> inline
870-bool is_punct( CharType c ) {
871+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
872+is_punct( CharType c ) {
873 return is_ascii( c ) && ispunct( c );
874 }
875
876@@ -199,12 +206,13 @@
877 * exists to make a proper function out of the standard isspace(3) that may be
878 * implemented as a macro.
879 *
880- * @param CharType The character type.
881+ * @tparam CharType The character type.
882 * @param c The character to check.
883 * @return Returns \c true only if the character is a whitespace character.
884 */
885 template<typename CharType> inline
886-bool is_space( CharType c ) {
887+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
888+is_space( CharType c ) {
889 return is_ascii( c ) && isspace( c );
890 }
891
892@@ -214,17 +222,19 @@
893 * @param s The NULL-terminated C string to check.
894 * @return Returns \c true only if the entire string is whitespace.
895 */
896-bool is_whitespace( char const *s );
897+bool is_space( char const *s );
898
899 /**
900 * Checks whether an entire string is whitespace.
901 *
902+ * @tparam StringType The string type.
903 * @param s The string to check.
904 * @return Returns \c true only if the entire string is whitespace.
905 */
906 template<class StringType> inline
907-bool is_whitespace( StringType const &s ) {
908- return is_whitespace( s.c_str() );
909+typename std::enable_if<ZORBA_HAS_C_STR(StringType),bool>::type
910+is_space( StringType const &s ) {
911+ return is_space( s.c_str() );
912 }
913
914 /**
915@@ -237,7 +247,8 @@
916 * @return Returns \c true only if the character is a hexadecimal digit.
917 */
918 template<typename CharType> inline
919-bool is_xdigit( CharType c ) {
920+typename std::enable_if<ZORBA_TR1_NS::is_integral<CharType>::value,bool>::type
921+is_xdigit( CharType c ) {
922 return is_ascii( c ) && isxdigit( c );
923 }
924
925@@ -263,7 +274,8 @@
926 * @return Returns \c true only if \a s begins with \a c.
927 */
928 template<class StringType> inline
929-bool begins_with( StringType const &s, char c ) {
930+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
931+begins_with( StringType const &s, char c ) {
932 return !s.empty() && s[0] == c;
933 }
934
935@@ -300,8 +312,9 @@
936 * @return Returns \c true only if \a s begins with \a ps.
937 */
938 template<class StringType> inline
939-bool begins_with( StringType const &s, char const *ps,
940- typename StringType::size_type n ) {
941+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
942+begins_with( StringType const &s, char const *ps,
943+ typename StringType::size_type n ) {
944 typedef typename StringType::traits_type traits_type;
945 return n <= s.size() && traits_type::compare( s.data(), ps, n ) == 0;
946 }
947@@ -315,7 +328,8 @@
948 * @return Returns \c true only if \a s begins with \a ps.
949 */
950 template<class StringType> inline
951-bool begins_with( StringType const &s, char const *ps ) {
952+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
953+begins_with( StringType const &s, char const *ps ) {
954 return begins_with( s, ps, std::strlen( ps ) );
955 }
956
957@@ -329,7 +343,10 @@
958 * @return Returns \c true only if \a s ends with \a ps.
959 */
960 template<class StringType,class PrefixStringType> inline
961-bool begins_with( StringType const &s, PrefixStringType const &ps ) {
962+typename std::enable_if<ZORBA_IS_STRING(StringType)
963+ && ZORBA_IS_STRING(PrefixStringType),
964+ bool>::type
965+begins_with( StringType const &s, PrefixStringType const &ps ) {
966 return begins_with( s, ps.data(), ps.size() );
967 }
968
969@@ -354,7 +371,8 @@
970 * @return Returns \c true only if \a s ends with \a c.
971 */
972 template<class StringType> inline
973-bool ends_with( StringType const &s, char c ) {
974+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
975+ends_with( StringType const &s, char c ) {
976 return !s.empty() && s[ s.size() - 1 ] == c;
977 }
978
979@@ -392,8 +410,9 @@
980 * @return Returns \c true only if \a s ends with \a ss.
981 */
982 template<class StringType> inline
983-bool ends_with( StringType const &s, char const *ss,
984- typename StringType::size_type ss_len ) {
985+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
986+ends_with( StringType const &s, char const *ss,
987+ typename StringType::size_type ss_len ) {
988 typename StringType::size_type const result = s.rfind( ss );
989 return result != StringType::npos && result + ss_len == s.size();
990 }
991@@ -407,7 +426,8 @@
992 * @return Returns \c true only if \a s ends with \a ss.
993 */
994 template<class StringType> inline
995-bool ends_with( StringType const &s, char const *ss ) {
996+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
997+ends_with( StringType const &s, char const *ss ) {
998 return ends_with( s, ss, std::strlen( ss ) );
999 }
1000
1001@@ -421,7 +441,10 @@
1002 * @return Returns \c true only if \a s ends with \a ss.
1003 */
1004 template<class StringType,class SuffixStringType> inline
1005-bool ends_with( StringType const &s, SuffixStringType const &ss ) {
1006+typename std::enable_if<ZORBA_IS_STRING(StringType)
1007+ && ZORBA_IS_STRING(SuffixStringType),
1008+ bool>::type
1009+ends_with( StringType const &s, SuffixStringType const &ss ) {
1010 return ends_with( s, ss.data(), ss.size() );
1011 }
1012
1013@@ -467,7 +490,8 @@
1014 * @param s The string to convert.
1015 */
1016 template<class StringType> inline
1017-void to_lower( StringType &s ) {
1018+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1019+to_lower( StringType &s ) {
1020 std::transform(
1021 s.begin(), s.end(), s.begin(), static_cast<char (*)(char)>( to_lower )
1022 );
1023@@ -483,7 +507,10 @@
1024 * contents are overwritten.
1025 */
1026 template<class InputStringType,class OutputStringType> inline
1027-void to_lower( InputStringType const &in, OutputStringType *out ) {
1028+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1029+ && ZORBA_IS_STRING(OutputStringType),
1030+ void>::type
1031+to_lower( InputStringType const &in, OutputStringType *out ) {
1032 std::transform(
1033 in.begin(), in.end(), std::back_inserter( *out ),
1034 static_cast<char (*)(char)>( to_lower )
1035@@ -530,7 +557,8 @@
1036 * @param s The string to convert.
1037 */
1038 template<class StringType> inline
1039-void to_upper( StringType &s ) {
1040+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1041+to_upper( StringType &s ) {
1042 std::transform(
1043 s.begin(), s.end(), s.begin(), static_cast<char (*)(char)>( to_upper )
1044 );
1045@@ -546,7 +574,10 @@
1046 * contents are overwritten.
1047 */
1048 template<class InputStringType,class OutputStringType> inline
1049-void to_upper( InputStringType const &in, OutputStringType *out ) {
1050+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1051+ && ZORBA_IS_STRING(OutputStringType),
1052+ void>::type
1053+to_upper( InputStringType const &in, OutputStringType *out ) {
1054 std::transform(
1055 in.begin(), in.end(), std::back_inserter( *out ),
1056 static_cast<char (*)(char)>( to_upper )
1057@@ -588,7 +619,8 @@
1058 * @return Returns \c true only if at least one replacement is performed.
1059 */
1060 template<class StringType>
1061-bool replace_all( StringType &s, char from, char to );
1062+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
1063+replace_all( StringType &s, char from, char to );
1064
1065 /**
1066 * Replaces all occurrences of one substring with another.
1067@@ -602,9 +634,10 @@
1068 * @return Returns \c true only if at least one replacement is performed.
1069 */
1070 template<class StringType>
1071-bool replace_all( StringType &s,
1072- char const *from, typename StringType::size_type from_len,
1073- char const *to, typename StringType::size_type to_len );
1074+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
1075+replace_all( StringType &s,
1076+ char const *from, typename StringType::size_type from_len,
1077+ char const *to, typename StringType::size_type to_len );
1078
1079 /**
1080 * Replaces all occurrences of one substring with another.
1081@@ -616,7 +649,8 @@
1082 * @return Returns \c true only if at least one replacement is performed.
1083 */
1084 template<class StringType> inline
1085-bool replace_all( StringType &s, char const *from, char const *to ) {
1086+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
1087+replace_all( StringType &s, char const *from, char const *to ) {
1088 return replace_all( s, from, std::strlen( from ), to, std::strlen( to ) );
1089 }
1090
1091@@ -630,7 +664,10 @@
1092 * @return Returns \c true only if at least one replacement is performed.
1093 */
1094 template<class StringType,class ToStringType> inline
1095-bool replace_all( StringType &s, char const *from, ToStringType const &to ) {
1096+typename std::enable_if<ZORBA_IS_STRING(StringType)
1097+ && ZORBA_IS_STRING(ToStringType),
1098+ bool>::type
1099+replace_all( StringType &s, char const *from, ToStringType const &to ) {
1100 return replace_all( s, from, std::strlen( from ), to.data(), to.size() );
1101 }
1102
1103@@ -644,8 +681,12 @@
1104 * @return Returns \c true only if at least one replacement is performed.
1105 */
1106 template<class StringType,class FromStringType,class ToStringType> inline
1107-bool replace_all( StringType &s, FromStringType const &from,
1108- ToStringType const &to ) {
1109+typename std::enable_if<ZORBA_IS_STRING(StringType)
1110+ && ZORBA_IS_STRING(FromStringType)
1111+ && ZORBA_IS_STRING(ToStringType),
1112+ bool>::type
1113+replace_all( StringType &s, FromStringType const &from,
1114+ ToStringType const &to ) {
1115 return replace_all( s, from.data(), from.size(), to.data(), to.size() );
1116 }
1117
1118@@ -797,7 +838,10 @@
1119 * @param out The output string (which must be different from \a in).
1120 */
1121 template<class InputStringType,class OutputStringType>
1122-void normalize_whitespace( InputStringType const &in, OutputStringType *out );
1123+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1124+ && ZORBA_IS_STRING(OutputStringType),
1125+ void>::type
1126+normalize_space( InputStringType const &in, OutputStringType *out );
1127
1128 /**
1129 * Converts sequences of one or more whitespace characters to a single space.
1130@@ -807,9 +851,10 @@
1131 * @param s The string.
1132 */
1133 template<class StringType> inline
1134-void normalize_whitespace( StringType &s ) {
1135+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1136+normalize_space( StringType &s ) {
1137 StringType temp;
1138- normalize_whitespace( s, &temp );
1139+ normalize_space( s, &temp );
1140 s = temp;
1141 }
1142
1143@@ -827,11 +872,13 @@
1144 /**
1145 * Removes all characters that are not among the specified characters.
1146 *
1147+ * @tparam StringType The string type.
1148 * @param s The string to remove characters from.
1149 * @param keep_chars The characters to keep.
1150 */
1151 template<class StringType>
1152-void remove_not_chars( StringType &s, char const *keep_chars );
1153+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1154+remove_not_chars( StringType &s, char const *keep_chars );
1155
1156 /**
1157 * Removes all whitespace characters by shifting the contents of the buffer to
1158@@ -841,7 +888,7 @@
1159 * @param s_len The length of \a s.
1160 * @return Returns the new length of \a s with all whitespace removed.
1161 */
1162-inline size_type remove_whitespace( char *s, size_type s_len ) {
1163+inline size_type remove_space( char *s, size_type s_len ) {
1164 return remove_chars( s, s_len, whitespace );
1165 }
1166
1167@@ -855,8 +902,10 @@
1168 * @param out The output string (which must be different from \a in).
1169 */
1170 template<class InputStringType,class OutputStringType>
1171-void trim( InputStringType const &in, char const *chars,
1172- OutputStringType *out );
1173+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1174+ && ZORBA_IS_STRING(OutputStringType),
1175+ void>::type
1176+trim( InputStringType const &in, char const *chars, OutputStringType *out );
1177
1178 /**
1179 * Removes all leading and trailing specified characters.
1180@@ -865,7 +914,8 @@
1181 * @param s The string.
1182 */
1183 template<class StringType> inline
1184-void trim( StringType &s, char const *chars ) {
1185+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1186+trim( StringType &s, char const *chars ) {
1187 StringType temp;
1188 trim( s, chars, &temp );
1189 s = temp;
1190@@ -917,8 +967,11 @@
1191 * @param out The output string (which must be different from \a in).
1192 */
1193 template<class InputStringType,class OutputStringType>
1194-void trim_start( InputStringType const &in, char const *chars,
1195- OutputStringType *out );
1196+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1197+ && ZORBA_IS_STRING(OutputStringType),
1198+ void>::type
1199+trim_start( InputStringType const &in, char const *chars,
1200+ OutputStringType *out );
1201
1202 /**
1203 * Removes all leading specified characters.
1204@@ -928,7 +981,8 @@
1205 * @param chars The characters to trim.
1206 */
1207 template<class StringType> inline
1208-void trim_start( StringType &s, char const *chars ) {
1209+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1210+trim_start( StringType &s, char const *chars ) {
1211 StringType temp;
1212 trim_start( s, chars, &temp );
1213 s = temp;
1214@@ -941,7 +995,7 @@
1215 * @return Returns a pointer to the first character in \a s that is not a
1216 * whitespace character.
1217 */
1218-inline char const* trim_start_whitespace( char const *s ) {
1219+inline char const* trim_start_space( char const *s ) {
1220 return trim_start( s, whitespace );
1221 }
1222
1223@@ -954,7 +1008,7 @@
1224 * @return Returns a pointer to the first character in \a s that is not a
1225 * whitespace character.
1226 */
1227-inline char const* trim_start_whitespace( char const *s, size_type *s_len ) {
1228+inline char const* trim_start_space( char const *s, size_type *s_len ) {
1229 return trim_start( s, s_len, whitespace );
1230 }
1231
1232@@ -966,7 +1020,7 @@
1233 * @return Returns a pointer to the first character in \a s that is not a
1234 * whitespace character.
1235 */
1236-inline char const* trim_start_whitespace( char const *s, size_type s_len ) {
1237+inline char const* trim_start_space( char const *s, size_type s_len ) {
1238 return trim_start( s, s_len, whitespace );
1239 }
1240
1241@@ -979,7 +1033,10 @@
1242 * @param out The output string (which must be different from \a in).
1243 */
1244 template<class InputStringType,class OutputStringType> inline
1245-void trim_start_whitespace( InputStringType const &in, OutputStringType *out ) {
1246+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1247+ && ZORBA_IS_STRING(OutputStringType),
1248+ void>::type
1249+trim_start_space( InputStringType const &in, OutputStringType *out ) {
1250 trim_start( in, whitespace, out );
1251 }
1252
1253@@ -990,9 +1047,10 @@
1254 * @param s The string.
1255 */
1256 template<class StringType> inline
1257-void trim_start_whitespace( StringType &s ) {
1258+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1259+trim_start_space( StringType &s ) {
1260 StringType temp;
1261- trim_start_whitespace( s, &temp );
1262+ trim_start_space( s, &temp );
1263 s = temp;
1264 }
1265
1266@@ -1027,8 +1085,10 @@
1267 * @param out The output string (which must be different from \a in).
1268 */
1269 template<class InputStringType,class OutputStringType>
1270-void trim_end( InputStringType const &in, char const *chars,
1271- OutputStringType *out );
1272+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1273+ && ZORBA_IS_STRING(OutputStringType),
1274+ void>::type
1275+trim_end( InputStringType const &in, char const *chars, OutputStringType *out );
1276
1277 /**
1278 * Removes all trailing specified characters.
1279@@ -1037,7 +1097,8 @@
1280 * @param s The string.
1281 */
1282 template<class StringType> inline
1283-void trim_end( StringType &s, char const *chars ) {
1284+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1285+trim_end( StringType &s, char const *chars ) {
1286 StringType temp;
1287 trim_end( s, chars, &temp );
1288 s = temp;
1289@@ -1050,7 +1111,7 @@
1290 * @param s_len The length of \a s.
1291 * @return Returns the new length of \a s.
1292 */
1293-inline size_type trim_end_whitespace( char const *s, size_type s_len ) {
1294+inline size_type trim_end_space( char const *s, size_type s_len ) {
1295 return trim_end( s, s_len, whitespace );
1296 }
1297
1298@@ -1060,7 +1121,7 @@
1299 * @param s The string to trim.
1300 * @return Returns the new length of \a s.
1301 */
1302-inline size_type trim_end_whitespace( char const *s ) {
1303+inline size_type trim_end_space( char const *s ) {
1304 return trim_end( s, whitespace );
1305 }
1306
1307@@ -1073,7 +1134,10 @@
1308 * @param out The output string (which must be different from \a in).
1309 */
1310 template<class InputStringType,class OutputStringType>
1311-void trim_end_whitespace( InputStringType const &in, OutputStringType *out ) {
1312+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1313+ && ZORBA_IS_STRING(OutputStringType),
1314+ void>::type
1315+trim_end_space( InputStringType const &in, OutputStringType *out ) {
1316 return trim_end( in, whitespace, out );
1317 }
1318
1319@@ -1084,12 +1148,13 @@
1320 * @param s The string.
1321 */
1322 template<class StringType> inline
1323-void trim_end_whitespace( StringType &s ) {
1324+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1325+trim_end_space( StringType &s ) {
1326 trim_end( s, whitespace );
1327 }
1328
1329 /**
1330- * Removed sll leading and trailing whitespace.
1331+ * Removes all leading and trailing whitespace.
1332 *
1333 * @param s The input C string.
1334 * @param s_len A pointer to the length of \a s. It is updated with the new
1335@@ -1097,9 +1162,9 @@
1336 * @return Returns a pointer to the first character in \a s that is not
1337 * whitespace.
1338 */
1339-inline char const* trim_whitespace( char const *s, size_type *s_len ) {
1340- s = trim_start_whitespace( s, s_len );
1341- *s_len = trim_end_whitespace( s, *s_len );
1342+inline char const* trim_space( char const *s, size_type *s_len ) {
1343+ s = trim_start_space( s, s_len );
1344+ *s_len = trim_end_space( s, *s_len );
1345 return s;
1346 }
1347
1348@@ -1112,7 +1177,10 @@
1349 * @param out The output string (which must be different from \a in).
1350 */
1351 template<class InputStringType,class OutputStringType> inline
1352-void trim_whitespace( InputStringType const &in, OutputStringType *out ) {
1353+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1354+ && ZORBA_IS_STRING(OutputStringType),
1355+ void>::type
1356+trim_space( InputStringType const &in, OutputStringType *out ) {
1357 trim( in, whitespace, out );
1358 }
1359
1360@@ -1123,9 +1191,10 @@
1361 * @param s The string.
1362 */
1363 template<class StringType> inline
1364-void trim_whitespace( StringType &s ) {
1365+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1366+trim_space( StringType &s ) {
1367 StringType temp;
1368- trim_whitespace( s, &temp );
1369+ trim_space( s, &temp );
1370 s = temp;
1371 }
1372
1373@@ -1138,10 +1207,10 @@
1374 * @param pos The position within \a s where to start looking for whitespace.
1375 * On return, \a pos is updated with the position of the 1st non-whitespace
1376 * char.
1377- * @deprecated Use trim_start_whitespace() instead.
1378+ * @deprecated Use trim_start_space() instead.
1379 */
1380-inline void skip_whitespace( char const *s, size_type s_len, size_type *pos ) {
1381- *pos = trim_start_whitespace( s + *pos, s_len - *pos ) - s;
1382+inline void skip_space( char const *s, size_type s_len, size_type *pos ) {
1383+ *pos = trim_start_space( s + *pos, s_len - *pos ) - s;
1384 }
1385
1386 /**
1387@@ -1155,11 +1224,11 @@
1388 * char.
1389 */
1390 template<class StringType> inline
1391-void skip_whitespace( StringType const &s,
1392- typename StringType::const_iterator *i ) {
1393+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1394+skip_space( StringType const &s, typename StringType::const_iterator *i ) {
1395 typename StringType::difference_type const d = *i - s.begin();
1396 char const *const sd = s.data() + d;
1397- std::advance( *i, trim_start_whitespace( sd, s.size() - d ) - sd );
1398+ std::advance( *i, trim_start_space( sd, s.size() - d ) - sd );
1399 }
1400
1401 ////////// Miscellaneous //////////////////////////////////////////////////////
1402@@ -1174,8 +1243,8 @@
1403 * @return Returns \c *s.
1404 */
1405 template<class StringType> inline
1406-StringType& left_pad( StringType *s, typename StringType::size_type width,
1407- char c ) {
1408+typename std::enable_if<ZORBA_IS_STRING(StringType),StringType&>::type
1409+left_pad( StringType *s, typename StringType::size_type width, char c ) {
1410 typedef typename StringType::size_type size_type;
1411 if ( s->size() < width )
1412 s->insert( static_cast<size_type>( 0 ), width - s->size(), c );
1413@@ -1192,8 +1261,8 @@
1414 * @return Returns \c *s.
1415 */
1416 template<class StringType> inline
1417-StringType& right_pad( StringType *s, typename StringType::size_type width,
1418- char c ) {
1419+typename std::enable_if<ZORBA_IS_STRING(StringType),StringType&>::type
1420+right_pad( StringType *s, typename StringType::size_type width, char c ) {
1421 if ( s->size() < width )
1422 s->append( width - s->size(), c );
1423 return *s;
1424@@ -1222,7 +1291,10 @@
1425 * @param out The output string.
1426 */
1427 template<class InputStringType,class OutputStringType> inline
1428-void reverse( InputStringType const &in, OutputStringType *out ) {
1429+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1430+ && ZORBA_IS_STRING(OutputStringType),
1431+ void>::type
1432+reverse( InputStringType const &in, OutputStringType *out ) {
1433 std::reverse_copy( in.begin(), in.end(), std::back_inserter( *out ) );
1434 }
1435
1436
1437=== modified file 'src/util/ascii_util.tcc'
1438--- src/util/ascii_util.tcc 2013-05-06 22:57:08 +0000
1439+++ src/util/ascii_util.tcc 2013-05-09 00:49:28 +0000
1440@@ -36,7 +36,10 @@
1441 ///////////////////////////////////////////////////////////////////////////////
1442
1443 template<class InputStringType,class OutputStringType>
1444-void normalize_whitespace( InputStringType const &in, OutputStringType *out ) {
1445+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1446+ && ZORBA_IS_STRING(OutputStringType),
1447+ void>::type
1448+normalize_space( InputStringType const &in, OutputStringType *out ) {
1449 typedef typename InputStringType::const_iterator const_iterator;
1450 const_iterator i( in.begin() );
1451 const_iterator const j( in.end() );
1452@@ -56,14 +59,16 @@
1453 }
1454
1455 template<class StringType>
1456-void remove_not_chars( StringType &s, char const *keep_chars ) {
1457+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
1458+remove_not_chars( StringType &s, char const *keep_chars ) {
1459 typename StringType::size_type pos = 0;
1460 while ( (pos = s.find_first_not_of( keep_chars, pos )) != StringType::npos )
1461 s.erase( pos, 1 );
1462 }
1463
1464 template<class StringType>
1465-bool replace_all( StringType &s, char from, char to ) {
1466+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
1467+replace_all( StringType &s, char from, char to ) {
1468 bool replaced_any = false;
1469 for ( typename StringType::size_type pos = 0; pos < s.size(); ++pos ) {
1470 if ( (pos = s.find( from, pos )) == StringType::npos )
1471@@ -75,9 +80,10 @@
1472 }
1473
1474 template<class StringType>
1475-bool replace_all( StringType &s,
1476- char const *from, typename StringType::size_type from_len,
1477- char const *to, typename StringType::size_type to_len ) {
1478+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
1479+replace_all( StringType &s,
1480+ char const *from, typename StringType::size_type from_len,
1481+ char const *to, typename StringType::size_type to_len ) {
1482 bool replaced_any = false;
1483 for ( typename StringType::size_type pos = 0;
1484 pos + from_len <= s.size(); pos += to_len ) {
1485@@ -90,8 +96,10 @@
1486 }
1487
1488 template<class InputStringType,class OutputStringType>
1489-void trim( InputStringType const &in, char const *chars,
1490- OutputStringType *out ) {
1491+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1492+ && ZORBA_IS_STRING(OutputStringType),
1493+ void>::type
1494+trim( InputStringType const &in, char const *chars, OutputStringType *out ) {
1495 *out = in;
1496 typename OutputStringType::size_type pos = out->find_first_not_of( chars );
1497 out->erase( 0, pos );
1498@@ -101,52 +109,28 @@
1499 }
1500
1501 template<class InputStringType,class OutputStringType>
1502-void trim_start( InputStringType const &in, char const *chars,
1503- OutputStringType *out ) {
1504+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1505+ && ZORBA_IS_STRING(OutputStringType),
1506+ void>::type
1507+trim_start( InputStringType const &in, char const *chars,
1508+ OutputStringType *out ) {
1509 *out = in;
1510 typename OutputStringType::size_type pos = out->find_first_not_of( chars );
1511 out->erase( 0, pos );
1512 }
1513
1514 template<class InputStringType,class OutputStringType>
1515-void trim_end( InputStringType const &in, char const *chars,
1516- OutputStringType *out ) {
1517+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
1518+ && ZORBA_IS_STRING(OutputStringType),
1519+ void>::type
1520+trim_end( InputStringType const &in, char const *chars,
1521+ OutputStringType *out ) {
1522 *out = in;
1523 typename OutputStringType::size_type pos = out->find_last_not_of( chars );
1524 if ( pos != OutputStringType::npos && ++pos < out->size() )
1525 out->erase( pos );
1526 }
1527
1528-template<class InputStringType,class OutputStringType>
1529-void uri_decode( InputStringType const &in, OutputStringType *out ) {
1530- extern signed char const hex2dec[];
1531-
1532- typedef typename InputStringType::const_iterator const_iterator;
1533- const_iterator i( in.begin() );
1534- const_iterator const j( in.end() );
1535-
1536- out->reserve( out->size() + in.size() );
1537- for ( ; i != j; ++i ) {
1538- char c = *i;
1539- if ( c == '%' ) {
1540- const_iterator k = i;
1541- do {
1542- if ( ++k == j )
1543- break;
1544- signed char const c1 = hex2dec[ static_cast<unsigned>( *k ) & 0xFF ];
1545- if ( c1 == -1 || ++k == j )
1546- break;
1547- signed char const c2 = hex2dec[ static_cast<unsigned>( *k ) & 0xFF ];
1548- if ( c2 == -1 )
1549- break;
1550- c = static_cast<char>( (c1 << 4) | c2 );
1551- i = k;
1552- } while ( false );
1553- }
1554- out->push_back( c );
1555- }
1556-}
1557-
1558 ///////////////////////////////////////////////////////////////////////////////
1559
1560 } // namespace ascii
1561
1562=== modified file 'src/util/base64_util.h'
1563--- src/util/base64_util.h 2013-04-16 22:12:03 +0000
1564+++ src/util/base64_util.h 2013-05-09 00:49:28 +0000
1565@@ -18,11 +18,14 @@
1566 #ifndef ZORBA_BASE64_UTIL_H
1567 #define ZORBA_BASE64_UTIL_H
1568
1569+// standard
1570 #include <iostream>
1571 #include <stdexcept>
1572 #include <sys/types.h> /* for size_t */
1573 #include <vector>
1574
1575+// Zorba
1576+#include <zorba/internal/ztd.h>
1577 #include "cxx_util.h"
1578 #include "stream_util.h"
1579
1580@@ -132,8 +135,9 @@
1581 * invalid byte is encountered.
1582 */
1583 template<class ToStringType>
1584-size_type decode( char const *from, size_type from_len, ToStringType *to,
1585- int options = dopt_none ) {
1586+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1587+decode( char const *from, size_type from_len, ToStringType *to,
1588+ int options = dopt_none ) {
1589 size_type decoded = 0;
1590 if ( from_len ) {
1591 typename ToStringType::size_type const orig_size = to->size();
1592@@ -175,8 +179,8 @@
1593 * invalid byte is encountered.
1594 */
1595 template<class ToStringType>
1596-size_type decode( std::istream &from, ToStringType *to,
1597- int options = dopt_none ) {
1598+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1599+decode( std::istream &from, ToStringType *to, int options = dopt_none ) {
1600 bool const ignore_ws = !!(options & dopt_ignore_ws);
1601 size_type total_decoded = 0;
1602 while ( !from.eof() ) {
1603@@ -279,7 +283,8 @@
1604 * @return Returns the number of encoded bytes.
1605 */
1606 template<class ToStringType>
1607-size_type encode( char const *from, size_type from_len, ToStringType *to ) {
1608+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1609+encode( char const *from, size_type from_len, ToStringType *to ) {
1610 size_type encoded = 0;
1611 if ( from_len ) {
1612 typename ToStringType::size_type const orig_size = to->size();
1613@@ -307,7 +312,8 @@
1614 * @return Returns the number of encoded bytes.
1615 */
1616 template<class ToStringType>
1617-size_type encode( std::istream &from, ToStringType *to ) {
1618+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1619+encode( std::istream &from, ToStringType *to ) {
1620 size_type total_encoded = 0;
1621 while ( !from.eof() ) {
1622 char from_buf[ 1024 * 3 ], to_buf[ 1024 * 4 ];
1623
1624=== modified file 'src/util/error_util.h'
1625--- src/util/error_util.h 2013-02-07 17:24:36 +0000
1626+++ src/util/error_util.h 2013-05-09 00:49:28 +0000
1627@@ -151,10 +151,7 @@
1628 * @return Returns said error string.
1629 */
1630 template<class StringType> inline
1631-typename std::enable_if<
1632- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
1633- std::string
1634->::type
1635+typename std::enable_if<ZORBA_HAS_C_STR(StringType),std::string>::type
1636 get_err_string( StringType const &function, code_type code = get_err_code() ) {
1637 return get_err_string( function.c_str(), code );
1638 }
1639
1640=== modified file 'src/util/fs_util.h'
1641--- src/util/fs_util.h 2013-03-06 01:45:25 +0000
1642+++ src/util/fs_util.h 2013-05-09 00:49:28 +0000
1643@@ -123,9 +123,7 @@
1644 * @param path The full path of the directory to change to.
1645 */
1646 template<class PathStringType> inline
1647-typename std::enable_if<ztd::has_c_str<PathStringType,
1648- char const* (PathStringType::*)() const>::value,
1649- void>::type
1650+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),void>::type
1651 chdir( PathStringType const &path ) {
1652 chdir( path.c_str() );
1653 }
1654@@ -158,9 +156,7 @@
1655 * @throws fs::exception if the creation fails.
1656 */
1657 template<class PathStringType> inline
1658-typename std::enable_if<ztd::has_c_str<PathStringType,
1659- char const* (PathStringType::*)() const>::value,
1660- void>::type
1661+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),void>::type
1662 mkdir( PathStringType const &path ) {
1663 mkdir( path.c_str() );
1664 }
1665@@ -191,10 +187,8 @@
1666 */
1667 template<class PathStringType>
1668 iterator( PathStringType const &path,
1669- typename std::enable_if<
1670- ztd::has_c_str<PathStringType,
1671- char const* (PathStringType::*)() const>::value
1672- >::type* = 0 ) : dir_path_( path.c_str() ) {
1673+ typename std::enable_if<ZORBA_HAS_C_STR(PathStringType)
1674+ >::type* = 0 ) : dir_path_( path.c_str() ) {
1675 ctor_impl();
1676 }
1677
1678@@ -292,9 +286,7 @@
1679 * @throws fs::exception if the creation failed.
1680 */
1681 template<class PathStringType> inline
1682-typename std::enable_if<ztd::has_c_str<PathStringType,
1683- char const* (PathStringType::*)() const>::value,
1684- void>::type
1685+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),void>::type
1686 create( PathStringType const &path ) {
1687 create( path.c_str() );
1688 }
1689@@ -321,9 +313,7 @@
1690 * @return Returns \c true only if the file or directory was removed.
1691 */
1692 template<class PathStringType> inline
1693-typename std::enable_if<ztd::has_c_str<PathStringType,
1694- char const* (PathStringType::*)() const>::value,
1695- bool>::type
1696+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),bool>::type
1697 remove( PathStringType const &path ) {
1698 return remove( path.c_str() );
1699 }
1700@@ -510,9 +500,7 @@
1701 * then returns \a path.
1702 */
1703 template<class PathStringType> inline
1704-typename std::enable_if<ztd::has_c_str<PathStringType,
1705- char const* (PathStringType::*)() const>::value,
1706- char const*>::type
1707+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),char const*>::type
1708 base_name( PathStringType const &path ) {
1709 return base_name( path.c_str() );
1710 }
1711@@ -546,9 +534,7 @@
1712 * \a path does not refer to a symbolic link, returns the type of \a path.
1713 */
1714 template<class PathStringType> inline
1715-typename std::enable_if<ztd::has_c_str<PathStringType,
1716- char const* (PathStringType::*)() const>::value,
1717- type>::type
1718+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),type>::type
1719 get_type( PathStringType const &path, bool follow_symlink = true,
1720 size_type *size = nullptr ) {
1721 return get_type( path.c_str(), follow_symlink, size );
1722@@ -580,9 +566,7 @@
1723 * @return Returns \c true only if the path is absolute.
1724 */
1725 template<class PathStringType> inline
1726-typename std::enable_if<ztd::has_c_str<PathStringType,
1727- char const* (PathStringType::*)() const>::value,
1728- bool>::type
1729+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),bool>::type
1730 is_absolute( PathStringType const &path ) {
1731 return is_absolute( path.c_str() );
1732 }
1733@@ -609,9 +593,7 @@
1734 * @throws fs::exception if the rename fails.
1735 */
1736 template<class FromStringType> inline
1737-typename std::enable_if<ztd::has_c_str<FromStringType,
1738- char const* (FromStringType::*)() const>::value,
1739- void>::type
1740+typename std::enable_if<ZORBA_HAS_C_STR(FromStringType),void>::type
1741 rename( FromStringType const &from, char const *to ) {
1742 rename( from.c_str(), to );
1743 }
1744@@ -625,9 +607,7 @@
1745 * @throws fs::exception if the rename fails.
1746 */
1747 template<class ToStringType> inline
1748-typename std::enable_if<ztd::has_c_str<ToStringType,
1749- char const* (ToStringType::*)() const>::value,
1750- void>::type
1751+typename std::enable_if<ZORBA_HAS_C_STR(ToStringType),void>::type
1752 rename( char const *from, ToStringType const &to ) {
1753 rename( from, to.c_str() );
1754 }
1755@@ -642,10 +622,8 @@
1756 * @throws fs::exception if the rename fails.
1757 */
1758 template<class FromStringType,class ToStringType> inline
1759-typename std::enable_if<ztd::has_c_str<FromStringType,
1760- char const* (FromStringType::*)() const>::value
1761- && ztd::has_c_str<ToStringType,
1762- char const* (ToStringType::*)() const>::value,
1763+typename std::enable_if<ZORBA_HAS_C_STR(FromStringType)
1764+ && ZORBA_HAS_C_STR(ToStringType),
1765 void>::type
1766 rename( FromStringType const &from, ToStringType const &to ) {
1767 rename( from.c_str(), to.c_str() );
1768@@ -675,9 +653,7 @@
1769 * @throws XQueryException err::XPTY0004 for malformed paths.
1770 */
1771 template<class PathStringType> inline
1772-typename std::enable_if<ztd::has_c_str<PathStringType,
1773- char const* (PathStringType::*)() const>::value,
1774- zstring>::type
1775+typename std::enable_if<ZORBA_HAS_C_STR(PathStringType),zstring>::type
1776 get_normalized_path( PathStringType const &path,
1777 PathStringType const &base = "" ) {
1778 return get_normalized_path( path.c_str(), base.c_str() );
1779@@ -693,9 +669,7 @@
1780 * @throws XQueryException err::XPTY0004 for malformed paths.
1781 */
1782 template<class PathStringType> inline
1783-typename std::enable_if<ztd::has_c_str<PathStringType,
1784- char const* (PathStringType::*)() const>::value,
1785- void>::type
1786+typename std::enable_if<ZORBA_IS_STRING(PathStringType),void>::type
1787 normalize_path( PathStringType &path, PathStringType const &base = "" ) {
1788 path = get_normalized_path( path, base );
1789 }
1790@@ -711,9 +685,7 @@
1791 * @param path2 The path to append.
1792 */
1793 template<class PathStringType1> inline
1794-typename std::enable_if<ztd::has_c_str<PathStringType1,
1795- char const* (PathStringType1::*)() const>::value,
1796- void>::type
1797+typename std::enable_if<ZORBA_IS_STRING(PathStringType1),void>::type
1798 append( PathStringType1 &path1, char const *path2 ) {
1799 if ( !ascii::ends_with( path1, dir_separator ) )
1800 path1 += dir_separator;
1801@@ -729,10 +701,8 @@
1802 * @param path2 The path to append.
1803 */
1804 template<class PathStringType1,class PathStringType2> inline
1805-typename std::enable_if<ztd::has_c_str<PathStringType1,
1806- char const* (PathStringType1::*)() const>::value
1807- && ztd::has_c_str<PathStringType2,
1808- char const* (PathStringType2::*)() const>::value,
1809+typename std::enable_if<ZORBA_IS_STRING(PathStringType1)
1810+ && ZORBA_HAS_C_STR(PathStringType2),
1811 void>::type
1812 append( PathStringType1 &path1, PathStringType2 const &path2 ) {
1813 append( path1, path2.c_str() );
1814@@ -745,9 +715,7 @@
1815 * @param path The path to make absolute.
1816 */
1817 template<class PathStringType> inline
1818-typename std::enable_if<ztd::has_c_str<PathStringType,
1819- char const* (PathStringType::*)() const>::value,
1820- void>::type
1821+typename std::enable_if<ZORBA_IS_STRING(PathStringType),void>::type
1822 make_absolute( PathStringType &path ) {
1823 if ( !is_absolute( path ) ) {
1824 #ifndef WIN32
1825@@ -783,9 +751,7 @@
1826 * @throws fs::exception if the operation fails.
1827 */
1828 template<class PathStringType> inline
1829-typename std::enable_if<ztd::has_c_str<PathStringType,
1830- char const* (PathStringType::*)() const>::value,
1831- void>::type
1832+typename std::enable_if<ZORBA_IS_STRING(PathStringType),void>::type
1833 get_temp_file( PathStringType *path ) {
1834 char path_buf[ MAX_PATH ];
1835 get_temp_file( path_buf );
1836
1837=== modified file 'src/util/hexbinary_util.cpp'
1838--- src/util/hexbinary_util.cpp 2013-04-16 22:12:03 +0000
1839+++ src/util/hexbinary_util.cpp 2013-05-09 00:49:28 +0000
1840@@ -75,7 +75,7 @@
1841 int options ) {
1842 bool const ignore_ws = !!(options & dopt_ignore_ws);
1843 if ( ignore_ws )
1844- from = ascii::trim_whitespace( from, &from_len );
1845+ from = ascii::trim_space( from, &from_len );
1846 if ( from_len % 2 )
1847 throw invalid_argument( "HexBinary length is not a multiple of 2" );
1848
1849@@ -107,7 +107,7 @@
1850 std::vector<char> *to, int options ) {
1851 bool const ignore_ws = !!(options & dopt_ignore_ws);
1852 if ( ignore_ws )
1853- from = ascii::trim_whitespace( from, &from_len );
1854+ from = ascii::trim_space( from, &from_len );
1855 if ( from_len % 2 )
1856 throw invalid_argument( "HexBinary length is not a multiple of 2" );
1857 size_type decoded = 0;
1858
1859=== modified file 'src/util/hexbinary_util.h'
1860--- src/util/hexbinary_util.h 2013-04-16 22:12:03 +0000
1861+++ src/util/hexbinary_util.h 2013-05-09 00:49:28 +0000
1862@@ -128,8 +128,9 @@
1863 * @throws hexbinary::exception if an invalid byte is encountered.
1864 */
1865 template<class ToStringType>
1866-size_type decode( char const *from, size_type from_len, ToStringType *to,
1867- int options = dopt_none ) {
1868+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1869+decode( char const *from, size_type from_len, ToStringType *to,
1870+ int options = dopt_none ) {
1871 size_type decoded = 0;
1872 if ( from_len ) {
1873 typename ToStringType::size_type const orig_size = to->size();
1874@@ -168,7 +169,8 @@
1875 * @throws hexbinary::exception if an invalid byte is encountered.
1876 */
1877 template<class ToStringType>
1878-size_type decode( std::istream &from, ToStringType *to,
1879+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1880+decode( std::istream &from, ToStringType *to,
1881 int options = dopt_none ) {
1882 bool const ignore_ws = !!(options & dopt_ignore_ws);
1883 size_type total_decoded = 0;
1884@@ -269,7 +271,8 @@
1885 * @return Returns the number of encoded bytes.
1886 */
1887 template<class ToStringType>
1888-size_type encode( char const *from, size_type from_len, ToStringType *to ) {
1889+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1890+encode( char const *from, size_type from_len, ToStringType *to ) {
1891 size_type encoded = 0;
1892 if ( from_len ) {
1893 typename ToStringType::size_type const orig_size = to->size();
1894@@ -296,7 +299,8 @@
1895 * @return Returns the number of encoded bytes.
1896 */
1897 template<class ToStringType>
1898-size_type encode( std::istream &from, ToStringType *to ) {
1899+typename std::enable_if<ZORBA_IS_STRING(ToStringType),size_type>::type
1900+encode( std::istream &from, ToStringType *to ) {
1901 size_type total_encoded = 0;
1902 while ( !from.eof() ) {
1903 char from_buf[ 1024 * 2 ], to_buf[ 1024 ];
1904
1905=== modified file 'src/util/icu_streambuf.cpp'
1906--- src/util/icu_streambuf.cpp 2013-04-16 22:12:03 +0000
1907+++ src/util/icu_streambuf.cpp 2013-05-09 00:49:28 +0000
1908@@ -110,7 +110,7 @@
1909 // "ASCII", so check for "US-ASCII" ourselves.
1910 //
1911 zstring charset( cc_charset );
1912- ascii::trim_whitespace( charset );
1913+ ascii::trim_space( charset );
1914 ascii::to_upper( charset );
1915 if ( charset == "US-ASCII" )
1916 cc_charset += 3; // skip "US-"
1917
1918=== modified file 'src/util/json_util.h'
1919--- src/util/json_util.h 2012-07-25 23:20:47 +0000
1920+++ src/util/json_util.h 2013-05-09 00:49:28 +0000
1921@@ -52,9 +52,7 @@
1922 * @return Returns \a os.
1923 */
1924 template<class StringType> inline
1925-typename std::enable_if<ztd::has_c_str<StringType,
1926- char const* (StringType::*)() const>::value,
1927- std::ostream&>::type
1928+typename std::enable_if<ZORBA_HAS_C_STR(StringType),std::ostream&>::type
1929 serialize( std::ostream &os, StringType const &s ) {
1930 return serialize( os, s.c_str() );
1931 }
1932
1933=== modified file 'src/util/passthru_streambuf.cpp'
1934--- src/util/passthru_streambuf.cpp 2013-04-12 04:34:41 +0000
1935+++ src/util/passthru_streambuf.cpp 2013-05-09 00:49:28 +0000
1936@@ -44,7 +44,7 @@
1937 if ( !*cc_charset )
1938 throw invalid_argument( "empty charset" );
1939 zstring charset( cc_charset );
1940- ascii::trim_whitespace( charset );
1941+ ascii::trim_space( charset );
1942 ascii::to_upper( charset );
1943 return charset != "ASCII"
1944 && charset != "US-ASCII"
1945
1946=== modified file 'src/util/stl_util.h'
1947--- src/util/stl_util.h 2013-05-08 20:14:47 +0000
1948+++ src/util/stl_util.h 2013-05-09 00:49:28 +0000
1949@@ -80,7 +80,7 @@
1950 }
1951
1952 protected:
1953- back_insert_iterator_base( ContainerType &c ) : container( &c ) {
1954+ back_insert_iterator_base( ContainerType *c ) : container( c ) {
1955 }
1956
1957 /**
1958
1959=== modified file 'src/util/stream_util.cpp'
1960--- src/util/stream_util.cpp 2013-04-16 22:12:03 +0000
1961+++ src/util/stream_util.cpp 2013-05-09 00:49:28 +0000
1962@@ -62,7 +62,7 @@
1963 while ( buf < buf_end ) {
1964 is.read( buf, n );
1965 if ( streamsize read = is.gcount() ) {
1966- read = ascii::remove_whitespace(
1967+ read = ascii::remove_space(
1968 buf, static_cast<ascii::size_type>( read )
1969 );
1970 buf += read, n -= read;
1971
1972=== modified file 'src/util/string_util.cpp'
1973--- src/util/string_util.cpp 2013-04-16 03:48:46 +0000
1974+++ src/util/string_util.cpp 2013-05-09 00:49:28 +0000
1975@@ -131,7 +131,7 @@
1976 //
1977 // We have to check for '-' ourselves since strtoull(3) allows it (oddly).
1978 //
1979- buf = ascii::trim_start_whitespace( buf );
1980+ buf = ascii::trim_start_space( buf );
1981 bool const minus = *buf == '-';
1982
1983 unsigned long long const result = std::strtoull( buf, (char**)last, 10 );
1984@@ -153,7 +153,7 @@
1985 long long atoll( char const *buf, char const *end, char const **last ) {
1986 aton_context const ctx( last );
1987 long long n = 0;
1988- char const *s0 = ascii::trim_start_whitespace( buf, end - buf );
1989+ char const *s0 = ascii::trim_start_space( buf, end - buf );
1990 char const *s = s0;
1991
1992 if ( s < end ) {
1993@@ -190,7 +190,7 @@
1994 char const **last ) {
1995 aton_context const ctx( last );
1996 unsigned long long n = 0;
1997- char const *s0 = ascii::trim_start_whitespace( buf, end - buf );
1998+ char const *s0 = ascii::trim_start_space( buf, end - buf );
1999 char const *s = s0;
2000
2001 if ( s < end ) {
2002
2003=== modified file 'src/util/string_util.h'
2004--- src/util/string_util.h 2013-04-16 02:30:37 +0000
2005+++ src/util/string_util.h 2013-05-09 00:49:28 +0000
2006@@ -171,8 +171,9 @@
2007 * @return Returns \c true only if \a s1 \c == \a s2.
2008 */
2009 template<class StringType> inline
2010-bool equals( StringType const &s1, char const *s2,
2011- typename StringType::size_type s2_n ) {
2012+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2013+equals( StringType const &s1, char const *s2,
2014+ typename StringType::size_type s2_n ) {
2015 typedef typename StringType::traits_type traits_type;
2016 return s1.size() == s2_n && traits_type::compare( s1.data(), s2, s2_n ) == 0;
2017 }
2018@@ -186,8 +187,9 @@
2019 * @return Returns \c true only if \a s1 \c == \a s2.
2020 */
2021 template<class StringType> inline
2022-bool equals( char const *s1, typename StringType::size_type s1_n,
2023- StringType const &s2 ) {
2024+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2025+equals( char const *s1, typename StringType::size_type s1_n,
2026+ StringType const &s2 ) {
2027 typedef typename StringType::traits_type traits_type;
2028 return s1_n == s2.size() && traits_type::compare( s1, s2.data(), s1_n ) == 0;
2029 }
2030@@ -215,8 +217,11 @@
2031 * present in \a in).
2032 */
2033 template<class OutputStringType1,class OutputStringType2>
2034-bool split( char const *in, char delim, OutputStringType1 *out1,
2035- OutputStringType2 *out2 ) {
2036+typename std::enable_if<ZORBA_IS_STRING(OutputStringType1)
2037+ && ZORBA_IS_STRING(OutputStringType2),
2038+ bool>::type
2039+split( char const *in, char delim, OutputStringType1 *out1,
2040+ OutputStringType2 *out2 ) {
2041 if ( char const *const pos = std::strchr( in, delim ) ) {
2042 if ( out1 )
2043 *out1 = OutputStringType1( in, pos - in );
2044@@ -229,13 +234,15 @@
2045
2046 // Allows out1 to be nullptr.
2047 template<class OutputStringType2> inline
2048-bool split( char const *in, char delim, void*, OutputStringType2 *out2 ) {
2049+typename std::enable_if<ZORBA_IS_STRING(OutputStringType2),bool>::type
2050+split( char const *in, char delim, void*, OutputStringType2 *out2 ) {
2051 return split( in, delim, static_cast<OutputStringType2*>( nullptr ), out2 );
2052 }
2053
2054 // Allows out2 to be nullptr.
2055 template<class OutputStringType1> inline
2056-bool split( char const *in, char delim, OutputStringType1 *out1, void* ) {
2057+typename std::enable_if<ZORBA_IS_STRING(OutputStringType1),bool>::type
2058+split( char const *in, char delim, OutputStringType1 *out1, void* ) {
2059 return split( in, delim, out1, static_cast<OutputStringType1*>( nullptr ) );
2060 }
2061
2062@@ -255,22 +262,31 @@
2063 * present in \a in).
2064 */
2065 template<class InputStringType,class OutputStringType1,class OutputStringType2>
2066-inline bool split( InputStringType const &in, char delim,
2067+inline
2068+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2069+ && ZORBA_IS_STRING(OutputStringType1)
2070+ && ZORBA_IS_STRING(OutputStringType2),
2071+ bool>::type
2072+split( InputStringType const &in, char delim,
2073 OutputStringType1 *out1, OutputStringType2 *out2 ) {
2074 return split( in.c_str(), delim, out1, out2 );
2075 }
2076
2077 // Allows out1 to be nullptr.
2078 template<class InputStringType,class OutputStringType2> inline
2079-bool split( InputStringType const &in, char delim, void*,
2080- OutputStringType2 *out2 ) {
2081+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2082+ && ZORBA_IS_STRING(OutputStringType2),
2083+ bool>::type
2084+split( InputStringType const &in, char delim, void*, OutputStringType2 *out2 ) {
2085 return split( in, delim, static_cast<OutputStringType2*>( nullptr ), out2 );
2086 }
2087
2088 // Allows out2 to be nullptr.
2089 template<class InputStringType,class OutputStringType1> inline
2090-bool split( InputStringType const &in, char delim, OutputStringType1 *out1,
2091- void* ) {
2092+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2093+ && ZORBA_IS_STRING(OutputStringType1),
2094+ bool>::type
2095+split( InputStringType const &in, char delim, OutputStringType1 *out1, void* ) {
2096 return split( in, delim, out1, static_cast<OutputStringType1*>( nullptr ) );
2097 }
2098
2099@@ -289,8 +305,11 @@
2100 * present in \a in).
2101 */
2102 template<class OutputStringType1,class OutputStringType2>
2103-bool split( char const *in, char const *delim, OutputStringType1 *out1,
2104- OutputStringType2 *out2 ) {
2105+typename std::enable_if<ZORBA_IS_STRING(OutputStringType1)
2106+ && ZORBA_IS_STRING(OutputStringType2),
2107+ bool>::type
2108+split( char const *in, char const *delim, OutputStringType1 *out1,
2109+ OutputStringType2 *out2 ) {
2110 if ( *delim )
2111 if ( char const *const pos = std::strstr( in, delim ) ) {
2112 if ( out1 )
2113@@ -304,15 +323,15 @@
2114
2115 // Allows out1 to be nullptr.
2116 template<class OutputStringType2> inline
2117-bool split( char const *in, char const *delim, void*,
2118- OutputStringType2 *out2 ) {
2119+typename std::enable_if<ZORBA_IS_STRING(OutputStringType2),bool>::type
2120+split( char const *in, char const *delim, void*, OutputStringType2 *out2 ) {
2121 return split( in, delim, static_cast<OutputStringType2*>( nullptr ), out2 );
2122 }
2123
2124 // Allows out2 to be nullptr.
2125 template<class OutputStringType1> inline
2126-bool split( char const *in, char const *delim, OutputStringType1 *out1,
2127- void* ) {
2128+typename std::enable_if<ZORBA_IS_STRING(OutputStringType1),bool>::type
2129+split( char const *in, char const *delim, OutputStringType1 *out1, void* ) {
2130 return split( in, delim, out1, static_cast<OutputStringType1*>( nullptr ) );
2131 }
2132
2133@@ -332,22 +351,33 @@
2134 * present in \a in).
2135 */
2136 template<class InputStringType,class OutputStringType1,class OutputStringType2>
2137-inline bool split( InputStringType const &in, char const *delim,
2138- OutputStringType1 *out1, OutputStringType2 *out2 ) {
2139+inline
2140+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2141+ && ZORBA_IS_STRING(OutputStringType1)
2142+ && ZORBA_IS_STRING(OutputStringType2),
2143+ bool>::type
2144+split( InputStringType const &in, char const *delim, OutputStringType1 *out1,
2145+ OutputStringType2 *out2 ) {
2146 return split( in.c_str(), delim, out1, out2 );
2147 }
2148
2149 // Allows out1 to be nullptr.
2150 template<class InputStringType,class OutputStringType2> inline
2151-bool split( InputStringType const &in, char const *delim, void*,
2152+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2153+ && ZORBA_IS_STRING(OutputStringType2),
2154+ bool>::type
2155+split( InputStringType const &in, char const *delim, void*,
2156 OutputStringType2 *out2 ) {
2157 return split( in, delim, static_cast<OutputStringType2*>( nullptr ), out2 );
2158 }
2159
2160 // Allows out2 to be nullptr.
2161 template<class InputStringType,class OutputStringType1> inline
2162-bool split( InputStringType const &in, char const *delim,
2163- OutputStringType1 *out1, void* ) {
2164+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2165+ && ZORBA_IS_STRING(OutputStringType1),
2166+ bool>::type
2167+split( InputStringType const &in, char const *delim, OutputStringType1 *out1,
2168+ void* ) {
2169 return split( in, delim, out1, static_cast<OutputStringType1*>( nullptr ) );
2170 }
2171
2172@@ -373,8 +403,13 @@
2173 class OutputStringType1,
2174 class OutputStringType2
2175 >
2176-bool split( InputStringType const &in, DelimStringType const &delim,
2177- OutputStringType1 *out1, OutputStringType2 *out2 ) {
2178+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2179+ && ZORBA_IS_STRING(DelimStringType)
2180+ && ZORBA_IS_STRING(OutputStringType1)
2181+ && ZORBA_IS_STRING(OutputStringType2),
2182+ bool>::type
2183+split( InputStringType const &in, DelimStringType const &delim,
2184+ OutputStringType1 *out1, OutputStringType2 *out2 ) {
2185 typename InputStringType::size_type const pos = in.find( delim );
2186 if ( pos != InputStringType::npos ) {
2187 if ( out1 )
2188@@ -387,24 +422,26 @@
2189 }
2190
2191 // Allows out1 to be nullptr.
2192-template<
2193- class InputStringType,
2194- class DelimStringType,
2195- class OutputStringType2
2196->
2197-inline bool split( InputStringType const &in, DelimStringType const &delim,
2198- void*, OutputStringType2 *out2 ) {
2199+template<class InputStringType,class DelimStringType,class OutputStringType2>
2200+inline
2201+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2202+ && ZORBA_IS_STRING(DelimStringType)
2203+ && ZORBA_IS_STRING(OutputStringType2),
2204+ bool>::type
2205+split( InputStringType const &in, DelimStringType const &delim, void*,
2206+ OutputStringType2 *out2 ) {
2207 return split( in, delim, static_cast<OutputStringType2*>( nullptr ), out2 );
2208 }
2209
2210 // Allows out2 to be nullptr.
2211-template<
2212- class InputStringType,
2213- class DelimStringType,
2214- class OutputStringType1
2215->
2216-inline bool split( InputStringType const &in, DelimStringType const &delim,
2217- OutputStringType1 *out1, void* ) {
2218+template<class InputStringType,class DelimStringType,class OutputStringType1>
2219+inline
2220+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2221+ && ZORBA_IS_STRING(DelimStringType)
2222+ && ZORBA_IS_STRING(OutputStringType1),
2223+ bool>::type
2224+split( InputStringType const &in, DelimStringType const &delim,
2225+ OutputStringType1 *out1, void* ) {
2226 return split( in, delim, out1, static_cast<OutputStringType1*>( nullptr ) );
2227 }
2228
2229@@ -846,7 +883,8 @@
2230 template<typename T,class OutputStringType> inline
2231 typename std::enable_if<!ZORBA_TR1_NS::is_pointer<T>::value
2232 && !ZORBA_TR1_NS::is_integral<T>::value
2233- && has_insertion_operator<T>::value,
2234+ && has_insertion_operator<T>::value
2235+ && ZORBA_IS_STRING(OutputStringType),
2236 void>::type
2237 to_string( T const &t, OutputStringType *out ) {
2238 std::ostringstream o;
2239@@ -863,7 +901,9 @@
2240 * @param out The output string.
2241 */
2242 template<typename T,class OutputStringType> inline
2243-typename std::enable_if<ZORBA_TR1_NS::is_integral<T>::value,void>::type
2244+typename std::enable_if<ZORBA_TR1_NS::is_integral<T>::value
2245+ && ZORBA_IS_STRING(OutputStringType),
2246+ void>::type
2247 to_string( T t, OutputStringType *out ) {
2248 ascii::itoa_buf_type buf;
2249 *out = ascii::itoa( t, buf );
2250@@ -882,7 +922,8 @@
2251 */
2252 template<class T,class OutputStringType> inline
2253 typename std::enable_if<!has_insertion_operator<T>::value
2254- && has_c_str<T,char const* (T::*)() const>::value,
2255+ && ZORBA_HAS_C_STR(T)
2256+ && ZORBA_IS_STRING(OutputStringType),
2257 void>::type
2258 to_string( T const &t, OutputStringType *out ) {
2259 *out = t.c_str();
2260@@ -903,9 +944,10 @@
2261 */
2262 template<class T,class OutputStringType> inline
2263 typename std::enable_if<!has_insertion_operator<T>::value
2264- && !has_c_str<T,char const* (T::*)() const>::value
2265+ && !ZORBA_HAS_C_STR(T)
2266 && has_str<T,std::string (T::*)() const>::value
2267- && !has_toString<T,std::string (T::*)() const>::value,
2268+ && !has_toString<T,std::string (T::*)() const>::value
2269+ && ZORBA_IS_STRING(OutputStringType),
2270 void>::type
2271 to_string( T const &t, OutputStringType *out ) {
2272 *out = t.str();
2273@@ -926,9 +968,10 @@
2274 */
2275 template<class T,class OutputStringType> inline
2276 typename std::enable_if<!has_insertion_operator<T>::value
2277- && !has_c_str<T,char const* (T::*)() const>::value
2278+ && !ZORBA_HAS_C_STR(T)
2279 && !has_str<T,std::string (T::*)() const>::value
2280- && has_toString<T,std::string (T::*)() const>::value,
2281+ && has_toString<T,std::string (T::*)() const>::value
2282+ && ZORBA_IS_STRING(OutputStringType),
2283 void>::type
2284 to_string( T const &t, OutputStringType *out ) {
2285 *out = t.toString();
2286@@ -944,7 +987,9 @@
2287 * the result of \c to_string(*p); otherwise \c "<null>".
2288 */
2289 template<typename T,class OutputStringType> inline
2290-typename std::enable_if<ZORBA_TR1_NS::is_pointer<T>::value,void>::type
2291+typename std::enable_if<ZORBA_TR1_NS::is_pointer<T>::value
2292+ && ZORBA_IS_STRING(OutputStringType),
2293+ void>::type
2294 to_string( T p, OutputStringType *out ) {
2295 typedef typename ZORBA_TR1_NS::remove_pointer<T>::type const* T_const_ptr;
2296 if ( p )
2297@@ -961,7 +1006,8 @@
2298 * @param out The output string.
2299 */
2300 template<class OutputStringType> inline
2301-void to_string( char const *s, OutputStringType *out ) {
2302+typename std::enable_if<ZORBA_IS_STRING(OutputStringType),void>::type
2303+to_string( char const *s, OutputStringType *out ) {
2304 *out = s ? s : "<null>";
2305 }
2306
2307
2308=== modified file 'src/util/time_parse.cpp'
2309--- src/util/time_parse.cpp 2013-03-22 19:04:27 +0000
2310+++ src/util/time_parse.cpp 2013-05-09 00:49:28 +0000
2311@@ -93,7 +93,7 @@
2312 invalid_value_value::invalid_value_value( char const *buf, size_t len ) :
2313 value_( buf, min_len( buf, len ) )
2314 {
2315- ascii::trim_end_whitespace( value_ );
2316+ ascii::trim_end_space( value_ );
2317 }
2318
2319 template<typename ValueType>
2320@@ -308,7 +308,7 @@
2321 throw insufficient_buffer();
2322
2323 if ( ascii::is_space( c ) ) {
2324- bp = ascii::trim_start_whitespace( bp );
2325+ bp = ascii::trim_start_space( bp );
2326 continue;
2327 }
2328
2329@@ -441,7 +441,7 @@
2330 case 'n': // newline
2331 case 't': // tab
2332 CHECK_ALT(0);
2333- bp = ascii::trim_start_whitespace( bp );
2334+ bp = ascii::trim_start_space( bp );
2335 break;
2336
2337 case 'O': // "%O?" alternative conversion modifier
2338
2339=== modified file 'src/util/time_parse.h'
2340--- src/util/time_parse.h 2013-01-04 16:08:03 +0000
2341+++ src/util/time_parse.h 2013-05-09 00:49:28 +0000
2342@@ -406,10 +406,7 @@
2343 // Template version of parse().
2344 //
2345 template<class BufferType> inline
2346-typename std::enable_if<
2347- ztd::has_c_str<BufferType,char const* (BufferType::*)() const>::value,
2348- char const*
2349->::type
2350+typename std::enable_if<ZORBA_HAS_C_STR(BufferType),char const*>::type
2351 parse( BufferType const &buf, char const *fmt,
2352 locale::iso639_1::type lang, locale::iso3166_1::type country,
2353 ztm *tm, unsigned *set_fields = nullptr ) {
2354@@ -420,10 +417,7 @@
2355 // Template version of parse().
2356 //
2357 template<class FormatType> inline
2358-typename std::enable_if<
2359- ztd::has_c_str<FormatType,char const* (FormatType::*)() const>::value,
2360- char const*
2361->::type
2362+typename std::enable_if<ZORBA_HAS_C_STR(FormatType),char const*>::type
2363 parse( char const *buf, FormatType const &fmt,
2364 locale::iso639_1::type lang, locale::iso3166_1::type country,
2365 ztm *tm, unsigned *set_fields = nullptr ) {
2366@@ -434,11 +428,9 @@
2367 // Template version of parse().
2368 //
2369 template<class BufferType,class FormatType> inline
2370-typename std::enable_if<
2371- ztd::has_c_str<BufferType,char const* (BufferType::*)() const>::value &&
2372- ztd::has_c_str<FormatType,char const* (FormatType::*)() const>::value,
2373- char const*
2374->::type
2375+typename std::enable_if<ZORBA_HAS_C_STR(BufferType)
2376+ && ZORBA_HAS_C_STR(FormatType),
2377+ char const*>::type
2378 parse( BufferType const &buf, FormatType const &fmt,
2379 locale::iso639_1::type lang, locale::iso3166_1::type country,
2380 ztm *tm, unsigned *set_fields = nullptr ) {
2381
2382=== modified file 'src/util/time_util.h'
2383--- src/util/time_util.h 2013-05-04 18:47:13 +0000
2384+++ src/util/time_util.h 2013-05-09 00:49:28 +0000
2385@@ -164,10 +164,7 @@
2386 // Template version of find().
2387 //
2388 template<class StringType> inline
2389- typename std::enable_if<
2390- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
2391- type
2392- >::type
2393+ typename std::enable_if<ZORBA_HAS_C_STR(StringType),type>::type
2394 find( StringType const &calendar ) {
2395 return find( calendar.c_str() );
2396 }
2397
2398=== modified file 'src/util/unicode_util.h'
2399--- src/util/unicode_util.h 2013-04-22 23:57:31 +0000
2400+++ src/util/unicode_util.h 2013-05-09 00:49:28 +0000
2401@@ -397,8 +397,9 @@
2402 * @param out The Unicode string result.
2403 * @return Returns \c true only if the conversion succeeded.
2404 */
2405-template<class StringType>
2406-inline bool to_string( StringType const &in, string *out ) {
2407+template<class StringType> inline
2408+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2409+to_string( StringType const &in, string *out ) {
2410 return to_string( in.data(), static_cast<size_type>( in.size() ), out );
2411 }
2412
2413
2414=== modified file 'src/util/uri_util.h'
2415--- src/util/uri_util.h 2013-02-07 17:24:36 +0000
2416+++ src/util/uri_util.h 2013-05-09 00:49:28 +0000
2417@@ -70,7 +70,8 @@
2418 * or scheme::none (if none).
2419 */
2420 template<class StringType> inline
2421-scheme get_scheme( StringType const &uri, StringType *sname = nullptr ) {
2422+typename std::enable_if<ZORBA_IS_STRING(StringType),scheme>::type
2423+get_scheme( StringType const &uri, StringType *sname = nullptr ) {
2424 char const *colon;
2425 scheme const s = get_scheme( uri.c_str(), &colon );
2426 if ( sname && s )
2427@@ -109,7 +110,7 @@
2428 * @param s The string to append to.
2429 * @param encode_slash If \c true, encodes the '/' character also.
2430 */
2431- explicit back_insert_iterator( StringType &s, bool encode_slash = false )
2432+ explicit back_insert_iterator( StringType *s, bool encode_slash = false )
2433 : base_type( s ), encode_slash_( encode_slash )
2434 {
2435 buf_[0] = '%';
2436@@ -129,8 +130,10 @@
2437 * @param out The output string.
2438 * @param encode_slash If \c true, encodes the '/' character also.
2439 */
2440-template<class StringType> inline back_insert_iterator<StringType>
2441-back_inserter( StringType &out, bool encode_slash = false ) {
2442+template<class StringType> inline
2443+typename std::enable_if<ZORBA_IS_STRING(StringType),
2444+ back_insert_iterator<StringType> >::type
2445+back_inserter( StringType *out, bool encode_slash = false ) {
2446 return back_insert_iterator<StringType>( out, encode_slash );
2447 }
2448
2449@@ -144,7 +147,10 @@
2450 * contents are appended to.
2451 */
2452 template<class InputStringType,class OutputStringType>
2453-void decode( InputStringType const &in, OutputStringType *out );
2454+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2455+ && ZORBA_IS_STRING(OutputStringType),
2456+ void>::type
2457+decode( InputStringType const &in, OutputStringType *out );
2458
2459 /**
2460 * Percent-decodes (%xx) illegal URI characters.
2461@@ -153,7 +159,8 @@
2462 * @param s The string.
2463 */
2464 template<class StringType> inline
2465-void decode( StringType &s ) {
2466+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2467+decode( StringType &s ) {
2468 StringType temp;
2469 decode( s, &temp );
2470 s = temp;
2471@@ -170,9 +177,12 @@
2472 * @param encode_slash Encodes the slash character ("/") only if \c true.
2473 */
2474 template<class InputStringType,class OutputStringType> inline
2475-void encode( InputStringType const &in, OutputStringType *out,
2476- bool encode_slash = true ) {
2477- std::copy( in.begin(), in.end(), back_inserter( *out, encode_slash ) );
2478+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2479+ && ZORBA_IS_STRING(OutputStringType),
2480+ void>::type
2481+encode( InputStringType const &in, OutputStringType *out,
2482+ bool encode_slash = true ) {
2483+ std::copy( in.begin(), in.end(), back_inserter( out, encode_slash ) );
2484 }
2485
2486 /**
2487@@ -183,7 +193,8 @@
2488 * @param encode_slash Encodes the slash character ("/") only if \c true.
2489 */
2490 template<class StringType> inline
2491-void encode( StringType &s, bool encode_slash = true ) {
2492+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2493+encode( StringType &s, bool encode_slash = true ) {
2494 StringType temp;
2495 encode( s, &temp, encode_slash );
2496 s = temp;
2497@@ -204,7 +215,8 @@
2498 * local file is a created temporary file; \c false otherwise.
2499 */
2500 template<class PathStringType> inline
2501-void fetch( char const *uri, PathStringType *path, bool *is_temp = nullptr ) {
2502+typename std::enable_if<ZORBA_IS_STRING(PathStringType),void>::type
2503+fetch( char const *uri, PathStringType *path, bool *is_temp = nullptr ) {
2504 char path_buf[ MAX_PATH ];
2505 fetch_to_path_impl( uri, path_buf, is_temp );
2506 *path = path_buf;
2507@@ -221,8 +233,11 @@
2508 * local file is a created temporary file; \c false otherwise.
2509 */
2510 template<class URIStringType,class PathStringType> inline
2511-void fetch( URIStringType const &uri, PathStringType *file,
2512- bool *is_temp = nullptr ) {
2513+typename std::enable_if<ZORBA_HAS_C_STR(URIStringType)
2514+ && ZORBA_IS_STRING(PathStringType),
2515+ void>::type
2516+fetch( URIStringType const &uri, PathStringType *file,
2517+ bool *is_temp = nullptr ) {
2518 fetch( uri.c_str(), file, is_temp );
2519 }
2520
2521
2522=== modified file 'src/util/uri_util.tcc'
2523--- src/util/uri_util.tcc 2013-02-07 17:24:36 +0000
2524+++ src/util/uri_util.tcc 2013-05-09 00:49:28 +0000
2525@@ -43,7 +43,10 @@
2526 ///////////////////////////////////////////////////////////////////////////////
2527
2528 template<class InputStringType,class OutputStringType>
2529-void decode( InputStringType const &in, OutputStringType *out ) {
2530+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2531+ && ZORBA_IS_STRING(OutputStringType),
2532+ void>::type
2533+decode( InputStringType const &in, OutputStringType *out ) {
2534 extern signed char const hex2dec[];
2535
2536 typedef typename InputStringType::const_iterator const_iterator;
2537
2538=== modified file 'src/util/utf8_util.h'
2539--- src/util/utf8_util.h 2013-04-22 14:32:41 +0000
2540+++ src/util/utf8_util.h 2013-05-09 00:49:28 +0000
2541@@ -43,9 +43,9 @@
2542
2543 using ascii::begins_with;
2544 using ascii::ends_with;
2545-using ascii::is_whitespace;
2546-using ascii::normalize_whitespace;
2547-using ascii::trim_whitespace;
2548+using ascii::is_space;
2549+using ascii::normalize_space;
2550+using ascii::trim_space;
2551
2552 ////////// begins/ends_with ///////////////////////////////////////////////////
2553
2554@@ -59,7 +59,8 @@
2555 * @return Returns \c true only if \a s begins with \a c.
2556 */
2557 template<class StringType> inline
2558-bool begins_with( utf8_string<StringType> const &s, char c ) {
2559+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2560+begins_with( utf8_string<StringType> const &s, char c ) {
2561 return ascii::begins_with( *s.get(), c );
2562 }
2563
2564@@ -73,8 +74,9 @@
2565 * @return Returns \c true only if \a s begins with \a ps.
2566 */
2567 template<class StringType> inline
2568-bool begins_with( utf8_string<StringType> const &s, char const *ps,
2569- typename StringType::size_type n ) {
2570+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2571+begins_with( utf8_string<StringType> const &s, char const *ps,
2572+ typename StringType::size_type n ) {
2573 return ascii::begins_with( *s.get(), ps, n );
2574 }
2575
2576@@ -87,7 +89,8 @@
2577 * @return Returns \c true only if \a s begins with \a ps.
2578 */
2579 template<class StringType> inline
2580-bool begins_with( utf8_string<StringType> const &s, char const *ps ) {
2581+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2582+begins_with( utf8_string<StringType> const &s, char const *ps ) {
2583 return ascii::begins_with( *s.get(), ps );
2584 }
2585
2586@@ -101,8 +104,10 @@
2587 * @return Returns \c true only if \a s ends with \a ps.
2588 */
2589 template<class StringType,class PrefixStringType> inline
2590-bool begins_with( utf8_string<StringType> const &s,
2591- PrefixStringType const &ps ) {
2592+typename std::enable_if<ZORBA_IS_STRING(StringType)
2593+ && ZORBA_IS_STRING(PrefixStringType),
2594+ bool>::type
2595+begins_with( utf8_string<StringType> const &s, PrefixStringType const &ps ) {
2596 return ascii::begins_with( *s.get(), ps.data(), ps.size() );
2597 }
2598
2599@@ -116,8 +121,10 @@
2600 * @return Returns \c true only if \a s ends with \a ps.
2601 */
2602 template<class StringType,class PrefixStringType> inline
2603-bool begins_with( StringType const &s,
2604- utf8_string<PrefixStringType> const &ps ) {
2605+typename std::enable_if<ZORBA_IS_STRING(StringType)
2606+ && ZORBA_IS_STRING(PrefixStringType),
2607+ bool>::type
2608+begins_with( StringType const &s, utf8_string<PrefixStringType> const &ps ) {
2609 return ascii::begins_with( s, *ps.get() );
2610 }
2611
2612@@ -131,8 +138,11 @@
2613 * @return Returns \c true only if \a s ends with \a ps.
2614 */
2615 template<class StringType,class PrefixStringType> inline
2616-bool begins_with( utf8_string<StringType> const &s,
2617- utf8_string<PrefixStringType> const &ps ) {
2618+typename std::enable_if<ZORBA_IS_STRING(StringType)
2619+ && ZORBA_IS_STRING(PrefixStringType),
2620+ bool>::type
2621+begins_with( utf8_string<StringType> const &s,
2622+ utf8_string<PrefixStringType> const &ps ) {
2623 return ascii::begins_with( *s.get(), *ps.get() );
2624 }
2625
2626@@ -146,7 +156,8 @@
2627 * @return Returns \c true only if \a s ends with \a c.
2628 */
2629 template<class StringType> inline
2630-bool ends_with( utf8_string<StringType> const &s, char c ) {
2631+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2632+ends_with( utf8_string<StringType> const &s, char c ) {
2633 return ascii::ends_with( *s.get(), c );
2634 }
2635
2636@@ -160,8 +171,9 @@
2637 * @return Returns \c true only if \a s ends with \a ps.
2638 */
2639 template<class StringType> inline
2640-bool ends_with( utf8_string<StringType> const &s, char const *ps,
2641- typename StringType::size_type n ) {
2642+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2643+ends_with( utf8_string<StringType> const &s, char const *ps,
2644+ typename StringType::size_type n ) {
2645 return ascii::ends_with( *s.get(), ps, n );
2646 }
2647
2648@@ -174,7 +186,8 @@
2649 * @return Returns \c true only if \a s ends with \a ps.
2650 */
2651 template<class StringType> inline
2652-bool ends_with( utf8_string<StringType> const &s, char const *ps ) {
2653+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2654+ends_with( utf8_string<StringType> const &s, char const *ps ) {
2655 return ascii::ends_with( *s.get(), ps );
2656 }
2657
2658@@ -188,8 +201,10 @@
2659 * @return Returns \c true only if \a s ends with \a ps.
2660 */
2661 template<class StringType,class SuffixStringType> inline
2662-bool ends_with( utf8_string<StringType> const &s,
2663- SuffixStringType const &ps ) {
2664+typename std::enable_if<ZORBA_IS_STRING(StringType)
2665+ && ZORBA_IS_STRING(SuffixStringType),
2666+ bool>::type
2667+ends_with( utf8_string<StringType> const &s, SuffixStringType const &ps ) {
2668 return ascii::ends_with( *s.get(), ps.data(), ps.size() );
2669 }
2670
2671@@ -203,8 +218,10 @@
2672 * @return Returns \c true only if \a s ends with \a ps.
2673 */
2674 template<class StringType,class SuffixStringType> inline
2675-bool ends_with( StringType const &s,
2676- utf8_string<SuffixStringType> const &ps ) {
2677+typename std::enable_if<ZORBA_IS_STRING(StringType)
2678+ && ZORBA_IS_STRING(SuffixStringType),
2679+ bool>::type
2680+ends_with( StringType const &s, utf8_string<SuffixStringType> const &ps ) {
2681 return ascii::ends_with( s, *ps.get() );
2682 }
2683
2684@@ -218,8 +235,11 @@
2685 * @return Returns \c true only if \a s ends with \a ps.
2686 */
2687 template<class StringType,class SuffixStringType> inline
2688-bool ends_with( utf8_string<StringType> const &s,
2689- utf8_string<SuffixStringType> const &ps ) {
2690+typename std::enable_if<ZORBA_IS_STRING(StringType)
2691+ && ZORBA_IS_STRING(SuffixStringType),
2692+ bool>::type
2693+ends_with( utf8_string<StringType> const &s,
2694+ utf8_string<SuffixStringType> const &ps ) {
2695 return ascii::ends_with( *s.get(), *ps.get() );
2696 }
2697
2698@@ -235,7 +255,10 @@
2699 * contents are overwritten.
2700 */
2701 template<class InputStringType,class OutputStringType>
2702-void to_lower( InputStringType const &in, OutputStringType *out );
2703+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2704+ && ZORBA_IS_STRING(OutputStringType),
2705+ void>::type
2706+to_lower( InputStringType const &in, OutputStringType *out );
2707
2708 /**
2709 * Converts a string to lower-case.
2710@@ -244,7 +267,8 @@
2711 * @param s The string.
2712 */
2713 template<class StringType> inline
2714-void to_lower( StringType &s ) {
2715+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2716+to_lower( StringType &s ) {
2717 StringType temp;
2718 to_lower( s, &temp );
2719 s = temp;
2720@@ -260,7 +284,10 @@
2721 * contents are overwritten.
2722 */
2723 template<class InputStringType,class OutputStringType>
2724-void to_upper( InputStringType const &in, OutputStringType *out );
2725+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2726+ && ZORBA_IS_STRING(OutputStringType),
2727+ void>::type
2728+to_upper( InputStringType const &in, OutputStringType *out );
2729
2730 /**
2731 * Converts a string to upper-case.
2732@@ -269,7 +296,8 @@
2733 * @param s The string.
2734 */
2735 template<class StringType> inline
2736-void to_upper( StringType &s ) {
2737+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2738+to_upper( StringType &s ) {
2739 StringType temp;
2740 to_upper( s, &temp );
2741 s = temp;
2742@@ -286,7 +314,8 @@
2743 * @param s A pointer to the string to be appended to.
2744 */
2745 template<class InputIterator,class StringType> inline
2746-void append_codepoints( InputIterator i, InputIterator j, StringType *s ) {
2747+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2748+append_codepoints( InputIterator i, InputIterator j, StringType *s ) {
2749 typename utf8_stringify<StringType>::type u( *s );
2750 std::copy( i, j, std::back_inserter( u ) );
2751 }
2752@@ -301,7 +330,8 @@
2753 * container's contents are appended to.
2754 */
2755 template<class StringType,class ContainerType> inline
2756-void to_codepoints( StringType const &s, ContainerType *c ) {
2757+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2758+to_codepoints( StringType const &s, ContainerType *c ) {
2759 typename utf8_stringify<StringType const>::type const u( s );
2760 std::copy( u.begin(), u.end(), std::back_inserter( *c ) );
2761 }
2762@@ -391,8 +421,8 @@
2763 * @return Returns \c true only if the conversion succeeded.
2764 */
2765 template<class StringType>
2766-bool to_string( unicode::char_type const *in, size_type in_len,
2767- StringType *out );
2768+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2769+to_string( unicode::char_type const *in, size_type in_len, StringType *out );
2770
2771 /**
2772 * Converts a unicode::char_type array into a UTF-8 encoded string.
2773@@ -402,7 +432,8 @@
2774 * @return Returns \c true only if the conversion succeeded.
2775 */
2776 template<class StringType> inline
2777-bool to_string( unicode::char_type const *in, StringType *out ) {
2778+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2779+to_string( unicode::char_type const *in, StringType *out ) {
2780 return to_string( in, u_strlen( in ), out );
2781 }
2782
2783@@ -416,7 +447,8 @@
2784 * @return Returns \c true only if the conversion succeeded.
2785 */
2786 template<class StringType> inline
2787-bool to_string( unicode::string const &in, StringType *out ) {
2788+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2789+to_string( unicode::string const &in, StringType *out ) {
2790 #ifndef ZORBA_NO_ICU
2791 return to_string( in.getBuffer(), in.length(), out );
2792 #else
2793@@ -472,7 +504,8 @@
2794 * @return Returns \c true only if the conversion succeeded.
2795 */
2796 template<class StringType>
2797-bool to_string( wchar_t const *in, size_type in_len, StringType *out );
2798+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2799+to_string( wchar_t const *in, size_type in_len, StringType *out );
2800
2801 /**
2802 * Converts a wide-character string into a UTF-8 encoded string.
2803@@ -483,7 +516,8 @@
2804 * @return Returns \c true only if the conversion succeeded.
2805 */
2806 template<class StringType> inline
2807-bool to_string( wchar_t const *in, StringType *out ) {
2808+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2809+to_string( wchar_t const *in, StringType *out ) {
2810 return to_string( in, std::wcslen( in ), out );
2811 }
2812
2813@@ -498,7 +532,8 @@
2814 * @return Returns \c true only if the conversion succeeded.
2815 */
2816 template<class StringType> inline
2817-bool to_string( std::wstring const &in, StringType *out ) {
2818+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2819+to_string( std::wstring const &in, StringType *out ) {
2820 return to_string( in.data(), in.size(), out );
2821 }
2822
2823@@ -543,8 +578,8 @@
2824 * @return Returns \c true only if the conversion succeeded.
2825 */
2826 template<class StringType> inline
2827-bool to_wchar_t( StringType const &in, wchar_t **out,
2828- unicode::size_type *out_len ) {
2829+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
2830+to_wchar_t( StringType const &in, wchar_t **out, unicode::size_type *out_len ) {
2831 return to_wchar_t( in.data(), in.size(), out, out_len );
2832 }
2833
2834@@ -577,7 +612,7 @@
2835 *
2836 * @param s The string to append to.
2837 */
2838- explicit back_html_uri_insert_iterator( StringType &s ) : base_type( s ) {
2839+ explicit back_html_uri_insert_iterator( StringType *s ) : base_type( s ) {
2840 buf_[0] = '%';
2841 }
2842
2843@@ -593,8 +628,10 @@
2844 * @tparam StringType The string type.
2845 * @param out The output string.
2846 */
2847-template<class StringType> inline back_html_uri_insert_iterator<StringType>
2848-back_html_uri_inserter( StringType &out ) {
2849+template<class StringType> inline
2850+typename std::enable_if<ZORBA_IS_STRING(StringType),
2851+ back_html_uri_insert_iterator<StringType> >::type
2852+back_html_uri_inserter( StringType *out ) {
2853 return back_html_uri_insert_iterator<StringType>( out );
2854 }
2855
2856@@ -607,10 +644,13 @@
2857 * @param out The output string (which must be different from \a in).
2858 */
2859 template<class InputStringType,class OutputStringType> inline
2860-void to_html_uri( InputStringType const &in, OutputStringType *out ) {
2861+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2862+ && ZORBA_IS_STRING(OutputStringType),
2863+ void>::type
2864+to_html_uri( InputStringType const &in, OutputStringType *out ) {
2865 typename utf8_stringify<InputStringType const>::type const u_in( in );
2866 typename utf8_stringify<OutputStringType>::type u_out( *out );
2867- std::copy( u_in.begin(), u_in.end(), back_html_uri_inserter( u_out ) );
2868+ std::copy( u_in.begin(), u_in.end(), back_html_uri_inserter( &u_out ) );
2869 }
2870
2871 /**
2872@@ -620,7 +660,8 @@
2873 * @param s The string.
2874 */
2875 template<class StringType> inline
2876-void to_html_uri( StringType &s ) {
2877+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2878+to_html_uri( StringType &s ) {
2879 StringType temp;
2880 to_html_uri( s, &temp );
2881 s = temp;
2882@@ -653,7 +694,7 @@
2883 *
2884 * @param s The string to append to.
2885 */
2886- explicit back_iri_insert_iterator( StringType &s ) : base_type( s ) {
2887+ explicit back_iri_insert_iterator( StringType *s ) : base_type( s ) {
2888 buf_[0] = '%';
2889 }
2890
2891@@ -669,8 +710,10 @@
2892 * @tparam StringType The string type.
2893 * @param out The output string.
2894 */
2895-template<class StringType> inline back_iri_insert_iterator<StringType>
2896-back_iri_inserter( StringType &out ) {
2897+template<class StringType> inline
2898+typename std::enable_if<ZORBA_IS_STRING(StringType),
2899+ back_iri_insert_iterator<StringType> >::type
2900+back_iri_inserter( StringType *out ) {
2901 return back_iri_insert_iterator<StringType>( out );
2902 }
2903
2904@@ -684,10 +727,13 @@
2905 * See RFC 3987.
2906 */
2907 template<class InputStringType,class OutputStringType> inline
2908-void iri_to_uri( InputStringType const &in, OutputStringType *out ) {
2909+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2910+ && ZORBA_IS_STRING(OutputStringType),
2911+ void>::type
2912+iri_to_uri( InputStringType const &in, OutputStringType *out ) {
2913 typename utf8_stringify<InputStringType const>::type const u_in( in );
2914 typename utf8_stringify<OutputStringType>::type u_out( *out );
2915- std::copy( u_in.begin(), u_in.end(), back_iri_inserter( u_out ) );
2916+ std::copy( u_in.begin(), u_in.end(), back_iri_inserter( &u_out ) );
2917 }
2918
2919 /**
2920@@ -698,7 +744,8 @@
2921 * See RFC 3987.
2922 */
2923 template<class StringType> inline
2924-void iri_to_uri( StringType &s ) {
2925+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2926+iri_to_uri( StringType &s ) {
2927 StringType temp;
2928 iri_to_uri( s, &temp );
2929 s = temp;
2930@@ -716,8 +763,11 @@
2931 * @param out The output String (which may be the same as \a in).
2932 */
2933 template<class InputStringType,class OutputStringType>
2934-bool normalize( InputStringType const &in, unicode::normalization::type n,
2935- OutputStringType *out );
2936+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2937+ && ZORBA_IS_STRING(OutputStringType),
2938+ bool>::type
2939+normalize( InputStringType const &in, unicode::normalization::type n,
2940+ OutputStringType *out );
2941 #endif /* ZORBA_NO_ICU */
2942
2943 ////////// Whitespace /////////////////////////////////////////////////////////
2944@@ -732,9 +782,12 @@
2945 * @param out The output string.
2946 */
2947 template<class InputStringType,class OutputStringType> inline
2948-void normalize_whitespace( utf8_string<InputStringType> const &in,
2949- utf8_string<OutputStringType> *out ) {
2950- ascii::normalize_whitespace( *in.get(), out->get() );
2951+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2952+ && ZORBA_IS_STRING(OutputStringType),
2953+ void>::type
2954+normalize_space( utf8_string<InputStringType> const &in,
2955+ utf8_string<OutputStringType> *out ) {
2956+ ascii::normalize_space( *in.get(), out->get() );
2957 }
2958
2959 /**
2960@@ -746,9 +799,12 @@
2961 * @param out The output string (which must be different from \a in).
2962 */
2963 template<class InputStringType,class OutputStringType> inline
2964-void trim_whitespace( utf8_string<InputStringType> const &in,
2965- utf8_string<OutputStringType> *out ) {
2966- ascii::trim_whitespace( *in.get(), out->get() );
2967+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
2968+ && ZORBA_IS_STRING(OutputStringType),
2969+ void>::type
2970+trim_space( utf8_string<InputStringType> const &in,
2971+ utf8_string<OutputStringType> *out ) {
2972+ ascii::trim_space( *in.get(), out->get() );
2973 }
2974
2975 /**
2976@@ -758,8 +814,9 @@
2977 * @param s The string.
2978 */
2979 template<class StringType> inline
2980-void trim_whitespace( utf8_string<StringType> &s ) {
2981- ascii::trim_whitespace( *s.get() );
2982+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
2983+trim_space( utf8_string<StringType> &s ) {
2984+ ascii::trim_space( *s.get() );
2985 }
2986
2987 ////////// Miscellaneous //////////////////////////////////////////////////////
2988@@ -774,8 +831,9 @@
2989 * @return Returns \c *s.
2990 */
2991 template<class StringType> inline
2992-StringType& left_pad( StringType *s, typename StringType::size_type width,
2993- unicode::code_point cp ) {
2994+typename std::enable_if<ZORBA_IS_STRING(StringType),StringType&>::type
2995+left_pad( StringType *s, typename StringType::size_type width,
2996+ unicode::code_point cp ) {
2997 typedef typename utf8_stringify<StringType>::type u_type;
2998 typedef typename u_type::size_type u_size_type;
2999 u_type u( *s );
3000@@ -795,8 +853,9 @@
3001 * @return Returns \c *s.
3002 */
3003 template<class StringType> inline
3004-StringType& right_pad( StringType *s, typename StringType::size_type width,
3005- unicode::code_point cp ) {
3006+typename std::enable_if<ZORBA_IS_STRING(StringType),StringType&>::type
3007+right_pad( StringType *s, typename StringType::size_type width,
3008+ unicode::code_point cp ) {
3009 typedef typename utf8_stringify<StringType>::type u_type;
3010 typedef typename u_type::size_type u_size_type;
3011 u_type u( *s );
3012@@ -815,7 +874,10 @@
3013 * @param out The output string.
3014 */
3015 template<class InputStringType,class OutputStringType> inline
3016-void reverse( InputStringType const &in, OutputStringType *out ) {
3017+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3018+ && ZORBA_IS_STRING(OutputStringType),
3019+ void>::type
3020+reverse( InputStringType const &in, OutputStringType *out ) {
3021 typename utf8_stringify<InputStringType const>::type const u_in( in );
3022 typename utf8_stringify<OutputStringType>::type u_out( *out );
3023 std::reverse_copy( u_in.begin(), u_in.end(), std::back_inserter( u_out ) );
3024@@ -832,14 +894,20 @@
3025 * @return Returns \c true only if the strip succeeded.
3026 */
3027 template<class InputStringType,class OutputStringType>
3028-bool strip_diacritics( InputStringType const &in, OutputStringType *out );
3029+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3030+ && ZORBA_IS_STRING(OutputStringType),
3031+ bool>::type
3032+strip_diacritics( InputStringType const &in, OutputStringType *out );
3033
3034 /**
3035 *
3036 */
3037 template<class StringType1,class StringType2> inline
3038-int compare(const StringType1 &s1, const StringType2 &s2,
3039- const XQPCollator* collation)
3040+typename std::enable_if<ZORBA_IS_STRING(StringType1)
3041+ && ZORBA_IS_STRING(StringType2),
3042+ int>::type
3043+compare(const StringType1 &s1, const StringType2 &s2,
3044+ const XQPCollator* collation)
3045 {
3046 #ifndef ZORBA_NO_ICU
3047 if (collation == NULL || collation->doMemCmp())
3048@@ -862,7 +930,8 @@
3049 *
3050 */
3051 template<class StringType> inline
3052-uint32_t hash(const StringType& s, const XQPCollator* collation = NULL)
3053+typename std::enable_if<ZORBA_IS_STRING(StringType),uint32_t>::type
3054+hash(const StringType& s, const XQPCollator* collation = NULL)
3055 {
3056 #ifndef ZORBA_NO_ICU
3057 if (!collation || collation->doMemCmp())
3058
3059=== modified file 'src/util/utf8_util.tcc'
3060--- src/util/utf8_util.tcc 2013-05-01 03:57:57 +0000
3061+++ src/util/utf8_util.tcc 2013-05-09 00:49:28 +0000
3062@@ -105,8 +105,11 @@
3063 #ifndef ZORBA_NO_ICU
3064
3065 template<class InputStringType,class OutputStringType>
3066-bool normalize( InputStringType const &in, unicode::normalization::type n,
3067- OutputStringType *out ) {
3068+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3069+ && ZORBA_IS_STRING(OutputStringType),
3070+ bool>::type
3071+normalize( InputStringType const &in, unicode::normalization::type n,
3072+ OutputStringType *out ) {
3073 unicode::string u_in;
3074 if ( !unicode::to_string( in, &u_in ) )
3075 return false;
3076@@ -126,7 +129,10 @@
3077 #endif /* ZORBA_NO_ICU */
3078
3079 template<class InputStringType,class OutputStringType>
3080-bool strip_diacritics( InputStringType const &in, OutputStringType *out ) {
3081+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3082+ && ZORBA_IS_STRING(OutputStringType),
3083+ bool>::type
3084+strip_diacritics( InputStringType const &in, OutputStringType *out ) {
3085 #ifndef ZORBA_NO_ICU
3086 unicode::string u_in;
3087 if ( !unicode::to_string( in, &u_in ) )
3088@@ -143,7 +149,7 @@
3089 #else
3090 out->clear();
3091 out->reserve( in.size() );
3092- std::copy( in.begin(), in.end(), ascii::back_ascii_inserter( *out ) );
3093+ std::copy( in.begin(), in.end(), ascii::back_ascii_inserter( out ) );
3094 #endif /* ZORBA_NO_ICU */
3095 return true;
3096 }
3097@@ -151,8 +157,8 @@
3098 #ifndef ZORBA_NO_ICU
3099
3100 template<class StringType>
3101-bool to_string( unicode::char_type const *in, size_type in_len,
3102- StringType *out ) {
3103+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
3104+to_string( unicode::char_type const *in, size_type in_len, StringType *out ) {
3105 storage_type *temp;
3106 size_type temp_len;
3107 if ( to_string( in, in_len, &temp, &temp_len ) ) {
3108@@ -166,7 +172,8 @@
3109
3110 #ifndef WIN32
3111 template<class StringType>
3112-bool to_string( wchar_t const *in, size_type in_len, StringType *out ) {
3113+typename std::enable_if<ZORBA_IS_STRING(StringType),bool>::type
3114+to_string( wchar_t const *in, size_type in_len, StringType *out ) {
3115 storage_type *temp;
3116 size_type temp_len;
3117 if ( utf8::to_string( in, in_len, &temp, &temp_len ) ) {
3118@@ -182,7 +189,10 @@
3119 #endif /* ZORBA_NO_ICU */
3120
3121 template<class InputStringType,class OutputStringType>
3122-void to_lower( InputStringType const &in, OutputStringType *out ) {
3123+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3124+ && ZORBA_IS_STRING(OutputStringType),
3125+ void>::type
3126+to_lower( InputStringType const &in, OutputStringType *out ) {
3127 typename utf8_stringify<InputStringType const>::type const u_in( in );
3128 typename utf8_stringify<OutputStringType>::type u_out( *out );
3129 out->clear(); // TODO: should this be here?
3130@@ -192,7 +202,10 @@
3131 }
3132
3133 template<class InputStringType,class OutputStringType>
3134-void to_upper( InputStringType const &in, OutputStringType *out ) {
3135+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3136+ && ZORBA_IS_STRING(OutputStringType),
3137+ void>::type
3138+to_upper( InputStringType const &in, OutputStringType *out ) {
3139 typename utf8_stringify<InputStringType const>::type const u_in( in );
3140 typename utf8_stringify<OutputStringType>::type u_out( *out );
3141 out->clear(); // TODO: should this be here?
3142@@ -201,6 +214,8 @@
3143 );
3144 }
3145
3146+///////////////////////////////////////////////////////////////////////////////
3147+
3148 } // namespace utf8
3149 } // namespace zorba
3150
3151
3152=== modified file 'src/util/utf8_util_base.h'
3153--- src/util/utf8_util_base.h 2013-04-22 23:57:31 +0000
3154+++ src/util/utf8_util_base.h 2013-05-09 00:49:28 +0000
3155@@ -315,10 +315,7 @@
3156 * @return Returns said number of characters or 0 if any byte is invalid.
3157 */
3158 template<class StringType> inline
3159-typename std::enable_if<
3160- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
3161- size_type
3162->::type
3163+typename std::enable_if<ZORBA_HAS_C_STR(StringType),size_type>::type
3164 length( StringType const &s ) {
3165 return length( s.c_str() );
3166 }
3167
3168=== modified file 'src/util/xml_util.h'
3169--- src/util/xml_util.h 2013-02-07 17:24:36 +0000
3170+++ src/util/xml_util.h 2013-05-09 00:49:28 +0000
3171@@ -55,7 +55,10 @@
3172 * @return Returns \c true only if the extraction was successful.
3173 */
3174 template<class InputStringType,class OutputStringType> inline
3175-bool clark_localname( InputStringType const &uname, OutputStringType *local ) {
3176+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3177+ && ZORBA_IS_STRING(OutputStringType),
3178+ bool>::type
3179+clark_localname( InputStringType const &uname, OutputStringType *local ) {
3180 typename InputStringType::size_type const rbrace = uname.find( '}' );
3181 if ( rbrace != InputStringType::npos && rbrace + 1 < uname.size() ) {
3182 *local = uname.substr( rbrace + 1 );
3183@@ -75,7 +78,10 @@
3184 * @return Returns \c true only if the extraction was successful.
3185 */
3186 template<class InputStringType,class OutputStringType> inline
3187-bool clark_uri( InputStringType const &uname, OutputStringType *uri ) {
3188+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3189+ && ZORBA_IS_STRING(OutputStringType),
3190+ bool>::type
3191+clark_uri( InputStringType const &uname, OutputStringType *uri ) {
3192 if ( uname.size() > 2 && uname[0] == '{' ) {
3193 typename InputStringType::size_type const rbrace = uname.find( '}', 1 );
3194 if ( rbrace != InputStringType::npos ) {
3195@@ -99,8 +105,13 @@
3196 * become empty, returns \c false; otherwise returns \a true.
3197 */
3198 template<class InputStringType,class PrefixStringType,class LocalStringType>
3199-inline bool split_name( InputStringType const &name, PrefixStringType *prefix,
3200- LocalStringType *local ) {
3201+inline
3202+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3203+ && ZORBA_IS_STRING(PrefixStringType)
3204+ && ZORBA_IS_STRING(LocalStringType),
3205+ bool>::type
3206+split_name( InputStringType const &name, PrefixStringType *prefix,
3207+ LocalStringType *local ) {
3208 typename InputStringType::size_type const colon = name.find( ':' );
3209 if ( colon != InputStringType::npos ) {
3210 prefix->assign( name, 0, colon );
3211@@ -166,7 +177,7 @@
3212 *
3213 * @param s The string to append to.
3214 */
3215- explicit back_xml_insert_iterator( StringType &s ) : base_type( s ) {
3216+ explicit back_xml_insert_iterator( StringType *s ) : base_type( s ) {
3217 buf_[0] = '&';
3218 buf_[1] = '#';
3219 }
3220@@ -183,8 +194,10 @@
3221 * @tparam StringType The string type.
3222 * @param out The output string.
3223 */
3224-template<class StringType> inline back_xml_insert_iterator<StringType>
3225-back_xml_inserter( StringType &out ) {
3226+template<class StringType> inline
3227+typename std::enable_if<ZORBA_IS_STRING(StringType),
3228+ back_xml_insert_iterator<StringType> >::type
3229+back_xml_inserter( StringType *out ) {
3230 return back_xml_insert_iterator<StringType>( out );
3231 }
3232
3233@@ -199,8 +212,11 @@
3234 * contents are appended to.
3235 */
3236 template<class InputStringType,class OutputStringType> inline
3237-void escape( InputStringType const &in, OutputStringType *out ) {
3238- std::copy( in.begin(), in.end(), back_xml_inserter( *out ) );
3239+typename std::enable_if<ZORBA_IS_STRING(InputStringType)
3240+ && ZORBA_IS_STRING(OutputStringType),
3241+ void>::type
3242+escape( InputStringType const &in, OutputStringType *out ) {
3243+ std::copy( in.begin(), in.end(), back_xml_inserter( out ) );
3244 }
3245
3246 /**
3247@@ -211,9 +227,10 @@
3248 * @param s The string.
3249 */
3250 template<class StringType> inline
3251-void escape( StringType &s ) {
3252+typename std::enable_if<ZORBA_IS_STRING(StringType),void>::type
3253+escape( StringType &s ) {
3254 StringType temp;
3255- std::copy( s.begin(), s.end(), back_xml_inserter( temp ) );
3256+ std::copy( s.begin(), s.end(), back_xml_inserter( &temp ) );
3257 s = temp;
3258 }
3259
3260@@ -239,7 +256,8 @@
3261 * returns -1.
3262 */
3263 template<class StringType> inline
3264-int parse_entity( StringType const &ref, unicode::code_point *c ) {
3265+typename std::enable_if<ZORBA_HAS_C_STR(StringType),int>::type
3266+parse_entity( StringType const &ref, unicode::code_point *c ) {
3267 return parse_entity( ref.c_str(), c );
3268 }
3269
3270@@ -254,7 +272,8 @@
3271 * returns -1.
3272 */
3273 template<class StringType> inline
3274-int parse_entity( char const *ref, StringType *out ) {
3275+typename std::enable_if<ZORBA_IS_STRING(StringType),int>::type
3276+parse_entity( char const *ref, StringType *out ) {
3277 unicode::code_point c;
3278 int const result = parse_entity( ref, &c );
3279 if ( result != -1 )
3280@@ -274,7 +293,10 @@
3281 * returns -1.
3282 */
3283 template<class InputStringType,class OutputStringType> inline
3284-int parse_entity( InputStringType const &ref, OutputStringType *out ) {
3285+typename std::enable_if<ZORBA_HAS_C_STR(InputStringType)
3286+ && ZORBA_IS_STRING(OutputStringType),
3287+ int>::type
3288+parse_entity( InputStringType const &ref, OutputStringType *out ) {
3289 return parse_entity( ref.c_str(), out );
3290 }
3291
3292
3293=== modified file 'src/zorbatypes/URI.cpp'
3294--- src/zorbatypes/URI.cpp 2013-05-07 21:21:56 +0000
3295+++ src/zorbatypes/URI.cpp 2013-05-09 00:49:28 +0000
3296@@ -577,8 +577,8 @@
3297 // first, we need to normalize the spaces in the uri
3298 // and only work with the normalized version from this point on
3299 zstring lTrimmedURI;
3300- ascii::normalize_whitespace(uri, &lTrimmedURI);
3301- ascii::trim_whitespace(lTrimmedURI);
3302+ ascii::normalize_space(uri, &lTrimmedURI);
3303+ ascii::trim_space(lTrimmedURI);
3304
3305 zstring::size_type lTrimmedURILength = lTrimmedURI.size();
3306
3307
3308=== modified file 'src/zorbatypes/binary.cpp'
3309--- src/zorbatypes/binary.cpp 2013-03-19 06:13:13 +0000
3310+++ src/zorbatypes/binary.cpp 2013-05-09 00:49:28 +0000
3311@@ -282,7 +282,7 @@
3312
3313 void Base16::insertData(char const *s, size_t len)
3314 {
3315- s = ascii::trim_whitespace( s, &len );
3316+ s = ascii::trim_space( s, &len );
3317 try {
3318 hexbinary::encode( s, len, &theData );
3319 }
3320
3321=== modified file 'src/zorbatypes/datetime/datetimetype.cpp'
3322--- src/zorbatypes/datetime/datetimetype.cpp 2013-05-08 20:14:47 +0000
3323+++ src/zorbatypes/datetime/datetimetype.cpp 2013-05-09 00:49:28 +0000
3324@@ -355,7 +355,7 @@
3325
3326 // DateTime is of form: '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
3327
3328- ascii::skip_whitespace(str, len, &pos);
3329+ ascii::skip_space(str, len, &pos);
3330
3331 dt.facet = DATETIME_FACET;
3332
3333@@ -381,7 +381,7 @@
3334
3335 ascii::size_type savepos = pos;
3336
3337- ascii::skip_whitespace(str, len, &pos);
3338+ ascii::skip_space(str, len, &pos);
3339
3340 if (savepos != pos && pos != len)
3341 return 1;
3342@@ -414,7 +414,7 @@
3343 ascii::size_type pos = 0;
3344 int err = 1;
3345
3346- ascii::skip_whitespace(str, len, &pos);
3347+ ascii::skip_space(str, len, &pos);
3348
3349 dt.facet = DATE_FACET;
3350
3351@@ -428,7 +428,7 @@
3352
3353 ascii::size_type savepos = pos;
3354
3355- ascii::skip_whitespace(str, len, &pos);
3356+ ascii::skip_space(str, len, &pos);
3357
3358 if (savepos != pos && pos != len)
3359 return 1;
3360@@ -451,7 +451,7 @@
3361 int err = 1;
3362 ascii::size_type pos = 0;
3363
3364- ascii::skip_whitespace(str, len, &pos);
3365+ ascii::skip_space(str, len, &pos);
3366
3367 dt.facet = TIME_FACET;
3368
3369@@ -464,7 +464,7 @@
3370
3371 ascii::size_type savepos = pos;
3372
3373- ascii::skip_whitespace(str, len, &pos);
3374+ ascii::skip_space(str, len, &pos);
3375
3376 if (savepos != pos && pos != len)
3377 return 1;
3378@@ -494,7 +494,7 @@
3379
3380 // GYearMonth of form: '-'? yyyy '-' mm zzzzzz?
3381
3382- ascii::skip_whitespace(str, len, &pos);
3383+ ascii::skip_space(str, len, &pos);
3384
3385 dt.facet = GYEARMONTH_FACET;
3386
3387@@ -522,7 +522,7 @@
3388
3389 ascii::size_type savepos = pos;
3390
3391- ascii::skip_whitespace(str, len, &pos);
3392+ ascii::skip_space(str, len, &pos);
3393
3394 if (savepos != pos && pos != len)
3395 return 1;
3396@@ -548,7 +548,7 @@
3397
3398 // GYear of form: '-'? yyyy zzzzzz?
3399
3400- ascii::skip_whitespace(str, len, &pos);
3401+ ascii::skip_space(str, len, &pos);
3402
3403 dt.facet = GYEAR_FACET;
3404
3405@@ -578,7 +578,7 @@
3406
3407 ascii::size_type savepos = pos;
3408
3409- ascii::skip_whitespace(str, len, &pos);
3410+ ascii::skip_space(str, len, &pos);
3411
3412 if (savepos != pos && pos != len)
3413 return 1;
3414@@ -606,7 +606,7 @@
3415 // GMonth of form: --MM zzzzzz?
3416 // preceding - is not allowed.
3417
3418- ascii::skip_whitespace(str, len, &pos);
3419+ ascii::skip_space(str, len, &pos);
3420
3421 dt.facet = GMONTH_FACET;
3422
3423@@ -630,7 +630,7 @@
3424
3425 ascii::size_type savepos = pos;
3426
3427- ascii::skip_whitespace(str, len, &pos);
3428+ ascii::skip_space(str, len, &pos);
3429
3430 if (savepos != pos && pos != len)
3431 return 1;
3432@@ -658,7 +658,7 @@
3433 // GMonthDay of form: --MM-DD zzzzzz?
3434 // preceding - is not allowed.
3435
3436- ascii::skip_whitespace(str, len, &pos);
3437+ ascii::skip_space(str, len, &pos);
3438
3439 dt.facet = GMONTHDAY_FACET;
3440
3441@@ -683,7 +683,7 @@
3442
3443 ascii::size_type savepos = pos;
3444
3445- ascii::skip_whitespace(str, len, &pos);
3446+ ascii::skip_space(str, len, &pos);
3447
3448 if (savepos != pos && pos != len)
3449 return 1;
3450@@ -711,7 +711,7 @@
3451 // GDay of form: ---DD zzzzzz?
3452 // preceding - is not allowed.
3453
3454- ascii::skip_whitespace(str, len, &pos);
3455+ ascii::skip_space(str, len, &pos);
3456
3457 dt.facet = GDAY_FACET;
3458
3459@@ -736,7 +736,7 @@
3460
3461 ascii::size_type savepos = pos;
3462
3463- ascii::skip_whitespace(str, len, &pos);
3464+ ascii::skip_space(str, len, &pos);
3465
3466 if (savepos != pos && pos != len)
3467 return 1;
3468
3469=== modified file 'src/zorbatypes/datetime/duration.cpp'
3470--- src/zorbatypes/datetime/duration.cpp 2013-04-30 00:12:10 +0000
3471+++ src/zorbatypes/datetime/duration.cpp 2013-05-09 00:49:28 +0000
3472@@ -58,7 +58,7 @@
3473 long& frac_seconds)
3474 {
3475 ascii::size_type savepos = pos;
3476- ascii::skip_whitespace(str, len, &pos);
3477+ ascii::skip_space(str, len, &pos);
3478 int err;
3479
3480 if (pos != savepos) {
3481@@ -111,7 +111,7 @@
3482 long& frac_seconds)
3483 {
3484 ascii::size_type savepos = pos;
3485- ascii::skip_whitespace(str, len, &pos);
3486+ ascii::skip_space(str, len, &pos);
3487 int err;
3488
3489 if (pos != savepos)
3490@@ -246,7 +246,7 @@
3491 return err;
3492
3493 ascii::size_type pos = ym_pos+1;
3494- ascii::skip_whitespace(str, len, &pos);
3495+ ascii::skip_space(str, len, &pos);
3496
3497 if (pos > ym_pos + 1 && pos != len)
3498 return 1;
3499@@ -282,7 +282,7 @@
3500 long months = 0;
3501 int err;
3502
3503- ascii::skip_whitespace(str, len, &pos);
3504+ ascii::skip_space(str, len, &pos);
3505
3506 if (pos == len)
3507 return 1;
3508@@ -327,7 +327,7 @@
3509 return 1;
3510 }
3511
3512- ascii::skip_whitespace(str, len, &pos);
3513+ ascii::skip_space(str, len, &pos);
3514
3515 if (len != pos)
3516 return 1;
3517@@ -352,7 +352,7 @@
3518 long days = 0, hours = 0, minutes = 0, seconds = 0, frac_seconds = 0;
3519 int err;
3520
3521- ascii::skip_whitespace(str, len, &pos);
3522+ ascii::skip_space(str, len, &pos);
3523
3524 if (pos == len)
3525 return 1;
3526@@ -392,7 +392,7 @@
3527 return err;
3528 }
3529
3530- ascii::skip_whitespace(str, len, &pos);
3531+ ascii::skip_space(str, len, &pos);
3532
3533 if (len != pos)
3534 return 1;
3535
3536=== modified file 'src/zorbatypes/datetime/timezone.cpp'
3537--- src/zorbatypes/datetime/timezone.cpp 2013-05-08 20:14:47 +0000
3538+++ src/zorbatypes/datetime/timezone.cpp 2013-05-09 00:49:28 +0000
3539@@ -48,14 +48,14 @@
3540 {
3541 ascii::size_type pos = 0;
3542
3543- ascii::skip_whitespace(str, strlen, &pos);
3544+ ascii::skip_space(str, strlen, &pos);
3545
3546 // A time zone is of form: (('+' | '-') hh ':' mm) | 'Z'
3547
3548 if (str[pos] == 'Z')
3549 {
3550 ++pos;
3551- ascii::skip_whitespace(str, strlen, &pos);
3552+ ascii::skip_space(str, strlen, &pos);
3553
3554 if (pos != strlen)
3555 return 1;
3556@@ -94,7 +94,7 @@
3557 if (tz.data[HOUR_DATA]*60 + tz.data[MINUTE_DATA] > 14*60)
3558 return 1;
3559
3560- ascii::skip_whitespace(str, strlen, &pos);
3561+ ascii::skip_space(str, strlen, &pos);
3562
3563 if (pos != strlen)
3564 return 1;
3565
3566=== modified file 'src/zorbatypes/decimal.cpp'
3567--- src/zorbatypes/decimal.cpp 2013-05-05 03:16:33 +0000
3568+++ src/zorbatypes/decimal.cpp 2013-05-09 00:49:28 +0000
3569@@ -37,7 +37,7 @@
3570 if ( !*s )
3571 throw std::invalid_argument( "empty string" );
3572
3573- s = ascii::trim_start_whitespace( s );
3574+ s = ascii::trim_start_space( s );
3575 char const *const first_non_ws = s;
3576
3577 if ( *s == '+' || *s == '-' )
3578
3579=== modified file 'src/zorbatypes/floatimpl.cpp'
3580--- src/zorbatypes/floatimpl.cpp 2013-05-04 17:29:21 +0000
3581+++ src/zorbatypes/floatimpl.cpp 2013-05-09 00:49:28 +0000
3582@@ -69,7 +69,7 @@
3583
3584 int significant_digits = 0;
3585
3586- s = ascii::trim_start_whitespace( s );
3587+ s = ascii::trim_start_space( s );
3588
3589 if ( !parse_etc( s ) ) {
3590 char const *const first_non_ws = s;
3591@@ -136,7 +136,7 @@
3592 } else
3593 return false;
3594
3595- return !*ascii::trim_start_whitespace( s );
3596+ return !*ascii::trim_start_space( s );
3597 }
3598
3599 ////////// constructors ///////////////////////////////////////////////////////
3600
3601=== modified file 'src/zorbautils/locale.h'
3602--- src/zorbautils/locale.h 2013-03-24 15:21:50 +0000
3603+++ src/zorbautils/locale.h 2013-05-09 00:49:28 +0000
3604@@ -55,10 +55,7 @@
3605 // Template version of find().
3606 //
3607 template<class StringType> inline
3608- typename std::enable_if<
3609- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
3610- type
3611- >::type
3612+ typename std::enable_if<ZORBA_HAS_C_STR(StringType),type>::type
3613 find( StringType const &country ) {
3614 return find( country.c_str() );
3615 }
3616@@ -101,10 +98,7 @@
3617 // Template version of find().
3618 //
3619 template<class StringType> inline
3620- typename std::enable_if<
3621- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
3622- type
3623- >::type
3624+ typename std::enable_if<ZORBA_HAS_C_STR(StringType),type>::type
3625 find( StringType const &lang ) {
3626 return find( lang.c_str() );
3627 }
3628@@ -265,10 +259,7 @@
3629 // Template version of find().
3630 //
3631 template<class StringType> inline
3632- typename std::enable_if<
3633- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
3634- type
3635- >::type
3636+ typename std::enable_if<ZORBA_HAS_C_STR(StringType),type>::type
3637 find( StringType const &lang ) {
3638 return find( lang.c_str() );
3639 }
3640@@ -288,10 +279,7 @@
3641 // Template version of find_lang().
3642 //
3643 template<class StringType> inline
3644- typename std::enable_if<
3645- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
3646- iso639_1::type
3647- >::type
3648+ typename std::enable_if<ZORBA_HAS_C_STR(StringType),iso639_1::type>::type
3649 find_lang( StringType const &lang ) {
3650 return find_lang( lang.c_str() );
3651 }
3652@@ -436,10 +424,7 @@
3653 // Template version of parse().
3654 //
3655 template<class StringType> inline
3656- typename std::enable_if<
3657- ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
3658- bool
3659- >::type
3660+ typename std::enable_if<ZORBA_HAS_C_STR(StringType),bool>::type
3661 parse( StringType const &locale_str, iso639_1::type *lang = nullptr,
3662 iso3166_1::type *country = nullptr ) {
3663 return parse( locale_str.c_str(), lang, country );

Subscribers

People subscribed via source and target branches