forked from quicksilver/Plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CFAliasAndNameArray.h
executable file
·59 lines (48 loc) · 2.16 KB
/
CFAliasAndNameArray.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//**************************************************************************************
// Filename: CFAliasAndNameArray.h
// Part of Contextual Menu Workshop by Abracode Inc.
// http://free.abracode.com/cmworkshop/
// Copyright © 2002-2003 Abracode, Inc. All rights reserved.
//
// Description: CFArray-based list of aliases
// Design goals:
// - not to throw
// - unique aliases (not to allow aliases pointing to the same object)
// - load and save aliases to preferences file via CFPreferences
// - access items (Add & Fetch) via FSRef
// - the object does own the array and deletes it
//
//**************************************************************************************
// Revision History:
// Monday, August 19, 2002 - Original
//**************************************************************************************
#pragma once
#if defined(__MACH__)
#include <Carbon/Carbon.h>
#else
#include <CFArray.h>
#endif //defined(__MACH__)
#include "CFDictArray.h"
class CFAliasAndNameArray : public CFDictArray
{
public:
CFAliasAndNameArray() { }
CFAliasAndNameArray(CFStringRef inKey, CFStringRef inPrefsIdentifier, CFIndex theVer);
CFAliasAndNameArray(CFMutableArrayRef inArray, bool inDoRetain = true)
: CFDictArray(inArray, inDoRetain)
{
}
CFAliasAndNameArray(const CFAliasAndNameArray& inArray); // copy constructor
virtual ~CFAliasAndNameArray() { }
CFAliasAndNameArray& operator=(const CFAliasAndNameArray& inArray); // copy assignment
void AddPair(const FSRef *inRef, CFStringRef inName);
void InsertPairAt(const FSRef *inRef, CFStringRef inName, CFIndex inIndex);
Boolean FetchFSRefAt(CFIndex inIndex, FSRef &outRef) const;
Boolean FetchFSRefWithMountingAt(CFIndex inIndex, FSRef &outRef) const;
CFStringRef FetchNameAt(CFIndex inIndex) const;
void SetNameAt(CFStringRef inName, CFIndex inIndex);
void SetFSRefAt(const FSRef &inRef, CFIndex inIndex);
CFDataRef FetchAliasDataAt(CFIndex inIndex);
void SetAliasDataAt(CFDataRef inData, CFIndex inIndex);
void LoadArrayFromPrefsVersion1(CFStringRef inKey, CFStringRef inPrefsIdentifier);
};