[iostreams] patch for examples/dictionary_filter.hpp for bcc32

Please find attached a patch for libs/iostreams/example/dictionary_filter.hpp to help get the tests to build under bcc32 5.6.x and STLPort Thanks Russell Index: libs/iostreams/example/dictionary_filter.hpp =================================================================== RCS file: /cvsroot/boost/boost/libs/iostreams/example/dictionary_filter.hpp,v retrieving revision 1.3 diff -u -r1.3 dictionary_filter.hpp --- libs/iostreams/example/dictionary_filter.hpp 20 May 2005 03:59:33 -0000 1.3 +++ libs/iostreams/example/dictionary_filter.hpp 20 May 2005 12:22:17 -0000 @@ -42,7 +42,11 @@ using namespace std; while (true) { int c = std::cin.get(); +#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + if (c == EOF || !std::isalpha(c)) { +#else if (c == EOF || !std::isalpha(c, dictionary_.getloc())) { +#endif dictionary_.replace(current_word_); cout.write( current_word_.data(), static_cast<streamsize>(current_word_.size()) ); @@ -84,7 +88,11 @@ if ((c = iostreams::get(src)) == WOULD_BLOCK) return WOULD_BLOCK; +#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + if (c == EOF || !std::isalpha(c)) { +#else if (c == EOF || !std::isalpha(c, dictionary_.getloc())) { +#endif dictionary_.replace(current_word_); off_ = 0; if (c == EOF) @@ -127,7 +135,11 @@ if (off_ != std::string::npos && !write_current_word(dest)) return false; +#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + if (!std::isalpha(c)) { +#else if (!std::isalpha(c, dictionary_.getloc())) { +#endif dictionary_.replace(current_word_); off_ = 0; } @@ -190,8 +202,13 @@ if (it == map_.end()) return false; string& value = it->second; +#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + if (!value.empty() && !key.empty() && std::isupper(key[0])) + value[0] = std::toupper(value[0]); +#else if (!value.empty() && !key.empty() && std::isupper(key[0], loc_)) value[0] = std::toupper(value[0], loc_); +#endif key = value; return true; } @@ -201,7 +218,11 @@ inline void dictionary::tolower(std::string& str) { for (std::string::size_type z = 0, len = str.size(); z < len; ++z) +#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + str[z] = std::tolower(str[z]); +#else str[z] = std::tolower(str[z], loc_); +#endif } } } } // End namespaces example, iostreams, boost.

Russell Hind wrote:
Thanks for pointing this out. Since the filters in this header will be used as examples in the tutorial, I can't really use #ifdefs. So I think I'll have to use the one-argument functions from <cctype>. Jonathan
participants (2)
-
Jonathan Turkanis
-
Russell Hind