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:
parent
b07505cc7b
commit
e602db3d53
1 changed files with 22 additions and 0 deletions
|
|
@ -209,6 +209,27 @@ String *Swig_string_ucase(String *s) {
|
||||||
return ns;
|
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()
|
* Swig_string_typecode()
|
||||||
*
|
*
|
||||||
|
|
@ -736,6 +757,7 @@ Swig_init() {
|
||||||
DohEncoding("lowercase", Swig_string_lower);
|
DohEncoding("lowercase", Swig_string_lower);
|
||||||
DohEncoding("camelcase", Swig_string_ccase);
|
DohEncoding("camelcase", Swig_string_ccase);
|
||||||
DohEncoding("undercase", Swig_string_ucase);
|
DohEncoding("undercase", Swig_string_ucase);
|
||||||
|
DohEncoding("firstuppercase", Swig_string_first_ucase);
|
||||||
|
|
||||||
/* Initialize the swig keys */
|
/* Initialize the swig keys */
|
||||||
Swig_keys_init();
|
Swig_keys_init();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue