forked from textmate/dialog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dialog2.h
40 lines (30 loc) · 1.48 KB
/
Dialog2.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
#ifndef _DIALOG_H_
#define _DIALOG_H_
#define DialogServerConnectionName @"com.macromates.dialog"
@protocol DialogServerProtocol
- (void)connectFromClientWithOptions:(id)anArgument;
@end
#ifndef enumerate
#define enumerate(container,var) for(NSEnumerator* _enumerator = [container objectEnumerator]; var = [_enumerator nextObject]; )
#endif
inline char const* beginof (char const* cStr) { return cStr; }
inline char const* endof (char const* cStr) { return cStr + strlen(cStr); }
template <typename T, int N> T* beginof (T (&a)[N]) { return a; }
template <typename T, int N> T* endof (T (&a)[N]) { return a + N; }
template <typename T, int N, int M> T (*beginof(T (&m)[N][M]))[M] { return m; }
template <typename T, int N, int M> T (*endof(T (&m)[N][M]))[M] { return m + N; }
template <class T> typename T::const_iterator beginof (T const& c) { return c.begin(); }
template <class T> typename T::const_iterator endof (T const& c) { return c.end(); }
template <class T> typename T::iterator beginof (T& c) { return c.begin(); }
template <class T> typename T::iterator endof (T& c) { return c.end(); }
#ifndef foreach
#define foreach(v,f,l) for(decltype(f) v = (f), _end = (l); v != _end; ++v)
#endif
#ifndef iterate
#define iterate(v,c) foreach(v, beginof(c), endof(c))
#endif
#ifndef sizeofA
#define sizeofA(a) (sizeof(a)/sizeof(a[0]))
#endif
#define ErrorAndReturn(message) while(1){[proxy writeStringToError:@"Error: " message "\n"];return;};
#endif /* _DIALOG_H_ */