API  0.9.10
CPCibRuntimeAttributesConnector.j
Go to the documentation of this file.
1 /*
2  * CPCibRuntimeAttributesConnector.j
3  * AppKit
4  *
5  * Created by Aparajita Fishman.
6  * Copyright 2012, The Cappuccino Project.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
24 var CPCibRuntimeAttributesConnectorObjectKey = @"CPCibRuntimeAttributesConnectorObjectKey",
25  CPCibRuntimeAttributesConnectorKeyPathsKey = @"CPCibRuntimeAttributesConnectorKeyPathsKey",
26  CPCibRuntimeAttributesConnectorValuesKey = @"CPCibRuntimeAttributesConnectorValuesKey";
27 
29 {
30  id _keyPaths;
31  id _values;
32 }
33 
34 - (id)initWithCoder:(CPCoder)aCoder
35 {
36  if (self = [super initWithCoder:aCoder])
37  {
38  _source = [aCoder decodeObjectForKey:CPCibRuntimeAttributesConnectorObjectKey];
39  _keyPaths = [aCoder decodeObjectForKey:CPCibRuntimeAttributesConnectorKeyPathsKey];
40  _values = [aCoder decodeObjectForKey:CPCibRuntimeAttributesConnectorValuesKey];
41  }
42 
43  return self;
44 }
45 
46 - (void)encodeWithCoder:(CPCoder)aCoder
47 {
48  [super encodeWithCoder:aCoder];
49 
50  [aCoder encodeObject:_source forKey:CPCibRuntimeAttributesConnectorObjectKey];
51  [aCoder encodeObject:_keyPaths forKey:CPCibRuntimeAttributesConnectorKeyPathsKey];
52  [aCoder encodeObject:_values forKey:CPCibRuntimeAttributesConnectorValuesKey];
53 }
54 
56 {
57  var count = [_keyPaths count];
58 
59  while (count--)
60  [_source setValue:_values[count] forKeyPath:_keyPaths[count]];
61 }
62 
63 @end
var CPCibRuntimeAttributesConnectorValuesKey
var CPCibRuntimeAttributesConnectorObjectKey
Defines methods for use when archiving & restoring (enc/decoding).
Definition: CPCoder.h:2
void encodeWithCoder:(CPCoder aCoder)
var CPCibRuntimeAttributesConnectorKeyPathsKey