root/Trunk/AIUtilities.framework/Versions/A/Headers/AIWiredString.h @ 2

Revision 2, 3.1 KB (checked in by jon, 16 years ago)

Initial commit of skeletal project.

Line 
1/*-------------------------------------------------------------------------------------------------------*\
2| Adium, Copyright (C) 2001-2005, Adam Iser  (adamiser@mac.com | http://www.adiumx.com)                   |
3\---------------------------------------------------------------------------------------------------------/
4 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU
5 | General Public License as published by the Free Software Foundation; either version 2 of the License,
6 | or (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
10 | Public License for more details.
11 |
12 | You should have received a copy of the GNU General Public License along with this program; if not,
13 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
14 \------------------------------------------------------------------------------------------------------ */
15//
16//  AIWiredString.h
17//  AIUtilities.framework
18//
19//  Created by Mac-arena the Bored Zo on 2005-02-16.
20//
21
22#import <Cocoa/Cocoa.h>
23
24@class AIWiredData;
25
26/*!     @class AIWiredString AIWiredString.h <AIUtilities/AIWiredString.h>
27
28 *      @brief A concrete, immutable subclass of NSString that uses wired memory for its backing.
29 *
30 *      @par
31 *      When storing passwords, you do not want the password to be paged out to disk, where it could be obtained using data-recovery techniques (e.g. DriveSavers).
32 *      Memory that has been "wired" cannot be paged out to disk. Therefore wired memory should be used for short-term storage of passwords.
33 *      This class stores textual data in a wired backing, so that it will not be paged to disk.
34 *      The AIWiredString instance itself may still be paged out, but this is of no value after the machine has been shut down (e.g. to remove the HDD to search it), because the secret information will no longer be in memory.
35 *
36 *      @par
37 *      You should obtain the characters using <code>-dataUsingEncoding:allowLossyConversion:</code>, <code>-dataUsingEncoding:</code>, or <code>-UTF8String</code>, because these methods return an \c AIWiredData. You can also use <code>-getCharacters:</code> or <code>-getCharacters:range:</code>, but you will need to allocate and wire the memory yourself.
38 *
39 *      @see AIWiredData
40 */
41
42@interface AIWiredString : NSString
43{
44        unichar *backing;
45        size_t length;
46}
47
48/*!     @brief Returns wired-in-memory data for the characters of the string.
49 *
50 *      If \a flag is \c YES, characters may be munged to fit into the encoding (for example, by dropping accent marks).
51 *
52 *      @return An AIWiredData containing the characters in the requested encoding.
53 */
54- (AIWiredData *)dataUsingEncoding:(NSStringEncoding)inEncoding allowLossyConversion:(BOOL)flag;
55/*!     @brief Returns wired-in-memory data for the characters of the string.
56 *
57 *      Does not allow lossy conversion.
58 *
59 *      @return An AIWiredData containing the characters in the requested encoding.
60 */
61- (AIWiredData *)dataUsingEncoding:(NSStringEncoding)inEncoding;
62
63@end
Note: See TracBrowser for help on using the browser.