Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (other than format) #76

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
959eecc
Merge branch 'formatReview', remote-tracking branch 'jpl-mac/timob-93…
Jun 9, 2012
4c3ab30
Merge branch 'formatReview', remote-tracking branch 'upstream/blackbe…
Jun 9, 2012
3c9409d
TIMOB-9395: Blackberry: implement decode/encode URIComponent
Jun 9, 2012
99130f8
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
Jun 11, 2012
a891e9c
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
Jun 13, 2012
8c9c499
Merge branch 'formatBranch'; commit '3c93b467' into formatBranch
Jun 18, 2012
ba505e6
Merge branch 'formatBranch', remote-tracking branch 'upstream/blackbe…
Jun 18, 2012
e9f27f7
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
Jun 18, 2012
4510b27
Merge branch 'formatBranch', remote-tracking branch 'upstream/blackbe…
Jun 21, 2012
014c5fd
Merge branch 'formatBranch', remote-tracking branch 'jpl-mac/timob-93…
Jun 21, 2012
0db5658
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
Jun 21, 2012
05bcf56
Merge branch 'formatBranch', remote-tracking branch 'upstream/blackbe…
Jun 25, 2012
64d3732
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
Jun 25, 2012
ba500af
Merge branch 'formatBranch', remote-tracking branch 'upstream/blackbe…
alexandergalstyan Jul 6, 2012
7f61a26
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
alexandergalstyan Jul 6, 2012
e9d0fa3
Merge branch 'formatBranch', remote-tracking branch 'upstream/blackbe…
alexandergalstyan Jul 9, 2012
44dd635
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
alexandergalstyan Jul 9, 2012
16eb9a4
Merge branch 'formatBranch', remote-tracking branch 'upstream/blackbe…
alexandergalstyan Jul 11, 2012
1fe0911
TIMOB-9390: Blackberry: implement rest of String.formatXXX methods (o…
alexandergalstyan Jul 11, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions apidoc/Global/Global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ methods:
only one alert dialog will be visible and modal at a time.

Be aware that this method may be removed in the future.

On BlackBerry: NYI
parameters:
- name: message
summary: Alert message.
Expand All @@ -54,13 +56,17 @@ methods:

- name: clearInterval
summary: Cancels an interval timer.
description: |
On BlackBerry: NYI
parameters:
- name: timerId
summary: Unique timer identifier returned by [setInterval](Global.setInterval).
type: Number

- name: clearTimeout
summary: Cancels a one-time timer.
description: |
On BlackBerry: NYI
parameters:
- name: timerId
summary: Unique timer identifier returned by [setTimeout](Global.setTimeout).
Expand All @@ -74,6 +80,8 @@ methods:
For more information, see the MDN website for
[encodeURIComponent](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent)
and [decodeURIComponent](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/decodeURIComponent).

On BlackBerry: NYI
returns:
summary: Decoded string.
type: String
Expand All @@ -90,6 +98,8 @@ methods:
For more information, see the MDN website for
[encodeURIComponent](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent)
and [decodeURIComponent](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/decodeURIComponent).

On BlackBerry: NYI
returns:
summary: Encoded string.
type: String
Expand All @@ -100,6 +110,8 @@ methods:

- name: L
summary: An alias for <Titanium.Locale.getString>.
description: |
On BlackBerry: NYI
returns:
summary: Localized string defined by `key`, or value of `hint` otherwise.
type: String
Expand Down Expand Up @@ -161,6 +173,9 @@ methods:

require('../myModule/module.js')
require ('/myModule/module.js')

#### BlackBerry
NYI
returns:
summary: Exported `exports` object of the required module.
type: Object
Expand Down Expand Up @@ -196,6 +211,8 @@ methods:

For more information, see the MDN website for
[setInterval](https://developer.mozilla.org/en/DOM/window.setInterval).

On BlackBerry: NYI
returns:
summary: Unique timer identifier.
type: Number
Expand Down Expand Up @@ -231,6 +248,8 @@ methods:

For more information, see the MDN website for
[setTimeout](https://developer.mozilla.org/en/DOM/window.setTimeout).

On BlackBerry: NYI
returns:
summary: Unique timer identifier.
type: Number
Expand Down
4 changes: 3 additions & 1 deletion apidoc/Global/JSON/JSON.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ methods:
used for indentation. If the space parameter is a number, then
each level is indented by the specified number of spaces.

On BlackBerry: NYI
parameters:

- name: value
Expand Down Expand Up @@ -105,7 +106,8 @@ methods:
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.


On BlackBerry: NYI
parameters:
- name: text
summary: JSON text to parse.
Expand Down
20 changes: 17 additions & 3 deletions apidoc/Global/String/String.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ methods:
var number = 21;
var message = String.format('Welcome, %s! You are visitor number %d', forename, number);
Ti.API.info(message);

#### BlackBerry
`%a` and `%A` are treated as `%f` and `%F`.

Supported length modifiers are `ll` for integer specifiers and `L` for double specifiers.
`j`, `t` and `L` (for integer) are not supported, others have no effect.

Numbered arguments `%n$` are NYI
returns:
type: String
summary: Formatted string.
Expand All @@ -32,13 +40,14 @@ methods:
- name: value
summary: |
Comma-separated list of one or more values to substitute into the `formatString`.
Optional on Android.
Optional on Android and BlackBerry.
type: [ String, Number ]

- name: formatCurrency
summary: |
Formats a number into the currency format, including currency symbol, of the locale
configured for the system.
description: On BlackBerry NYI
returns:
type: String
summary: Formatted, localized string.
Expand All @@ -49,6 +58,7 @@ methods:

- name: formatDate
summary: Formats a date into the date format of the locale configured for the system.
description: On BlackBerry NYI
returns:
type: String
summary: Formatted, localized string.
Expand All @@ -67,6 +77,7 @@ methods:
summary: |
Formats a number into the decimal format, including decimal symbol, of the locale
configured for the system.
description: On BlackBerry NYI
returns:
type: String
summary: |
Expand All @@ -89,7 +100,10 @@ methods:

- name: formatTime
summary: Formats a date into the time format of the locale configured for the system.
description: On Android, this method returns the short format.
description: |
On Android, this method returns the short format.

On BlackBerry: NYI
returns:
type: String
summary: Formatted, localized string.
Expand All @@ -102,4 +116,4 @@ methods:
summary: Date format to use. One of 'short', 'medium', or 'long' (iOS only.)
type: String
optional: true
default: 'short'
default: 'short'
7 changes: 4 additions & 3 deletions apidoc/Titanium/UI/ActivityIndicator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ description: |
* On Android, the activity indicator is a modal dialog that blocks the UI. Calling `show`
displays the indicator, and calling `hide` removes it.

* On iOS, Blackberry and Mobile Web, the activity indicator is a view like any other view, and must be
* On iOS, BlackBerry and Mobile Web, the activity indicator is a view like any other view, and must be
added to a window or other top-level view before it can be shown. Note that, unlike most views,
the activity indicator is hidden by default and must be shown explicitly.
extends: Titanium.Proxy
On Blackberry the activity indicator has three fixed graphics sizes. The activity indicator will choose

* On BlackBerry the activity indicator has three fixed graphics sizes. The activity indicator will choose
the largest of its three graphics sizes that fits inside the avaliable space.
extends: Titanium.Proxy
since: "0.8"
methods:
- name: hide
Expand Down
2 changes: 1 addition & 1 deletion apidoc/Titanium/UI/TableView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ events:
summary: Fired when a table row is clicked by the user.
platforms: [android, iphone, ipad, mobileweb, blackberry]
description: |
For now, Blackberry supports only 'index' property of this event
For now, BlackBerry supports only 'index' property of this event
properties:
- name: index
summary: Row index.
Expand Down
8 changes: 8 additions & 0 deletions blackberry/tibb/TiConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ enum N_TEXT_ALIGNMENT
TEXT_ALIGNMENT_RIGHT
};

// Locale format constants
enum N_DATE_FORMAT_TYPE
{
DATE_FORMAT_LONG,
DATE_FORMAT_MEDIUM,
DATE_FORMAT_SHORT
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be used anywhere

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


}

}
Expand Down
34 changes: 34 additions & 0 deletions blackberry/tibb/TiDateObject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/

#include "TiDateObject.h"

TiDateObject::TiDateObject(NativeObjectFactory* objectFactory)
: TiObject("Date")
{
objectFactory_ = objectFactory;
}

TiDateObject::~TiDateObject()
{
}

void TiDateObject::addObjectToParent(TiObject* parent, NativeObjectFactory* objectFactory)
{
TiDateObject* obj = new TiDateObject(objectFactory);
parent->addMember(obj);
obj->release();
}

void TiDateObject::onCreateStaticMembers()
{
}

bool TiDateObject::canAddMembers() const
{
return false;
}
37 changes: 37 additions & 0 deletions blackberry/tibb/TiDateObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/

#ifndef TIDATEOBJECT_H_
#define TIDATEOBJECT_H_

#include "TiObject.h"

/*
* TiDateObject
*/
class TiDateObject : public TiObject
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this class for? It doesn't seem to serve any purpose

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our framework doesn't know about Date type. This class is for that purpose. Maybe there is another solution for that, but without it it got crashed with var date = new Date(); statement.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an issue with the framework. Dave is working on this timob-9398.

I'm a bit surprised that it needs to name to be defined, but then the resulting object is the actual built in Date object.

In all events this shouldn't be needed in the future, so i suggest waiting for 9398 to complete this patch.

{
public:
static void addObjectToParent(TiObject* parent, NativeObjectFactory* objectFactory);

protected:
virtual ~TiDateObject();
virtual void onCreateStaticMembers();
virtual bool canAddMembers() const;

private:
explicit TiDateObject();
explicit TiDateObject(NativeObjectFactory* objectFactory);

/* Not copiable; Not assignable */
TiDateObject(const TiDateObject& date);
TiDateObject& operator=(const TiDateObject& date);

NativeObjectFactory* objectFactory_;
};

#endif /* TIDATEOBJECT_H_ */
9 changes: 9 additions & 0 deletions blackberry/tibb/TiMessageStrings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/

#define TIMESSAGESTRINGS_DEF_VALUE
#include "TiMessageStrings.h"
38 changes: 38 additions & 0 deletions blackberry/tibb/TiMessageStrings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/

#ifndef TIMESSAGESTRINGS_H_
#define TIMESSAGESTRINGS_H_

// Single file to contain the message strings

#ifdef TIMESSAGESTRINGS_DEF_VALUE
#define TIMESSAGESTRINGS_CONST_DEF(T,N,V) const T N=V
#else // TIMESSAGESTRINGS_DEF_VALUE
#define TIMESSAGESTRINGS_CONST_DEF(T,N,V) extern const T N
#endif // TIMESSAGESTRINGS_DEF_VALUE

namespace Ti
{
namespace Msg
{

TIMESSAGESTRINGS_CONST_DEF(char*, Expected_argument_of_type_double, "Expected argument of type double");
TIMESSAGESTRINGS_CONST_DEF(char*, Expected_argument_of_type_integer, "Expected argument of type integer");
TIMESSAGESTRINGS_CONST_DEF(char*, Expected_argument_of_type_object_or_external, "Expected argument of type object or external");
TIMESSAGESTRINGS_CONST_DEF(char*, Expected_argument_of_type_string, "Expected argument of type string");
TIMESSAGESTRINGS_CONST_DEF(char*, Expected_argument_of_type_date, "Expected argument of type date");
TIMESSAGESTRINGS_CONST_DEF(char*, Expected_argument_of_type_unsigned_integer, "Expected argument of type unsigned integer");
TIMESSAGESTRINGS_CONST_DEF(char*, INTERNAL__An_error_occurred_while_parsing_the_format_string, "INTERNAL: An error occurred while parsing the format string");

TIMESSAGESTRINGS_CONST_DEF(char*, Missing_argument, "Missing argument");
TIMESSAGESTRINGS_CONST_DEF(char*, Too_many_arguments, "Too many arguments");

}
}

#endif // TIMESSAGESTRINGS_H_
4 changes: 3 additions & 1 deletion blackberry/tibb/TiPropertyGetFunctionObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "TiPropertyGetFunctionObject.h"

#include "TiMessageStrings.h"

TiPropertyGetFunctionObject::TiPropertyGetFunctionObject(const char* name)
: TiObject(name)
{
Expand Down Expand Up @@ -37,7 +39,7 @@ Handle<Value> TiPropertyGetFunctionObject::onFunctionCall(const Arguments& args)
if (args.Length() != 0)
{
// TODO: expand this exception message
return ThrowException(String::New("too many arguments"));
return ThrowException(String::New(Ti::Msg::Too_many_arguments));
}
return handleScope.Close(property_->getValue());
}
4 changes: 3 additions & 1 deletion blackberry/tibb/TiPropertySetFunctionObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "TiPropertySetFunctionObject.h"

#include "TiMessageStrings.h"

TiPropertySetFunctionObject::TiPropertySetFunctionObject(const char* name)
: TiObject(name)
{
Expand Down Expand Up @@ -35,7 +37,7 @@ Handle<Value> TiPropertySetFunctionObject::onFunctionCall(const Arguments& args)
if (args.Length() < 1)
{
// TODO: expand this exception message
return ThrowException(String::New("missing argument"));
return ThrowException(String::New(Ti::Msg::Missing_argument));
}
property_->setValue(args[0]);
return Undefined();
Expand Down