From 6280d3eed90b685e74c86b97b6636c29f868bf55 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 14 Mar 2011 17:10:38 +0200 Subject: Add upcase(string) function to context --- odb/context.cxx | 16 +++++++++++++++- odb/context.hxx | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/odb/context.cxx b/odb/context.cxx index 8b07da5..6fde943 100644 --- a/odb/context.cxx +++ b/odb/context.cxx @@ -3,7 +3,7 @@ // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v3; see accompanying LICENSE file -#include // std::is{alpha,upper,lower} +#include // std::toupper, std::is{alpha,upper,lower} #include #include @@ -136,6 +136,20 @@ context:: { } +string context:: +upcase (string const& s) +{ + string r; + string::size_type n (s.size ()); + + r.reserve (n); + + for (string::size_type i (0); i < n; ++i) + r.push_back (toupper (s[i])); + + return r; +} + bool context:: comp_value_ (semantics::class_& c) { diff --git a/odb/context.hxx b/odb/context.hxx index b052a71..365936d 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -52,6 +52,9 @@ public: typedef std::string string; typedef ::options options_type; + static string + upcase (string const&); + public: static semantics::type& member_type (semantics::data_member& m, string const& key_prefix) -- cgit v1.1