]> git.saurik.com Git - apple/security.git/blob - Keychain/KCCursor.h
Security-30.1.tar.gz
[apple/security.git] / Keychain / KCCursor.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 /*
20 File: KCCursor.h
21
22 Contains: The keychain class
23
24 Copyright: 2000 by Apple Computer, Inc., all rights reserved.
25
26 To Do:
27 */
28
29 #ifndef _H_KCCURSOR_
30 #define _H_KCCURSOR_
31
32 #include <Security/StorageManager.h>
33
34 namespace Security
35 {
36
37 namespace KeychainCore
38 {
39
40 class KCCursor;
41
42 class KCCursorImpl : public ReferencedObject
43 {
44 NOCOPY(KCCursorImpl)
45 friend class KCCursor;
46 protected:
47 KCCursorImpl(const CssmClient::DbCursor &dbCursor, SecItemClass itemClass, const SecKeychainAttributeList *attrList);
48 KCCursorImpl(const CssmClient::DbCursor &dbCursor, const SecKeychainAttributeList *attrList);
49
50 public:
51 virtual ~KCCursorImpl();
52 bool next(Item &item);
53
54 private:
55 CssmClient::DbCursor mDbCursor;
56 };
57
58
59 class KCCursor : public RefPointer<KCCursorImpl>
60 {
61 public:
62 KCCursor() {}
63
64 KCCursor(KCCursorImpl *impl) : RefPointer<KCCursorImpl>(impl) {}
65
66 KCCursor(const CssmClient::DbCursor &dbCursor, const SecKeychainAttributeList *attrList)
67 : RefPointer<KCCursorImpl>(new KCCursorImpl(dbCursor, attrList)) {}
68
69 KCCursor(const CssmClient::DbCursor &dbCursor, SecItemClass itemClass, const SecKeychainAttributeList *attrList)
70 : RefPointer<KCCursorImpl>(new KCCursorImpl(dbCursor, itemClass, attrList)) {}
71
72 typedef KCCursorImpl Impl;
73 };
74
75
76 typedef Ref<KCCursor, KCCursorImpl, SecKeychainSearchRef, errSecInvalidSearchRef> KCCursorRef;
77
78 } // end namespace KeychainCore
79
80 } // end namespace Security
81
82 #endif /* _H_KCCURSOR_ */
83