Added new method called Swig_string_first_ucase which capitalizes the first letter in a string. This is needed for the Ruby module to allow backwards compatibility with swig 1.2.7 and before generated interfaces.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8409 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Charlie Savage 2006-01-13 05:50:57 +00:00
commit e602db3d53

View file

@ -209,6 +209,27 @@ String *Swig_string_ucase(String *s) {
return ns;
}
/* -----------------------------------------------------------------------------
* Swig_string_first_ucase()
*
* Make the first character in the string uppercase, leave all the
* rest the same. This is used by the Ruby module to provide backwards
* compatibility with the old way of naming classes and constants. For
* more info see the Ruby documentation.
*
* firstUpper -> FirstUpper
* ----------------------------------------------------------------------------- */
String *Swig_string_first_ucase(String *s) {
String *ns = NewStringEmpty();
char *cs = Char(s);
if (cs) {
Putc(toupper(cs[0]),ns);
Append(ns, cs + 1);
}
return ns;
}
/* -----------------------------------------------------------------------------
* Swig_string_typecode()
*
@ -736,6 +757,7 @@ Swig_init() {
DohEncoding("lowercase", Swig_string_lower);
DohEncoding("camelcase", Swig_string_ccase);
DohEncoding("undercase", Swig_string_ucase);
DohEncoding("firstuppercase", Swig_string_first_ucase);
/* Initialize the swig keys */
Swig_keys_init();