Macadamian/titanium_mobile — pull request #84 by jpl-mac (2012-06-20 23:16:59+00:00)
Title: TIMOB-9389 & TIMOB-9407

Reviewers DavidC, Alex

This patch is in 2 commits, the first one for the modifications to the format function, the 2nd for the rearrangement of the code to separate the native from the ti code.

1st commit:

TIMOB-9389 Blackberry: implement String.format numbered specifiers support
TIMOB-9407 Blackberry: add support for StringObject in the String formatting methods

Changelog:
- added support for numbered args in format
- update apidoc + extra condition
- Support StringObjects where String is expected
- convert non string objects using ToString
NOTE: our Ti objects currently don't support toString correctly and crash when hitting that code. TIMOB-9665 has been created to track that issue.

Tests:
- Verified converting non string objects when string is expected works except for Ti objects
-- Tried both as format string and as string param
- Verified that StringObjects work just like a string
- Verified using numbered args works correctly, and that using the same arg multiple times in the same format string also works as expected.

2nd commit:

TIMOB-9389 Blackberry: implement String.format numbered specifiers support
TIMOB-9407 Blackberry: add support for StringObject in the String formatting methods

This patch is to move the native code into a Native class accessible via the objectFactory. It also attaches the string methods to the builtin String object rather than overriding it.

Changelog:
- add the String methods to the Global String object
- moved native logic to a Native* class
- added NativeObjectFactory::getNativeStringInterface
- moved create string methods to a function in TiRootObject
- silence compiler warnings
- remove implementation of JSON and decode/encodeURIComponent that are built in V8
- fixed include order in NativeObjectFactory.cpp
New files:
- NativeStringInterface.*
Deleted files:
- TiJSONObject.*
- TiStringObject.*

Tests:
- Verified that tibb and tibbtest build correctly and the format method is accessible on the String object
- Validated that String, JSON and its methods and also encodeURIComponent/decodeURIComponent built-ins are now available and usable