Added the iOS implementation of the FileSystem API.

This commit is contained in:
atanasovg
2014-04-23 18:48:28 +03:00
parent 322591d3ca
commit ce89af2643
7 changed files with 312 additions and 93 deletions

View File

@@ -1,29 +1,24 @@
export module tk {
// TODO: this should be properly organized
export module utils {
export class Collections {
public static stringArrayToStringSet(str: string[]): any {
var hashSet = new java.util.HashSet();
if ("undefined" != typeof str) {
for (var element in str) {
hashSet.add('' + str[element]);
}
}
return hashSet;
}
public static stringSetToStringArray(stringSet: any): string[] {
var arr = [];
if ("undefined" != typeof stringSet) {
var it = stringSet.iterator();
while (it.hasNext()) {
var element = '' + it.next();
arr.push(element);
}
}
return arr;
export class Collections {
public static stringArrayToStringSet(str: string[]): any {
var hashSet = new java.util.HashSet();
if ("undefined" != typeof str) {
for (var element in str) {
hashSet.add('' + str[element]);
}
}
return hashSet;
}
}
public static stringSetToStringArray(stringSet: any): string[] {
var arr = [];
if ("undefined" != typeof stringSet) {
var it = stringSet.iterator();
while (it.hasNext()) {
var element = '' + it.next();
arr.push(element);
}
}
return arr;
}
}

View File

@@ -1,27 +1,22 @@
export module tk {
// TODO: this should be properly organized
export module utils {
export class Collections {
public static jsArrayToNSArray(str: string[]): any {
var arr = new Foundation.NSMutableArray();
if ("undefined" != typeof str) {
for (var element in str) {
arr.addObject(str[element]);
}
}
return arr;
}
public static nsArrayToJSArray(a: any): string[] {
var arr = [];
if ("undefined" != typeof a) {
for (var i = 0; i < a.count(); i++) {
arr.push(a.objectAtIndex(i));
}
}
return arr;
export class Collections {
public static jsArrayToNSArray(str: string[]): any {
var arr = new Foundation.NSMutableArray();
if ("undefined" != typeof str) {
for (var element in str) {
arr.addObject(str[element]);
}
}
return arr;
}
public static nsArrayToJSArray(a: any): string[] {
var arr = [];
if ("undefined" != typeof a) {
for (var i = 0; i < a.count(); i++) {
arr.push(a.objectAtIndex(i));
}
}
return arr;
}
}