/*
- * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
*
* The contents of this file constitute Original Code as defined in and are
* subject to the Apple Public Source License Version 1.2 (the 'License').
* specific language governing rights and limitations under the License.
*/
-
-/*
- File: KCCursor.h
-
- Contains: The keychain class
-
- Copyright: 2000 by Apple Computer, Inc., all rights reserved.
-
- To Do:
-*/
-
-#ifndef _H_KCCURSOR_
-#define _H_KCCURSOR_
+//
+// KCCursor.h
+//
+#ifndef _SECURITY_KCCURSOR_H_
+#define _SECURITY_KCCURSOR_H_
#include <Security/StorageManager.h>
namespace KeychainCore
{
-class KCCursor;
-
-class KCCursorImpl : public ReferencedObject
+class KCCursorImpl : public SecCFObject, public CssmAutoQuery
{
NOCOPY(KCCursorImpl)
+public:
+ SECCFFUNCTIONS(KCCursorImpl, SecKeychainSearchRef, errSecInvalidSearchRef)
+
friend class KCCursor;
protected:
- KCCursorImpl(const CssmClient::DbCursor &dbCursor, SecItemClass itemClass, const SecKeychainAttributeList *attrList);
- KCCursorImpl(const CssmClient::DbCursor &dbCursor, const SecKeychainAttributeList *attrList);
+ KCCursorImpl(const StorageManager::KeychainList &searchList, SecItemClass itemClass, const SecKeychainAttributeList *attrList);
+ KCCursorImpl(const StorageManager::KeychainList &searchList, const SecKeychainAttributeList *attrList);
public:
- virtual ~KCCursorImpl();
+ virtual ~KCCursorImpl() throw();
bool next(Item &item);
private:
+ StorageManager::KeychainList mSearchList;
+ StorageManager::KeychainList::iterator mCurrent;
CssmClient::DbCursor mDbCursor;
+ bool mAllFailed;
};
-class KCCursor : public RefPointer<KCCursorImpl>
+class KCCursor : public SecPointer<KCCursorImpl>
{
public:
KCCursor() {}
- KCCursor(KCCursorImpl *impl) : RefPointer<KCCursorImpl>(impl) {}
+ KCCursor(KCCursorImpl *impl) : SecPointer<KCCursorImpl>(impl) {}
- KCCursor(const CssmClient::DbCursor &dbCursor, const SecKeychainAttributeList *attrList)
- : RefPointer<KCCursorImpl>(new KCCursorImpl(dbCursor, attrList)) {}
+ KCCursor(const StorageManager::KeychainList &searchList, const SecKeychainAttributeList *attrList)
+ : SecPointer<KCCursorImpl>(new KCCursorImpl(searchList, attrList)) {}
- KCCursor(const CssmClient::DbCursor &dbCursor, SecItemClass itemClass, const SecKeychainAttributeList *attrList)
- : RefPointer<KCCursorImpl>(new KCCursorImpl(dbCursor, itemClass, attrList)) {}
+ KCCursor(const StorageManager::KeychainList &searchList, SecItemClass itemClass, const SecKeychainAttributeList *attrList)
+ : SecPointer<KCCursorImpl>(new KCCursorImpl(searchList, itemClass, attrList)) {}
typedef KCCursorImpl Impl;
};
-typedef Ref<KCCursor, KCCursorImpl, SecKeychainSearchRef, errSecInvalidSearchRef> KCCursorRef;
-
} // end namespace KeychainCore
} // end namespace Security
-#endif /* _H_KCCURSOR_ */
-
+#endif // !_SECURITY_KCCURSOR_H_