cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject [1/2] mac commit: @trivial add all console methods
Date Tue, 25 Aug 2015 21:15:27 GMT
Repository: cordova-osx
Updated Branches:
  refs/heads/master 764313e9d -> 3722eac36


@trivial add all console methods


Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/0c2adb0c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/0c2adb0c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/0c2adb0c

Branch: refs/heads/master
Commit: 0c2adb0c8d9b9727577107b5c2ea073062d603c9
Parents: 764313e
Author: Tobias Bocanegra <tripod@adobe.com>
Authored: Mon Aug 24 22:15:44 2015 -0700
Committer: Tobias Bocanegra <tripod@adobe.com>
Committed: Mon Aug 24 22:15:44 2015 -0700

----------------------------------------------------------------------
 .../CordovaLib/Classes/Commands/CDVConsole.h    | 11 ++-
 .../CordovaLib/Classes/Commands/CDVConsole.m    | 82 +++++++++++---------
 2 files changed, 55 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/0c2adb0c/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.h b/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.h
index bb44368..c658307 100644
--- a/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.h
+++ b/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.h
@@ -6,9 +6,9 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
- 
+
  http://www.apache.org/licenses/LICENSE-2.0
- 
+
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,9 +21,14 @@
 
 
 @interface CDVConsole : NSObject {
-	
+
 }
 
 - (void) log:(NSString*)message;
+- (void) trace:(NSString*)message;
+- (void) debug:(NSString*)message;
+- (void) info:(NSString*)message;
+- (void) warn:(NSString*)message;
+- (void) error:(NSString*)message;
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/0c2adb0c/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.m b/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.m
index fc4b879..988f5b1 100644
--- a/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.m
+++ b/CordovaLib/CordovaLib/Classes/Commands/CDVConsole.m
@@ -6,9 +6,9 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
- 
+
  http://www.apache.org/licenses/LICENSE-2.0
- 
+
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -28,48 +28,60 @@
     NSLog(@"%@", message);
 }
 
+- (void) trace:(NSString*) message {
+    NSLog(@"trace: %@", message);
+}
+
+- (void) debug:(NSString*) message {
+    NSLog(@"debug: %@", message);
+}
+
+- (void) info:(NSString*) message {
+    NSLog(@"info: %@", message);
+}
+
+- (void) warn:(NSString*) message {
+    NSLog(@"warn: %@", message);
+}
+
+- (void) error:(NSString*) message {
+    NSLog(@"error: %@", message);
+}
+
 #pragma mark WebScripting Protocol
 
 /* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
-	BOOL	result = YES;
-	
-	int			i = 0;
-	static SEL	* acceptableList = NULL;
-	SEL			currentSelector;
-	
-	if (acceptableList == NULL && (acceptableList = calloc(256, sizeof(SEL))))	// up
to 256 selectors
-	{
-		acceptableList[i++] = @selector(log:);
-	}
-	
-	i = 0;
-	while (result == YES && (currentSelector = acceptableList[i++]))
-	{
-		//checking for exclusions
-		result = !(selector == currentSelector);
-	}
-	
-	return result;
++ (BOOL) isSelectorExcludedFromWebScript:(SEL) sel {
+    return sel != @selector(log:) &&
+            sel != @selector(trace:) &&
+            sel != @selector(debug:) &&
+            sel != @selector(info:) &&
+            sel != @selector(warn:) &&
+            sel != @selector(error:);
 }
 
 /* helper function so we don't have to have underscores and stuff in js to refer to the right
method */
-+ (NSString*) webScriptNameForSelector:(SEL)aSelector
-{
-	id	result = nil;
-	
-	if (aSelector == @selector(log:)) {
-		result = @"log";
-	}
-	
-	return result;
++ (NSString*) webScriptNameForSelector:(SEL) sel {
+    if (sel == @selector(log:)) {
+        return @"log";
+    } else if (sel == @selector(trace:)) {
+        return @"trace";
+    } else if (sel == @selector(debug:)) {
+        return @"debug";
+    } else if (sel == @selector(info:)) {
+        return @"info";
+    } else if (sel == @selector(warn:)) {
+        return @"warn";
+    } else if (sel == @selector(error:)) {
+        return @"error";
+    } else {
+        return nil;
+    }
 }
 
 // right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
-	return YES;
++ (BOOL) isKeyExcludedFromWebScript:(const char*)name {
+    return YES;
 }
 
 @end


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message