Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:280north/cappuccino
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Ryan Tolmasky I committed May 31, 2009
2 parents f4b4d38 + f46aa87 commit b1c410d
Show file tree
Hide file tree
Showing 33 changed files with 234 additions and 78 deletions.
2 changes: 0 additions & 2 deletions AppKit/CPOpenPanel.j
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ var SharedOpenPanel = nil;
- (unsigned)runModalForDirectory:(CPString)absoluteDirectoryPath file:(CPString)filename types:(CPArray)fileTypes
{
#if PLATFORM(DOM)
console.log("0 "+Titanium);
console.log("1 "+window.Titanium);
if (window.Titanium)
{
_files = Titanium.Desktop.openFiles({
Expand Down
1 change: 1 addition & 0 deletions AppKit/CPPasteboard.j
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ CPHTMLPboardType = @"CPHTMLPboardType";
CPStringPboardType = @"CPStringPboardType";
CPURLPboardType = @"CPURLPboardType";
CPImagePboardType = @"CPImagePboardType";
CPVideoPboardType = @"CPVideoPboardType";

var CPPasteboards = nil;

Expand Down
7 changes: 6 additions & 1 deletion Foundation/CPArray.j
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@
@end

/*!
@ingroup foundation
@class CPArray
@brief A mutable array backed by a JavaScript Array.
@ingroup foundation
A mutable array class backed by a JavaScript Array.
There is also a CPMutableArray class,
but it is just a child class of this class with an
Expand Down Expand Up @@ -1192,6 +1194,9 @@
@end

/*!
@class CPMutableArray
@ingroup compatability
This class is just an empty subclass of CPArray.
CPArray already implements mutable methods and
this class only exists for source compatability.
Expand Down
18 changes: 15 additions & 3 deletions Foundation/CPAttributedString.j
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
@import "CPDictionary.j"
@import "CPRange.j"

/*! @class CPAttributedString
/*!
@class CPAttributedString
@ingroup foundation
@brief A mutable character string with attributes.
Expand Down Expand Up @@ -486,8 +487,11 @@
//Changing Characters
/*!
Replaces the characters in the receiver with those of the specified string
over the range, <code>aRange</code>. The new characters inherit the
attributes of the first character in the range that they replace.
over the range, <code>aRange</code>. If the range has a length of 0 then
the specified string is inserted at the range location. The new characters
inherit the attributes of the first character in the range that they
replace or in the case if a 0 range length, the first character before of
after the insert (after if the insert is at location 0).
@note the replacement string need not be the same length as the range
being replaced. The full <code>aString</code> is inserted and thus the
receiver's length changes to match this
Expand Down Expand Up @@ -794,6 +798,14 @@

@end

/*!
@class CPMutableAttributedString
@ingroup compatability
This class is just an empty subclass of CPAttributedString.
CPAttributedString already implements mutable methods and
this class only exists for source compatability.
*/
@implementation CPMutableAttributedString : CPAttributedString {}
@end

Expand Down
2 changes: 2 additions & 0 deletions Foundation/CPBundle.j
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
@import "CPURLRequest.j"

/*!
@class CPBundle
@ingroup foundation
@brief Groups information about an application's code & resources.
*/

@implementation CPBundle : CPObject
Expand Down
4 changes: 3 additions & 1 deletion Foundation/CPCoder.j
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@


/*!
@ingroup foundation
@class CPCoder
@ingroup foundation
@brief Defines methods for use when archiving & restoring (enc/decoding).
Top-level class defining methods for use when archiving (encoding) objects to a byte array
or file, and when restoring (decoding) objects.
*/
Expand Down
26 changes: 25 additions & 1 deletion Foundation/CPCountedSet.j
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
/*
* CPCountedSet.j
* Foundation
*
* Created by .
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

@import "CPSet.j"

/*!
/*!
@class CPCountedSet
@ingroup foundation
@brief An mutable collection which may contain a specific object
numerous times.
*/
@implementation CPCountedSet : CPMutableSet
{
Expand Down
6 changes: 5 additions & 1 deletion Foundation/CPData.j
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
@import "CPObject.j"
@import "CPString.j"

/*!
/*!
@class CPData
@ingroup foundation
@brief A Cappuccino wrapper for any data type.
*/

@implementation CPData : CPObject
Expand Down
8 changes: 6 additions & 2 deletions Foundation/CPDate.j
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* CPObject.j
* CPDate.j
* Foundation
*
* Created by Thomas Robinson.
Expand All @@ -26,8 +26,12 @@

var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));

/*!
/*!
@class CPDate
@ingroup foundation
@brief A representation of a single point in time.
*/
@implementation CPDate : CPObject
{
Expand Down
31 changes: 18 additions & 13 deletions Foundation/CPDictionary.j
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@

@end

/*!
@ingroup foundation
/*!
@class CPDictionary
A dictionary is the standard way of passing around key-value pairs in
the Cappuccino framework. It is similar to the
<a href="http://java.sun.com/javase/6/docs/api/index.html">Java map interface</a>,
except all keys are CPStrings and values can be any
Cappuccino or JavaScript object.</p>
<p>If you are familiar with dictionaries in Cocoa, you'll notice that
there is no CPMutableDictionary class. The regular CPDictionary
has <code>setObject:</code> and <code>removeObjectForKey:</code> methods.
In Cappuccino there is no distinction between immutable and mutable classes.
They are all mutable.
@ingroup foundation
@brief A mutable key-value pair collection.
A dictionary is the standard way of passing around key-value pairs in
the Cappuccino framework. It is similar to the
<a href="http://java.sun.com/javase/6/docs/api/index.html">Java map interface</a>,
except all keys are CPStrings and values can be any
Cappuccino or JavaScript object.
If you are familiar with dictionaries in Cocoa, you'll notice that
there is no CPMutableDictionary class. The regular CPDictionary
has <code>setObject:</code> and <code>removeObjectForKey:</code> methods.
In Cappuccino there is no distinction between immutable and mutable classes.
They are all mutable.
*/
@implementation CPDictionary : CPObject
{
Expand Down Expand Up @@ -595,6 +597,9 @@
@end

/*!
@class CPMutableDictionary
@ingroup compatability
This class is just an empty subclass of CPDictionary.
CPDictionary already implements mutable methods and
this class only exists for source compatability.
Expand Down
10 changes: 7 additions & 3 deletions Foundation/CPEnumerator.j
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
@import "CPObject.j"

/*!
@ingroup foundation
*/

/*! @class CPEnumerator
/*!
@class CPEnumerator
@ingroup foundation
@brief Defines an interface for enumerators.
CPEnumerator is a superclass (with useless method bodies)
that defines an interface for subclasses to follow. The purpose of an
enumerator is to be a convenient system for traversing over the elements
Expand All @@ -52,4 +56,4 @@
return [];
}

@end
@end
4 changes: 3 additions & 1 deletion Foundation/CPException.j
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ CPRangeException = "CPRangeException";
CPInternalInconsistencyException = "CPInternalInconsistencyException";

/*!
@ingroup foundation
@class CPException
@ingroup foundation
@brief Used to implement exception handling (creating & raising).
An example of throwing an exception in Objective-J:
<pre>
// some code here...
Expand Down
10 changes: 8 additions & 2 deletions Foundation/CPIndexSet.j
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@


/*!
@ingroup foundation
@class CPIndexSet
Instances of this class are collections of numbers. Each integer can appear in a collection only once.
@ingroup foundation
@brief A collection of unique integers.
Instances of this class are collections of numbers. Each integer can appear
in a collection only once.
*/
@implementation CPIndexSet : CPObject
{
Expand Down Expand Up @@ -816,6 +819,9 @@ var CPIndexSetCountKey = @"CPIndexSetCountKey",
@end

/*!
@class CPMutableIndexSet
@ingroup compatability
This class is an empty of subclass of CPIndexSet.
CPIndexSet already implements mutable methods, and
this class only exists for source compatability.
Expand Down
4 changes: 3 additions & 1 deletion Foundation/CPInvocation.j
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@


/*!
@ingroup foundation
@class CPInvocation
@ingroup foundation
@brief An object representation of a message.
A CPInvocation is an object representation of a message sent to an object.
*/
@implementation CPInvocation : CPObject
Expand Down
43 changes: 28 additions & 15 deletions Foundation/CPJSONPConnection.j
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

CPJSONPConnectionCallbacks = {};

CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";

/*!
@ingroup foundation
*/
@brief Allows cross domain connections using JSONP protocol.
/*! @class CPJSONPConnection
Important note: CPJSONPConnection is <strong>only</strong> for JSONP APIs.
If aren't sure you <strong>need</strong>
<a href="http://ajaxian.com/archives/jsonp-json-with-padding">JSON<strong>P</strong></a>,
Expand Down Expand Up @@ -72,13 +73,8 @@ CPJSONPConnectionCallbacks = {};

_callbackParameter = aString;

CPJSONPConnectionCallbacks["callback"+[self hash]] = function(data)
{
[_delegate connection:self didReceiveData:data];
[self removeScriptTag];

[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
};
if (!_callbackParameter && [_request URL].indexOf(CPJSONPCallbackReplacementString) < 0)
[CPException raise:CPInvalidArgumentException reason:@"JSONP source specified without callback parameter or CPJSONPCallbackReplacementString in URL."];

if(shouldStartImmediately)
[self start];
Expand All @@ -90,12 +86,29 @@ CPJSONPConnectionCallbacks = {};
{
try
{
var head = document.getElementsByTagName("head").item(0);
CPJSONPConnectionCallbacks["callback"+[self hash]] = function(data)
{
[_delegate connection:self didReceiveData:data];
[self removeScriptTag];

[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
};

var head = document.getElementsByTagName("head").item(0),
source = [_request URL];

if (_callbackParameter)
{
source += (source.indexOf('?') < 0) ? "?" : "&";
source += _callbackParameter+"=CPJSONPConnectionCallbacks.callback"+[self hash];
}
else if (source.indexOf(CPJSONPCallbackReplacementString) >= 0)
{
source = [source stringByReplacingOccurrencesOfString:CPJSONPCallbackReplacementString withString:"CPJSONPConnectionCallbacks.callback"+[self hash]];
}
else
return;

var source = [_request URL];
source += (source.indexOf('?') < 0) ? "?" : "&";
source += _callbackParameter+"=CPJSONPConnectionCallbacks.callback"+[self hash];

_scriptTag = document.createElement("script");
_scriptTag.setAttribute("type", "text/javascript");
_scriptTag.setAttribute("charset", "utf-8");
Expand All @@ -114,7 +127,7 @@ CPJSONPConnectionCallbacks = {};
{
var head = document.getElementsByTagName("head").item(0);

if(_scriptTag.parentNode == head)
if(_scriptTag && _scriptTag.parentNode == head)
head.removeChild(_scriptTag);

CPJSONPConnectionCallbacks["callback"+[self hash]] = nil;
Expand Down
5 changes: 3 additions & 2 deletions Foundation/CPKeyedArchiver.j
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ var _CPKeyedArchiverStringClass = Nil,
}
@end

/*!
@ingroup foundation
/*!
@class CPKeyedArchiver
@ingroup foundation
@brief Implements keyed archiving of object graphs (e.g. for storing data).
Implements keyed archiving of object graphs. Archiving means to
write data out in a format that be read in again later, or possibly
Expand Down
2 changes: 2 additions & 0 deletions Foundation/CPKeyedUnarchiver.j
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ var _CPKeyedUnarchiverArrayClass = Ni
_CPKeyedUnarchiverArchiverValueClass = Nil;

/*!
@class CPKeyedUnarchiver
@ingroup foundation
@brief Unarchives objects created using CPKeyedArchiver.
CPKeyedUnarchiver is used for creating objects out of
coded files or CPData objects that were created by
Expand Down

0 comments on commit b1c410d

Please sign in to comment.