Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
//
//  CommonsDefines.h
//  DECommonsFramework
//
//  Created by Marco Bonati on 03/02/2017.
//  Copyright © 2017 Vipera. All rights reserved.
//

#ifndef CommonsDefines_h
#define CommonsDefines_h

/**
 * LOGGING
 */

#define GENERAL_LOG_ACTIVE

// General Log
#ifdef GENERAL_LOG_ACTIVE
#define LOG(format, ...) if ([[DEConfigurationService currentConfiguration] areLogEnabled]) {NSLog(@"\n\n»» %@ - %@ ««\n\n%@\n\n",NSStringFromClass([self class]), NSStringFromSelector(_cmd), [NSString stringWithFormat:format, ## __VA_ARGS__]);}
#else
#define LOG(format, ...)
#endif

// JSON LOG
#ifdef JSONLOG_ACTIVE
#define JSLOG(format, ...) if([[DEConfigurationService currentConfiguration] areLogEnabled]){NSLog(@"\n\n»» %@ - %@ ««\n\n%@\n\n",NSStringFromClass([self class]), NSStringFromSelector(_cmd), [NSString stringWithFormat:format, ## __VA_ARGS__]);}
#else
#define JSLOG(format, ...)
#endif

/**
 * SHORTCUTS
 */

#define EMPTY_STRING                @""
#define EMPTY_OR_NULL_STRING(string)    (string == nil || [string isEqualToString:@""])

#define JS_STRING_OR_NULL(string)       string ? string : @"null"
#define JS_NUMBER_OR_NULL(number)       number ? [number stringValue] : @"null"
#define IF_NIL_TO_NSNULL(value)         value ? value : [NSNull null]
#define IF_NSNULL_NIL(value)            [value isEqual:[NSNull null]] ? nil : value

#define CFSafeRelease(reference)    if (reference != NULL) {CFRelease(reference);}

/**
 * BLOCK DEFINITIONS
 */

typedef void(^VoidBlock)();

#endif /* CommonsDefines_h */