blob: 4fdb9233fd4691341e898684f07d8b5d33b562a1 (
plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
|
//
// MCORange.h
// mailcore2
//
// Created by DINH Viêt Hoà on 3/24/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#ifndef __MAILCORE_MCORANGE_H_
#define __MAILCORE_MCORANGE_H_
#import <Foundation/Foundation.h>
#ifdef __cplusplus
#include <MailCore/MCBaseTypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
@class MCOIndexSet;
typedef struct {
// first integer of the range.
uint64_t location;
// length of the range.
uint64_t length;
} MCORange;
// Constants for an emtpy range.
extern MCORange MCORangeEmpty;
// Returns a new range given a location and length.
MCORange MCORangeMake(uint64_t location, uint64_t length);
// Returns an index set that is the result of sustracting a range from a range.
MCOIndexSet * MCORangeRemoveRange(MCORange range1, MCORange range2);
// Returns an index set that is the result of the union a range from a range.
MCOIndexSet * MCORangeUnion(MCORange range1, MCORange range2);
#ifdef __cplusplus
// Returns a C++ range from an Objective-C range.
mailcore::Range MCORangeToMCRange(MCORange range);
// Returns an Objective-C range from a C++ range.
MCORange MCORangeWithMCRange(mailcore::Range range);
#endif
// Returns the intersection of two ranges.
MCORange MCORangeIntersection(MCORange range1, MCORange range2);
// Returns YES if two given ranges have an intersection.
BOOL MCORangeHasIntersection(MCORange range1, MCORange range2);
// Returns left bound of a range.
uint64_t MCORangeLeftBound(MCORange range);
// Returns right bound of a range.
uint64_t MCORangeRightBound(MCORange range);
#ifdef __cplusplus
}
#endif
#endif
|