//
// IMFunctions.m
// LiveProject
//
// Created by haibara on 9/25/15.
//
//

#import "IMFunctions.h"

@implementation IMFunctions
@end

CGRect CGRectSetWidth(CGRect rect, CGFloat width) {
	return CGRectMake(rect.origin.x, rect.origin.y, width, rect.size.height);
}

CGRect CGRectSetHeight(CGRect rect, CGFloat height) {
	return CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, height);
}

CGRect CGRectSetSize(CGRect rect, CGSize size) {
	return CGRectMake(rect.origin.x, rect.origin.y, size.width, size.height);
}

CGRect CGRectSetX(CGRect rect, CGFloat x) {
	return CGRectMake(x, rect.origin.y, rect.size.width, rect.size.height);
}

CGRect CGRectSetY(CGRect rect, CGFloat y) {
	return CGRectMake(rect.origin.x, y, rect.size.width, rect.size.height);
}

CGRect CGRectSetOrigin(CGRect rect, CGPoint origin) {
	return CGRectMake(origin.x, origin.y, rect.size.width, rect.size.height);
}

CGRect CGRectZeroMakeSize(CGSize size) {
	return CGRectMake(0, 0, size.width, size.height);
}

CGRect CGRectInsetSize(CGSize size, CGFloat dx, CGFloat dy) {
	return CGRectInset(CGRectZeroMakeSize(size), dx, dy);
}

BOOL CLLocationCoordinate2DEqualToCoordinate(CLLocationCoordinate2D coord1, CLLocationCoordinate2D coord2) {
	return coord1.latitude == coord2.latitude && coord1.longitude == coord2.longitude;
}

NSString *NSStringFromCLLocationCoordinate2D(CLLocationCoordinate2D coord) {
	return NSStringFromCGPoint(CGPointMake(coord.latitude, coord.longitude));
}

NSOperatingSystemVersion NSOperatingSystemVersionMake(NSInteger majorVersion, NSInteger minorVersion, NSInteger patchVersion) {
	NSOperatingSystemVersion operatingSystemVersion;
	operatingSystemVersion.majorVersion = majorVersion;
	operatingSystemVersion.minorVersion = minorVersion;
	operatingSystemVersion.patchVersion = patchVersion;
	return operatingSystemVersion;
}
