Commit 04da0e9a authored by j4cbo's avatar j4cbo

Merge pull request #80 from mknejp/feature/no-cpp14

Feature/no cpp14
parents 4edf461a af757b31
......@@ -33,7 +33,7 @@ auto SortItems::toCpp(ObjcType objc) -> CppType
auto SortItems::fromCpp(const CppType& cpp) -> ObjcType
{
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::textsort::SortItems>::getInstance()->get(cpp, [] (const auto& p)
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::textsort::SortItems>::getInstance()->get(cpp, [] (const CppType& p)
{
return [[TXSSortItems alloc] initWithCpp:p];
});
......
......@@ -39,11 +39,26 @@
}
- (IBAction)sort:(id)sender
{
[self sortWithOrder:TXSSortOrderAscending];
}
- (IBAction)reverseSort:(id)sender
{
[self sortWithOrder:TXSSortOrderDescending];
}
- (IBAction)randomSort:(id)sender
{
[self sortWithOrder:TXSSortOrderRandom];
}
- (void)sortWithOrder:(TXSSortOrder)order
{
NSString *str = self.textView.text;
NSArray *strList = [str componentsSeparatedByString:@"\n"];
TXSItemList *list = [[TXSItemList alloc] initWithItems:strList];
[_sortItemInterface sort:TXSSortOrderAscending items:list];
[_sortItemInterface sort:order items:list];
}
- (void)dismissKeyboard
......
......@@ -10,6 +10,7 @@
"sources": [
"../support-lib/jni/djinni_main.cpp",
"<!@(python glob.py generated-src/jni '*.cpp')",
"<!@(python glob.py generated-src/cpp '*.cpp')",
"<!@(python glob.py handwritten-src/cpp '*.cpp')",
],
"include_dirs": [
......@@ -26,8 +27,9 @@
"../support-lib/support_lib.gyp:djinni_objc",
],
"sources": [
"<!@(python glob.py generated-src/objc '*.cpp' '*.mm' '*.m')",
"<!@(python glob.py handwritten-src/cpp '*.cpp')",
"<!@(python glob.py generated-src/objc '*.cpp' '*.mm' '*.m')",
"<!@(python glob.py generated-src/cpp '*.cpp')",
"<!@(python glob.py handwritten-src/cpp '*.cpp')",
],
"include_dirs": [
"generated-src/objc",
......
......@@ -7,4 +7,7 @@
<FileRef
location = "group:../../build_ios/example/libtextsort.xcodeproj">
</FileRef>
<FileRef
location = "group:../../build_ios/support-lib/support_lib.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7531" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
......@@ -16,16 +18,14 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" text="Type the lines to sort" translatesAutoresizingMaskIntoConstraints="NO" id="GOB-Ok-Z2R">
<rect key="frame" x="21" y="58" width="278" height="429"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Type the lines to sort" translatesAutoresizingMaskIntoConstraints="NO" id="GOB-Ok-Z2R">
<rect key="frame" x="16" y="28" width="288" height="482"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="A93-rB-AZ4">
<rect key="frame" x="41" y="495" width="238" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="A93-rB-AZ4">
<rect key="frame" x="54" y="518" width="60" height="30"/>
<state key="normal" title="Sort">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
......@@ -33,8 +33,38 @@
<action selector="sort:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="JmD-7I-e8t"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="81n-2H-7fH">
<rect key="frame" x="104" y="518" width="113" height="30"/>
<state key="normal" title="Reverse Sort">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="reverseSort:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="3ph-FD-T7F"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cv7-dA-P8a">
<rect key="frame" x="225" y="518" width="60" height="30"/>
<state key="normal" title="Random">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="randomSort:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Qm2-PQ-ghk"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="cv7-dA-P8a" firstAttribute="leading" secondItem="81n-2H-7fH" secondAttribute="trailing" constant="8" id="6k6-kS-Uv4"/>
<constraint firstItem="81n-2H-7fH" firstAttribute="baseline" secondItem="cv7-dA-P8a" secondAttribute="baseline" id="EDF-c5-6UY"/>
<constraint firstItem="GOB-Ok-Z2R" firstAttribute="trailing" secondItem="kh9-bI-dsS" secondAttribute="trailingMargin" id="FcW-gp-TKr"/>
<constraint firstItem="cv7-dA-P8a" firstAttribute="top" secondItem="GOB-Ok-Z2R" secondAttribute="bottom" constant="8" id="LWK-fr-cJv"/>
<constraint firstItem="81n-2H-7fH" firstAttribute="leading" secondItem="A93-rB-AZ4" secondAttribute="trailing" constant="8" id="M4F-4D-BXj"/>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="81n-2H-7fH" secondAttribute="bottom" constant="20" id="Skf-gJ-Pvn"/>
<constraint firstAttribute="centerX" secondItem="81n-2H-7fH" secondAttribute="centerX" id="dPr-yc-eNh"/>
<constraint firstItem="GOB-Ok-Z2R" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="8" id="r9O-jI-RXe"/>
<constraint firstItem="81n-2H-7fH" firstAttribute="baseline" secondItem="A93-rB-AZ4" secondAttribute="baseline" id="sDL-eI-t03"/>
<constraint firstItem="GOB-Ok-Z2R" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="ykx-tI-cFm"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="LTz-Tk-BIg"/>
<connections>
......
......@@ -157,7 +157,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
w.wl
w.wl(s"auto $helperClass::fromCpp(const CppType& cpp) -> ObjcType")
w.braced {
w.wl(s"return !cpp ? nil : ::djinni::DbxCppWrapperCache<$cppSelf>::getInstance()->get(cpp, [] (const auto& p)").bracedEnd(");") {
w.wl(s"return !cpp ? nil : ::djinni::DbxCppWrapperCache<$cppSelf>::getInstance()->get(cpp, [] (const CppType& p)").bracedEnd(");") {
w.wl(s"return [[$self alloc] initWithCpp:p];")
}
}
......
......@@ -31,7 +31,7 @@ auto CppException::toCpp(ObjcType objc) -> CppType
auto CppException::fromCpp(const CppType& cpp) -> ObjcType
{
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::CppException>::getInstance()->get(cpp, [] (const auto& p)
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::CppException>::getInstance()->get(cpp, [] (const CppType& p)
{
return [[DBCppException alloc] initWithCpp:p];
});
......
......@@ -37,7 +37,7 @@ auto TestHelpers::toCpp(ObjcType objc) -> CppType
auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
{
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::TestHelpers>::getInstance()->get(cpp, [] (const auto& p)
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::TestHelpers>::getInstance()->get(cpp, [] (const CppType& p)
{
return [[DBTestHelpers alloc] initWithCpp:p];
});
......
......@@ -29,7 +29,7 @@ auto Token::toCpp(ObjcType objc) -> CppType
auto Token::fromCpp(const CppType& cpp) -> ObjcType
{
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::Token>::getInstance()->get(cpp, [] (const auto& p)
return !cpp ? nil : ::djinni::DbxCppWrapperCache<::Token>::getInstance()->get(cpp, [] (const CppType& p)
{
return [[DBToken alloc] initWithCpp:p];
});
......
......@@ -82,9 +82,10 @@
- (void)checkObjcMap:(NSDictionary *)objcMap
{
XCTAssertEqual([objcMap count], (NSUInteger)3, @"Count 3 expected, actual: %lu", (unsigned long)[objcMap count]);
XCTAssertEqual([objcMap objectForKey:@"String1"], @1, @"\"String1 -> 1\" expected");
XCTAssertEqual([objcMap objectForKey:@"String2"], @2, @"\"String2 -> 2\" expected");
XCTAssertEqual([objcMap objectForKey:@"String3"], @3, @"\"String3 -> 3\" expected");
// Must test with exact NSNumber constructor as used in DJIMarshal otherwise NSNumber comparison fails on x86_64 simulator devices
XCTAssertEqual([objcMap objectForKey:@"String1"], @((int64_t)1), @"\"String1 -> 1\" expected");
XCTAssertEqual([objcMap objectForKey:@"String2"], @((int64_t)2), @"\"String2 -> 2\" expected");
XCTAssertEqual([objcMap objectForKey:@"String3"], @((int64_t)3), @"\"String3 -> 3\" expected");
}
- (std::unordered_map<std::string, int64_t>)getCppMap
......
......@@ -579,7 +579,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
......@@ -622,7 +622,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
......@@ -658,13 +658,8 @@
65868B6E1989FE4200D60EEE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
DSTROOT = /tmp/DjinniObjcTest.dst;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
OTHER_CPLUSPLUSFLAGS = (
"-std=c++14",
"$(OTHER_CFLAGS)",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = DjinniObjcTest;
SKIP_INSTALL = YES;
......@@ -679,13 +674,8 @@
65868B6F1989FE4200D60EEE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
DSTROOT = /tmp/DjinniObjcTest.dst;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
OTHER_CPLUSPLUSFLAGS = (
"-std=c++14",
"$(OTHER_CFLAGS)",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = DjinniObjcTest;
SKIP_INSTALL = YES;
......@@ -700,7 +690,6 @@
65868B711989FE4200D60EEE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
......@@ -725,7 +714,6 @@
65868B721989FE4200D60EEE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment