Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
805 - 1
//
2
// Copyright 2009-2010 Facebook
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
//    http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
//
16
 
17
/**
18
 * Borrowed from Apple's AvailabiltyInternal.h header. There's no reason why we shouldn't be
19
 * able to use this macro, as it's a gcc-supported flag.
20
 * Here's what we based it off of.
21
 * __AVAILABILITY_INTERNAL_DEPRECATED         __attribute__((deprecated))
22
 */
23
#define __TTDEPRECATED_METHOD __attribute__((deprecated))
24
 
25
///////////////////////////////////////////////////////////////////////////////////////////////////
26
// Errors
27
 
28
#define TT_ERROR_DOMAIN @"three20.net"
29
 
30
#define TT_EC_INVALID_IMAGE 101
31
 
32
 
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34
// Flags
35
 
36
/**
37
 * For when the flag might be a set of bits, this will ensure that the exact set of bits in
38
 * the flag have been set in the value.
39
 */
40
#define IS_MASK_SET(value, flag)  (((value) & (flag)) == (flag))
41
 
42
 
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44
// Time
45
 
46
#define TT_MINUTE 60
47
#define TT_HOUR   (60 * TT_MINUTE)
48
#define TT_DAY    (24 * TT_HOUR)
49
#define TT_WEEK   (7 * TT_DAY)
50
#define TT_MONTH  (30.5 * TT_DAY)
51
#define TT_YEAR   (365 * TT_DAY)
52
 
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54
// Safe releases
55
 
56
#define TT_RELEASE_SAFELY(__POINTER) { [__POINTER release]; __POINTER = nil; }
57
#define TT_INVALIDATE_TIMER(__TIMER) { [__TIMER invalidate]; __TIMER = nil; }
58
 
59
// Release a CoreFoundation object safely.
60
#define TT_RELEASE_CF_SAFELY(__REF) { if (nil != (__REF)) { CFRelease(__REF); __REF = nil; } }