Signal-iOS/SignalServiceKit/src/Storage/Database/SDSDatabaseStorage+Objc.h
2020-06-12 13:49:52 -07:00

33 lines
1.8 KiB
Objective-C

//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
// All Obj-c database storage writes should be done using these macros.
// They capture the logging info.
@class SDSAnyWriteTransaction;
@class SDSTransactable;
typedef void (^SDSWriteBlock)(SDSAnyWriteTransaction *);
typedef void (^SDSWriteCompletion)(void);
void __SDSTransactableWrite(
SDSTransactable *transactable, SDSWriteBlock _block, NSString *_file, NSString *_function, uint32_t _line);
void __SDSTransactableAsyncWrite(
SDSTransactable *transactable, SDSWriteBlock _block, NSString *_file, NSString *_function, uint32_t _line);
#define DatabaseStorageWrite(__databaseStorage, __block) \
__SDSTransactableWrite(__databaseStorage, \
__block, \
[NSString stringWithUTF8String:__FILE__], \
[NSString stringWithUTF8String:__PRETTY_FUNCTION__], \
__LINE__);
#define DatabaseStorageAsyncWrite(__databaseStorage, __block) \
__SDSTransactableAsyncWrite(__databaseStorage, \
__block, \
[NSString stringWithUTF8String:__FILE__], \
[NSString stringWithUTF8String:__PRETTY_FUNCTION__], \
__LINE__);