From 2989c0fbfaf5ed9aefff3949aa1057bfdb7d30fc Mon Sep 17 00:00:00 2001 From: mekjaer Date: Thu, 27 Feb 2014 11:10:07 +0100 Subject: [PATCH 1/7] addRow renamed to addEmptyRow --- src/tightdb/objc/table.h | 8 +-- src/tightdb/objc/table_macros.h | 90 ++++++++++++++-------------- src/tightdb/objc/table_objc.mm | 10 ++-- src/tightdb/objc/test/group_misc_2.m | 8 +-- src/tightdb/objc/test/query.m | 4 +- src/tightdb/objc/test/table.m | 16 ++--- 6 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/tightdb/objc/table.h b/src/tightdb/objc/table.h index 1b74206f25..fc5560323f 100644 --- a/src/tightdb/objc/table.h +++ b/src/tightdb/objc/table.h @@ -119,12 +119,12 @@ -(TightdbDescriptor *)getDescriptorWithError:(NSError *__autoreleasing *)error; -(BOOL)isEmpty; -(size_t)count; --(TightdbCursor *)addRow; +-(TightdbCursor *)addEmptyRow; /* Only curser based add should be public. This is just a temporaray way to hide the methods. */ /* TODO: Move to class extension. */ --(size_t)_addRow; --(size_t)_addRows:(size_t)rowCount; +-(size_t)_addEmptyRow; +-(size_t)_addEmptyRows:(size_t)rowCount; -(BOOL)clear; -(BOOL)clearWithError:(NSError *__autoreleasing *)error; @@ -166,7 +166,7 @@ /* FIXME: It has been decided that the insert methods must not be a * part of the public Obj-C API. All row insertion must happen by * inserting a complete rows. This must occur either by calling - * `addRow` and then setting each column value afterwards, or possibly + * `addEmptyRow` and then setting each column value afterwards, or possibly * by calling a method that takes all column values as arguments at * once. */ -(BOOL)insertBool:(size_t)colNdx ndx:(size_t)ndx value:(BOOL)value; diff --git a/src/tightdb/objc/table_macros.h b/src/tightdb/objc/table_macros.h index a5c916eb58..30ac8e7a01 100644 --- a/src/tightdb/objc/table_macros.h +++ b/src/tightdb/objc/table_macros.h @@ -55,7 +55,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName1, CType1) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -175,9 +175,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName1, CType1) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -269,7 +269,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName2, CType2) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -400,9 +400,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName2, CType2) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -500,7 +500,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName3, CType3) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -642,9 +642,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName3, CType3) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -748,7 +748,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName4, CType4) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -901,9 +901,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName4, CType4) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -1013,7 +1013,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName5, CType5) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -1177,9 +1177,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName5, CType5) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -1295,7 +1295,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName6, CType6) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -1470,9 +1470,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName6, CType6) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -1594,7 +1594,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName7, CType7) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -1780,9 +1780,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName7, CType7) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -1910,7 +1910,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName8, CType8) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -2107,9 +2107,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName8, CType8) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -2243,7 +2243,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName9, CType9) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -2451,9 +2451,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName9, CType9) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -2593,7 +2593,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName10, CType10) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -2812,9 +2812,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName10, CType10) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -2960,7 +2960,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName11, CType11) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -3190,9 +3190,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName11, CType11) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -3344,7 +3344,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName12, CType12) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -3585,9 +3585,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName12, CType12) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -3745,7 +3745,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName13, CType13) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12 CName13:(TIGHTDB_ARG_TYPE(CType13))CName13; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12 CName13:(TIGHTDB_ARG_TYPE(CType13))CName13; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -3997,9 +3997,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName13, CType13) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -4163,7 +4163,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName14, CType14) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12 CName13:(TIGHTDB_ARG_TYPE(CType13))CName13 CName14:(TIGHTDB_ARG_TYPE(CType14))CName14; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12 CName13:(TIGHTDB_ARG_TYPE(CType13))CName13 CName14:(TIGHTDB_ARG_TYPE(CType14))CName14; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -4426,9 +4426,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName14, CType14) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ @@ -4598,7 +4598,7 @@ TIGHTDB_COLUMN_PROXY_DEF(CName15, CType15) \ -(void)add##CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12 CName13:(TIGHTDB_ARG_TYPE(CType13))CName13 CName14:(TIGHTDB_ARG_TYPE(CType14))CName14 CName15:(TIGHTDB_ARG_TYPE(CType15))CName15; \ -(void)insertRowAtIndex:(size_t)ndx CName1:(TIGHTDB_ARG_TYPE(CType1))CName1 CName2:(TIGHTDB_ARG_TYPE(CType2))CName2 CName3:(TIGHTDB_ARG_TYPE(CType3))CName3 CName4:(TIGHTDB_ARG_TYPE(CType4))CName4 CName5:(TIGHTDB_ARG_TYPE(CType5))CName5 CName6:(TIGHTDB_ARG_TYPE(CType6))CName6 CName7:(TIGHTDB_ARG_TYPE(CType7))CName7 CName8:(TIGHTDB_ARG_TYPE(CType8))CName8 CName9:(TIGHTDB_ARG_TYPE(CType9))CName9 CName10:(TIGHTDB_ARG_TYPE(CType10))CName10 CName11:(TIGHTDB_ARG_TYPE(CType11))CName11 CName12:(TIGHTDB_ARG_TYPE(CType12))CName12 CName13:(TIGHTDB_ARG_TYPE(CType13))CName13 CName14:(TIGHTDB_ARG_TYPE(CType14))CName14 CName15:(TIGHTDB_ARG_TYPE(CType15))CName15; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -4872,9 +4872,9 @@ TIGHTDB_COLUMN_PROXY_IMPL(CName15, CType15) \ { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ diff --git a/src/tightdb/objc/table_objc.mm b/src/tightdb/objc/table_objc.mm index 6a548e1ec8..233daf0332 100644 --- a/src/tightdb/objc/table_objc.mm +++ b/src/tightdb/objc/table_objc.mm @@ -618,18 +618,18 @@ -(size_t)count return m_table->size(); } --(TightdbCursor*)addRow +-(TightdbCursor*)addEmptyRow { - return [[TightdbCursor alloc] initWithTable:self ndx:[self _addRow]]; + return [[TightdbCursor alloc] initWithTable:self ndx:[self _addEmptyRow]]; } --(size_t)_addRow +-(size_t)_addEmptyRow { - return [self _addRows:1]; + return [self _addEmptyRows:1]; } --(size_t)_addRows:(size_t)num_rows +-(size_t)_addEmptyRows:(size_t)num_rows { // TODO: Use a macro or a function for error handling diff --git a/src/tightdb/objc/test/group_misc_2.m b/src/tightdb/objc/test/group_misc_2.m index 24c0715d4f..9a15b1b996 100644 --- a/src/tightdb/objc/test/group_misc_2.m +++ b/src/tightdb/objc/test/group_misc_2.m @@ -214,15 +214,15 @@ - (void)testSubtables int COL_SUBTABLE_INT = 0; // Add a row to the top level table - [table addRow]; + [table addEmptyRow]; [table setInt:700 inColumn:COL_TABLE_INT atRow:0]; // Add two rows to the subtable TightdbTable* subtable = [table getTableInColumn:COL_TABLE_TAB atRow:0]; - [subtable addRow]; + [subtable addEmptyRow]; [subtable setInt:800 inColumn:COL_SUBTABLE_INT atRow:0]; - [subtable addRow]; + [subtable addEmptyRow]; [subtable setInt:801 inColumn:COL_SUBTABLE_INT atRow:1]; // Make the mixed values column contain another subtable @@ -236,7 +236,7 @@ - (void)testSubtables [desc addColumnWithType:tightdb_Int andName:@"int"]; } // Add a row to it - [subtable2 addRow]; + [subtable2 addEmptyRow]; [subtable2 set:COL_SUBTABLE_INT ndx:0 value:900]; */ } diff --git a/src/tightdb/objc/test/query.m b/src/tightdb/objc/test/query.m index 3d99b85a32..ddf406bd25 100644 --- a/src/tightdb/objc/test/query.m +++ b/src/tightdb/objc/test/query.m @@ -168,7 +168,7 @@ - (void) testDynamic TightdbBinary *bin2 = [[TightdbBinary alloc] initWithData:bin size:sizeof bin]; // Using private method just for the sake of testing the setters below. - [table _addRows:2]; + [table _addEmptyRows:2]; [table setBool:YES inColumn:BOOL_COL atRow:0]; [table setBool:NO inColumn:BOOL_COL atRow:1]; @@ -255,7 +255,7 @@ - (void)testFind { TightdbTable* table = [[TightdbTable alloc]init]; [table addColumnWithType:tightdb_Int andName:@"IntCol"]; - [table _addRows:6]; + [table _addEmptyRows:6]; [table setInt:10 inColumn:0 atRow:0]; [table setInt:42 inColumn:0 atRow:1]; diff --git a/src/tightdb/objc/test/table.m b/src/tightdb/objc/test/table.m index 64ba4f550b..d46d6d389f 100644 --- a/src/tightdb/objc/test/table.m +++ b/src/tightdb/objc/test/table.m @@ -45,11 +45,11 @@ - (void)testTable // 2. Add a row with data - //const size_t ndx = [_table addRow]; + //const size_t ndx = [_table addEmptyRow]; //[_table set:0 ndx:ndx value:0]; //[_table set:1 ndx:ndx value:10]; - TightdbCursor* cursor = [_table addRow]; + TightdbCursor* cursor = [_table addEmptyRow]; size_t ndx = [cursor index]; [cursor setInt:0 inColumn:0]; [cursor setInt:10 inColumn:1]; @@ -94,12 +94,12 @@ - (void)testDataTypes_Typed TestTableAllTypes_Cursor* c; - c = [table addRow]; + c = [table addEmptyRow]; c.BoolCol = NO ; c.IntCol = 54 ; c.FloatCol = 0.7 ; c.DoubleCol = 0.8 ; c.StringCol = @"foo"; c.BinaryCol = bin1 ; c.DateCol = 0 ; c.TableCol = subtab1 ; c.MixedCol = mixInt1 ; - c = [table addRow]; + c = [table addEmptyRow]; c.BoolCol = YES ; c.IntCol = 506 ; c.FloatCol = 7.7 ; c.DoubleCol = 8.8 ; c.StringCol = @"banach"; c.BinaryCol = bin2 ; c.DateCol = timeNow ; c.TableCol = subtab2 ; c.MixedCol = mixSubtab ; @@ -192,12 +192,12 @@ - (void)testDataTypes_Dynamic - cursor = [subtab1 addRow]; + cursor = [subtab1 addEmptyRow]; [cursor setInt:200 inColumn:0]; - cursor = [subtab2 addRow]; + cursor = [subtab2 addEmptyRow]; [cursor setInt:100 inColumn:0]; @@ -209,7 +209,7 @@ - (void)testDataTypes_Dynamic - c = [table addRow]; + c = [table addEmptyRow]; @@ -223,7 +223,7 @@ - (void)testDataTypes_Dynamic [c setTable: subtab1 inColumn:TableCol]; [c setMixed: mixInt1 inColumn:MixedCol]; - c = [table addRow]; + c = [table addEmptyRow]; [c setBool: YES inColumn:BoolCol]; [c setInt: 506 inColumn:IntCol]; From abf8e366cd6d4e00b751c393d885c6c9005200ad Mon Sep 17 00:00:00 2001 From: mekjaer Date: Thu, 27 Feb 2014 13:38:42 +0100 Subject: [PATCH 2/7] updated tutorial to reside within an iPhone application and use our framework --- changes.txt | 4 + doc/ref/data/dyn_table_ref.yaml | 4 +- .../TightdbTutorial.xcodeproj/project.pbxproj | 377 ++++++++++++++++-- examples/iOSTutorial/AppDelegate.h | 7 + .../{tutorial.m => iOSTutorial/AppDelegate.m} | 189 ++++----- .../Base.lproj/Main_iPad.storyboard | 26 ++ .../Base.lproj/Main_iPhone.storyboard | 26 ++ .../AppIcon.appiconset/Contents.json | 53 +++ .../LaunchImage.launchimage/Contents.json | 51 +++ examples/iOSTutorial/ViewController.h | 5 + examples/iOSTutorial/ViewController.m | 21 + .../iOSTutorial/en.lproj/InfoPlist.strings | 2 + examples/iOSTutorial/iOSTutorial-Info.plist | 49 +++ examples/iOSTutorial/iOSTutorial-Prefix.pch | 16 + examples/iOSTutorial/main.m | 18 + .../en.lproj/InfoPlist.strings | 2 + .../iOSTutorialTests-Info.plist | 22 + examples/iOSTutorialTests/iOSTutorialTests.m | 34 ++ src/tightdb/objc/table_macros.h.cheetah | 6 +- .../iPhoneMiniTutorial/TViewController.m | 4 +- 20 files changed, 777 insertions(+), 139 deletions(-) create mode 100644 examples/iOSTutorial/AppDelegate.h rename examples/{tutorial.m => iOSTutorial/AppDelegate.m} (73%) create mode 100644 examples/iOSTutorial/Base.lproj/Main_iPad.storyboard create mode 100644 examples/iOSTutorial/Base.lproj/Main_iPhone.storyboard create mode 100644 examples/iOSTutorial/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 examples/iOSTutorial/Images.xcassets/LaunchImage.launchimage/Contents.json create mode 100644 examples/iOSTutorial/ViewController.h create mode 100644 examples/iOSTutorial/ViewController.m create mode 100644 examples/iOSTutorial/en.lproj/InfoPlist.strings create mode 100644 examples/iOSTutorial/iOSTutorial-Info.plist create mode 100644 examples/iOSTutorial/iOSTutorial-Prefix.pch create mode 100644 examples/iOSTutorial/main.m create mode 100644 examples/iOSTutorialTests/en.lproj/InfoPlist.strings create mode 100644 examples/iOSTutorialTests/iOSTutorialTests-Info.plist create mode 100644 examples/iOSTutorialTests/iOSTutorialTests.m diff --git a/changes.txt b/changes.txt index eb9599d51f..82ce645bdd 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,7 @@ +2014-02-27 +========== +! BREAKING CHANGE: addRow renamed to addEmptyRow + 2013-11-08 ========== * Adding support for one-line installer (suppressing output and don't die too hard). diff --git a/doc/ref/data/dyn_table_ref.yaml b/doc/ref/data/dyn_table_ref.yaml index 5bd5676732..ee15c0d8bd 100755 --- a/doc/ref/data/dyn_table_ref.yaml +++ b/doc/ref/data/dyn_table_ref.yaml @@ -254,10 +254,10 @@ CATEGORIES : DESCR : The cursor. - g_dyn_table_add_empty_row: - NAME : addRow + NAME : addEmptyRow SUMMARY : *objc_typed_table_add_empty_row_summary DESCR : *objc_typed_table_add_empty_row_descr - SIGNATURE: -(TightdbCursor *)addRow + SIGNATURE: -(TightdbCursor *)addEmptyRow RETURN: TYPES : TightdbCursor * DESCR : Returns a dynamic cursor at the added row. diff --git a/examples/TightdbTutorial.xcodeproj/project.pbxproj b/examples/TightdbTutorial.xcodeproj/project.pbxproj index 60baa13401..b677bcf191 100644 --- a/examples/TightdbTutorial.xcodeproj/project.pbxproj +++ b/examples/TightdbTutorial.xcodeproj/project.pbxproj @@ -7,34 +7,73 @@ objects = { /* Begin PBXBuildFile section */ - 4D1271FB1833C1970099B36C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D1271FA1833C1970099B36C /* CoreFoundation.framework */; }; - 4D1272091833C21A0099B36C /* tutorial.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1272081833C21A0099B36C /* tutorial.m */; }; + 4D24338E18BF65C700271C32 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D24338D18BF65C700271C32 /* Foundation.framework */; }; + 4D24339018BF65C700271C32 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D24338F18BF65C700271C32 /* CoreGraphics.framework */; }; + 4D24339818BF65C700271C32 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4D24339618BF65C700271C32 /* InfoPlist.strings */; }; + 4D24339A18BF65C700271C32 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D24339918BF65C700271C32 /* main.m */; }; + 4D24339E18BF65C700271C32 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D24339D18BF65C700271C32 /* AppDelegate.m */; }; + 4D2433A118BF65C700271C32 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4D24339F18BF65C700271C32 /* Main_iPhone.storyboard */; }; + 4D2433A418BF65C700271C32 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4D2433A218BF65C700271C32 /* Main_iPad.storyboard */; }; + 4D2433A718BF65C700271C32 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D2433A618BF65C700271C32 /* ViewController.m */; }; + 4D2433A918BF65C700271C32 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4D2433A818BF65C700271C32 /* Images.xcassets */; }; + 4D2433B118BF65C700271C32 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D24338D18BF65C700271C32 /* Foundation.framework */; }; + 4D2433BA18BF65C700271C32 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4D2433B818BF65C700271C32 /* InfoPlist.strings */; }; + 4D2433BC18BF65C700271C32 /* iOSTutorialTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D2433BB18BF65C700271C32 /* iOSTutorialTests.m */; }; + 4DB1DEF518BF67AE005A7234 /* Tightdb.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB1DEF418BF67AE005A7234 /* Tightdb.framework */; }; + 4DB1DEF718BF67B3005A7234 /* libstdc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB1DEF618BF67B3005A7234 /* libstdc++.dylib */; }; /* End PBXBuildFile section */ -/* Begin PBXCopyFilesBuildPhase section */ - 4D1271F51833C1970099B36C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; +/* Begin PBXContainerItemProxy section */ + 4D2433B318BF65C700271C32 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4D1271EF1833C1970099B36C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4D24338B18BF65C700271C32; + remoteInfo = iOSTutorial; }; -/* End PBXCopyFilesBuildPhase section */ +/* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 4D1271F71833C1970099B36C /* TightdbTutorial */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TightdbTutorial; sourceTree = BUILT_PRODUCTS_DIR; }; 4D1271FA1833C1970099B36C /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; - 4D1272081833C21A0099B36C /* tutorial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = tutorial.m; sourceTree = SOURCE_ROOT; }; + 4D24338C18BF65C700271C32 /* iOSTutorial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSTutorial.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 4D24338D18BF65C700271C32 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 4D24338F18BF65C700271C32 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 4D24339518BF65C700271C32 /* iOSTutorial-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iOSTutorial-Info.plist"; sourceTree = ""; }; + 4D24339718BF65C700271C32 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 4D24339918BF65C700271C32 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 4D24339B18BF65C700271C32 /* iOSTutorial-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iOSTutorial-Prefix.pch"; sourceTree = ""; }; + 4D24339C18BF65C700271C32 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 4D24339D18BF65C700271C32 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 4D2433A018BF65C700271C32 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; + 4D2433A318BF65C700271C32 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; + 4D2433A518BF65C700271C32 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 4D2433A618BF65C700271C32 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 4D2433A818BF65C700271C32 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 4D2433AE18BF65C700271C32 /* iOSTutorialTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSTutorialTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 4D2433B718BF65C700271C32 /* iOSTutorialTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iOSTutorialTests-Info.plist"; sourceTree = ""; }; + 4D2433B918BF65C700271C32 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 4D2433BB18BF65C700271C32 /* iOSTutorialTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iOSTutorialTests.m; sourceTree = ""; }; + 4DB1DEF418BF67AE005A7234 /* Tightdb.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tightdb.framework; path = ../Tightdb.framework; sourceTree = ""; }; + 4DB1DEF618BF67B3005A7234 /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libstdc++.dylib"; sourceTree = DEVELOPER_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 4D1271F41833C1970099B36C /* Frameworks */ = { + 4D24338918BF65C700271C32 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4D1271FB1833C1970099B36C /* CoreFoundation.framework in Frameworks */, + 4DB1DEF718BF67B3005A7234 /* libstdc++.dylib in Frameworks */, + 4D24339018BF65C700271C32 /* CoreGraphics.framework in Frameworks */, + 4D24338E18BF65C700271C32 /* Foundation.framework in Frameworks */, + 4DB1DEF518BF67AE005A7234 /* Tightdb.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4D2433AB18BF65C700271C32 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4D2433B118BF65C700271C32 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -45,6 +84,8 @@ isa = PBXGroup; children = ( 4D1271FC1833C1970099B36C /* TightdbTutorial */, + 4D24339318BF65C700271C32 /* iOSTutorial */, + 4D2433B518BF65C700271C32 /* iOSTutorialTests */, 4D1271F91833C1970099B36C /* Frameworks */, 4D1271F81833C1970099B36C /* Products */, ); @@ -53,7 +94,8 @@ 4D1271F81833C1970099B36C /* Products */ = { isa = PBXGroup; children = ( - 4D1271F71833C1970099B36C /* TightdbTutorial */, + 4D24338C18BF65C700271C32 /* iOSTutorial.app */, + 4D2433AE18BF65C700271C32 /* iOSTutorialTests.xctest */, ); name = Products; sourceTree = ""; @@ -61,7 +103,11 @@ 4D1271F91833C1970099B36C /* Frameworks */ = { isa = PBXGroup; children = ( + 4DB1DEF618BF67B3005A7234 /* libstdc++.dylib */, + 4DB1DEF418BF67AE005A7234 /* Tightdb.framework */, 4D1271FA1833C1970099B36C /* CoreFoundation.framework */, + 4D24338D18BF65C700271C32 /* Foundation.framework */, + 4D24338F18BF65C700271C32 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; @@ -69,30 +115,91 @@ 4D1271FC1833C1970099B36C /* TightdbTutorial */ = { isa = PBXGroup; children = ( - 4D1272081833C21A0099B36C /* tutorial.m */, ); path = TightdbTutorial; sourceTree = ""; }; + 4D24339318BF65C700271C32 /* iOSTutorial */ = { + isa = PBXGroup; + children = ( + 4D24339C18BF65C700271C32 /* AppDelegate.h */, + 4D24339D18BF65C700271C32 /* AppDelegate.m */, + 4D24339F18BF65C700271C32 /* Main_iPhone.storyboard */, + 4D2433A218BF65C700271C32 /* Main_iPad.storyboard */, + 4D2433A518BF65C700271C32 /* ViewController.h */, + 4D2433A618BF65C700271C32 /* ViewController.m */, + 4D2433A818BF65C700271C32 /* Images.xcassets */, + 4D24339418BF65C700271C32 /* Supporting Files */, + ); + path = iOSTutorial; + sourceTree = ""; + }; + 4D24339418BF65C700271C32 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 4D24339518BF65C700271C32 /* iOSTutorial-Info.plist */, + 4D24339618BF65C700271C32 /* InfoPlist.strings */, + 4D24339918BF65C700271C32 /* main.m */, + 4D24339B18BF65C700271C32 /* iOSTutorial-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 4D2433B518BF65C700271C32 /* iOSTutorialTests */ = { + isa = PBXGroup; + children = ( + 4D2433BB18BF65C700271C32 /* iOSTutorialTests.m */, + 4D2433B618BF65C700271C32 /* Supporting Files */, + ); + path = iOSTutorialTests; + sourceTree = ""; + }; + 4D2433B618BF65C700271C32 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 4D2433B718BF65C700271C32 /* iOSTutorialTests-Info.plist */, + 4D2433B818BF65C700271C32 /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 4D1271F61833C1970099B36C /* TightdbTutorial */ = { + 4D24338B18BF65C700271C32 /* iOSTutorial */ = { isa = PBXNativeTarget; - buildConfigurationList = 4D1272031833C1970099B36C /* Build configuration list for PBXNativeTarget "TightdbTutorial" */; + buildConfigurationList = 4D2433BD18BF65C700271C32 /* Build configuration list for PBXNativeTarget "iOSTutorial" */; buildPhases = ( - 4D1271F31833C1970099B36C /* Sources */, - 4D1271F41833C1970099B36C /* Frameworks */, - 4D1271F51833C1970099B36C /* CopyFiles */, + 4D24338818BF65C700271C32 /* Sources */, + 4D24338918BF65C700271C32 /* Frameworks */, + 4D24338A18BF65C700271C32 /* Resources */, ); buildRules = ( ); dependencies = ( ); - name = TightdbTutorial; - productName = TightdbTutorial; - productReference = 4D1271F71833C1970099B36C /* TightdbTutorial */; - productType = "com.apple.product-type.tool"; + name = iOSTutorial; + productName = iOSTutorial; + productReference = 4D24338C18BF65C700271C32 /* iOSTutorial.app */; + productType = "com.apple.product-type.application"; + }; + 4D2433AD18BF65C700271C32 /* iOSTutorialTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4D2433C018BF65C700271C32 /* Build configuration list for PBXNativeTarget "iOSTutorialTests" */; + buildPhases = ( + 4D2433AA18BF65C700271C32 /* Sources */, + 4D2433AB18BF65C700271C32 /* Frameworks */, + 4D2433AC18BF65C700271C32 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 4D2433B418BF65C700271C32 /* PBXTargetDependency */, + ); + name = iOSTutorialTests; + productName = iOSTutorialTests; + productReference = 4D2433AE18BF65C700271C32 /* iOSTutorialTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -102,6 +209,11 @@ attributes = { LastUpgradeCheck = 0500; ORGANIZATIONNAME = "Morten Kjaer"; + TargetAttributes = { + 4D2433AD18BF65C700271C32 = { + TestTargetID = 4D24338B18BF65C700271C32; + }; + }; }; buildConfigurationList = 4D1271F21833C1970099B36C /* Build configuration list for PBXProject "TightdbTutorial" */; compatibilityVersion = "Xcode 3.2"; @@ -109,28 +221,105 @@ hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 4D1271EE1833C1970099B36C; productRefGroup = 4D1271F81833C1970099B36C /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 4D1271F61833C1970099B36C /* TightdbTutorial */, + 4D24338B18BF65C700271C32 /* iOSTutorial */, + 4D2433AD18BF65C700271C32 /* iOSTutorialTests */, ); }; /* End PBXProject section */ +/* Begin PBXResourcesBuildPhase section */ + 4D24338A18BF65C700271C32 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4D2433A418BF65C700271C32 /* Main_iPad.storyboard in Resources */, + 4D2433A918BF65C700271C32 /* Images.xcassets in Resources */, + 4D2433A118BF65C700271C32 /* Main_iPhone.storyboard in Resources */, + 4D24339818BF65C700271C32 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4D2433AC18BF65C700271C32 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4D2433BA18BF65C700271C32 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ - 4D1271F31833C1970099B36C /* Sources */ = { + 4D24338818BF65C700271C32 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4D2433A718BF65C700271C32 /* ViewController.m in Sources */, + 4D24339E18BF65C700271C32 /* AppDelegate.m in Sources */, + 4D24339A18BF65C700271C32 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4D2433AA18BF65C700271C32 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4D1272091833C21A0099B36C /* tutorial.m in Sources */, + 4D2433BC18BF65C700271C32 /* iOSTutorialTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 4D2433B418BF65C700271C32 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4D24338B18BF65C700271C32 /* iOSTutorial */; + targetProxy = 4D2433B318BF65C700271C32 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 4D24339618BF65C700271C32 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 4D24339718BF65C700271C32 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 4D24339F18BF65C700271C32 /* Main_iPhone.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 4D2433A018BF65C700271C32 /* Base */, + ); + name = Main_iPhone.storyboard; + sourceTree = ""; + }; + 4D2433A218BF65C700271C32 /* Main_iPad.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 4D2433A318BF65C700271C32 /* Base */, + ); + name = Main_iPad.storyboard; + sourceTree = ""; + }; + 4D2433B818BF65C700271C32 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 4D2433B918BF65C700271C32 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 4D1272011833C1970099B36C /* Debug */ = { isa = XCBuildConfiguration; @@ -168,10 +357,8 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, /usr/local/include, ); - "LIBRARY_SEARCH_PATHS[arch=*]" = /usr/local/lib; MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; - "OTHER_LDFLAGS[arch=*]" = "-ltightdb-objc-dbg"; SDKROOT = macosx; }; name = Debug; @@ -207,24 +394,127 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, /usr/local/include, ); - "LIBRARY_SEARCH_PATHS[arch=*]" = /usr/local/lib; MACOSX_DEPLOYMENT_TARGET = 10.9; - "OTHER_LDFLAGS[arch=*]" = "-ltightdb-objc"; SDKROOT = macosx; }; name = Release; }; - 4D1272041833C1970099B36C /* Debug */ = { + 4D2433BE18BF65C700271C32 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + /Users/mk/git/git/tightdb_objc, + ); + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOSTutorial/iOSTutorial-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + ); + INFOPLIST_FILE = "iOSTutorial/iOSTutorial-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + ONLY_ACTIVE_ARCH = NO; + "OTHER_LDFLAGS[arch=*]" = ""; PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = app; }; name = Debug; }; - 4D1272051833C1970099B36C /* Release */ = { + 4D2433BF18BF65C700271C32 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + /Users/mk/git/git/tightdb_objc, + ); + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOSTutorial/iOSTutorial-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + ); + INFOPLIST_FILE = "iOSTutorial/iOSTutorial-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + "OTHER_LDFLAGS[arch=*]" = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 4D2433C118BF65C700271C32 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iOSTutorial.app/iOSTutorial"; + CLANG_ENABLE_MODULES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOSTutorial/iOSTutorial-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "iOSTutorialTests/iOSTutorialTests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + 4D2433C218BF65C700271C32 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iOSTutorial.app/iOSTutorial"; + CLANG_ENABLE_MODULES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOSTutorial/iOSTutorial-Prefix.pch"; + INFOPLIST_FILE = "iOSTutorialTests/iOSTutorialTests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + TEST_HOST = "$(BUNDLE_LOADER)"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = xctest; }; name = Release; }; @@ -240,11 +530,20 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4D1272031833C1970099B36C /* Build configuration list for PBXNativeTarget "TightdbTutorial" */ = { + 4D2433BD18BF65C700271C32 /* Build configuration list for PBXNativeTarget "iOSTutorial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4D2433BE18BF65C700271C32 /* Debug */, + 4D2433BF18BF65C700271C32 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4D2433C018BF65C700271C32 /* Build configuration list for PBXNativeTarget "iOSTutorialTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 4D1272041833C1970099B36C /* Debug */, - 4D1272051833C1970099B36C /* Release */, + 4D2433C118BF65C700271C32 /* Debug */, + 4D2433C218BF65C700271C32 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/examples/iOSTutorial/AppDelegate.h b/examples/iOSTutorial/AppDelegate.h new file mode 100644 index 0000000000..a5a8b38522 --- /dev/null +++ b/examples/iOSTutorial/AppDelegate.h @@ -0,0 +1,7 @@ +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/examples/tutorial.m b/examples/iOSTutorial/AppDelegate.m similarity index 73% rename from examples/tutorial.m rename to examples/iOSTutorial/AppDelegate.m index 7c4ffa0d62..728bcbcafd 100644 --- a/examples/tutorial.m +++ b/examples/iOSTutorial/AppDelegate.m @@ -1,7 +1,5 @@ -#import -#import -#import -#import +#import "AppDelegate.h" +#import // @@Example: create_table @@ @@ -18,55 +16,55 @@ void tableFunc() { PeopleTable *people = [[PeopleTable alloc] init]; // (...) // @@EndExample@@ - + // @@Example: insert_rows @@ - + PeopleTable_Cursor *cursor; - + // Row 1 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"John"; cursor.Age = 21; cursor.Hired = YES; - + // Row 2 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Mary"; cursor.Age = 76; cursor.Hired = NO; - + // Row 3 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Lars"; cursor.Age = 22; cursor.Hired = YES; - + // Row 4 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Phil"; cursor.Age = 43; cursor.Hired = NO; - + // Row 5 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Anni"; cursor.Age = 54; cursor.Hired = YES; // @@EndExample@@ - + // @@Example: insert_at_index @@ cursor = [people insertRowAtIndex:2]; cursor.Name = @"Frank"; cursor.Age = 34; cursor.Hired = YES; - + // @@EndExample@@ - + // @@Example: number_of_rows @@ size_t cnt1 = [people count]; // cnt = 6 BOOL empty = [people isEmpty]; // empty = NO // @@EndExample@@ - + // @@Example: accessing_rows @@ // Getting values directly NSString* name = [people cursorAtIndex:5].Name; // => 'Anni' @@ -74,50 +72,50 @@ void tableFunc() { PeopleTable_Cursor *myRow = [people cursorAtIndex:5]; int64_t age = myRow.Age; // => 54 BOOL hired = myRow.Hired; // => true - + // Setting values [[people cursorAtIndex:5] setAge:43]; // Getting younger // or with dot-syntax: myRow.Age += 1; // Happy birthday! // @@EndExample@@ - + // @@Example: last_row @@ NSString *last = [people cursorAtLastIndex].Name; // => "Anni" // @@EndExample@@ - + // @@Example: updating_entire_row @@ // (TODO: a curser should be used here) [people setAtIndex:4 Name:"Eric" Age:50 Hired:YES]; // @EndExample@@ - + // @@Example: deleting_row @@ [people removeRowAtIndex:2]; size_t cnt2 = [people count]; // cnt = 5 // @@EndExample@@ - + // @@Example: iteration @@ for (size_t i = 0; i < [people count]; ++i) { PeopleTable_Cursor *row = [people cursorAtIndex:i]; NSLog(@"%@ is %lld years old", row.Name, row.Age); } // @@EndExample@@ - + // @@Example: simple_seach @@ size_t row; row = [people.Name find:@"Philip"]; // (size_t)-1. Not found row = [people.Name find:@"Mary"]; // row = 1 // @@EndExample@@ - + // @@Example: advanced_search @@ // Create query (current employees between 20 and 30 years old) PeopleTable_Query *q = [[[people where].Hired columnIsEqualTo:YES] - .Age columnIsBetween:20 and_:30]; - + .Age columnIsBetween:20 and_:30]; + // Get number of matching entries size_t cnt3 = [q count]; // => 2 - + // Get the average age (currently only a low-level interface) NSNumber *avg = [q.Age average]; - + // Execute the query and return a table (view) PeopleTable_View *res = [q findAll]; for (size_t i = 0; i < [res count]; ++i) { @@ -125,124 +123,125 @@ void tableFunc() { [people cursorAtIndex:i].Name, [people cursorAtIndex:i].Age); } - + // Alternatively with fast emunaration for (PeopleTable_Cursor *c in res) NSLog(@"%@ is %lld years old", c.Name, c.Age); - + // @@EndExample@@ - + } void groupFunc() { - + // @@Example: serialisation @@ // Create Table in Group TightdbGroup *group = [TightdbGroup group]; - PeopleTable *people = [group getTable:@"employees" withClass:[PeopleTable class]]; - + PeopleTable *people = [group getTable:@"employees" withClass:[PeopleTable class] error:nil]; + // Add some rows PeopleTable_Cursor *cursor; - + // Row 1 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"John"; cursor.Age = 21; cursor.Hired = YES; - + // Row 2 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Mary"; cursor.Age = 21; cursor.Hired = NO; - + // Row 3 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Lars"; cursor.Age = 21; cursor.Hired = YES; - + // Row 4 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Phil"; cursor.Age = 43; cursor.Hired = NO; - + // Row 5 - cursor = [people addRow]; + cursor = [people addEmptyRow]; cursor.Name = @"Anni"; cursor.Age = 54; cursor.Hired = YES; - + // Delete any old file by same name // IMPORTANT: write will fail if the file exists. NSFileManager *manager = [NSFileManager defaultManager]; [manager removeItemAtPath:@"employees.tightdb" error:nil]; - + // Write to disk - [group write:@"employees.tightdb"]; - + [group writeToFile:@"employees.tightdb" withError:nil]; + // Load a group from disk (and print contents) - TightdbGroup *fromDisk = [TightdbGroup groupWithFilename:@"employees.tightdb"]; - PeopleTable *diskTable = [fromDisk getTable:@"employees" withClass:[PeopleTable class]]; - + TightdbGroup *fromDisk = [TightdbGroup groupWithFile:@"employees.tightdb" withError:nil]; + PeopleTable *diskTable = [fromDisk getTable:@"employees" withClass:[PeopleTable class] error:nil]; + NSLog(@"Disktable size: %zu", [diskTable count]); for (size_t i = 0; i < [diskTable count]; i++) { PeopleTable_Cursor *cursor = [diskTable cursorAtIndex:i]; NSLog(@"%zu: %@", i, [cursor Name]); // using std. method } - + // Write same group to memory buffer - size_t len; - const char* buffer = [group writeToMem:&len]; - - // Load a group from memory (and print contents) - TightdbGroup *fromMem = [TightdbGroup groupWithBuffer:buffer size:len]; - PeopleTable *memTable = [fromMem getTable:@"employees" withClass:[PeopleTable class]]; - - for (size_t i = 0; i < [memTable count]; i++) { - PeopleTable_Cursor *cursor = [memTable cursorAtIndex:i]; - NSLog(@"%zu: %@", i, cursor.Name); // using dot-syntax - } - + /*size_t len; + const char* buffer = [group writeToBuffer]; + + // Load a group from memory (and print contents) + TightdbGroup *fromMem = [TightdbGroup groupWithBuffer:buffer withError:nil]; + PeopleTable *memTable = [fromMem getTable:@"employees" withClass:[PeopleTable class] error:nil]; + + for (size_t i = 0; i < [memTable count]; i++) { + PeopleTable_Cursor *cursor = [memTable cursorAtIndex:i]; + NSLog(@"%zu: %@", i, cursor.Name); // using dot-syntax + }*/ + + // @@EndExample@@ - - + + } void sharedGroupFunc() { - + // @@Example: transaction @@ - TightdbSharedGroup *sharedGroup = [TightdbSharedGroup groupWithFilename:@"people.tightdb"]; - + TightdbSharedGroup *sharedGroup = [TightdbSharedGroup sharedGroupWithFile:@"people.tightdb" withError:nil]; + // A write transaction (with rollback if not first writer to employees table). - - [sharedGroup writeTransaction:^(TightdbGroup *group) { - + + [sharedGroup writeWithBlock:^(TightdbGroup *group) { + // Write transactions with the shared group are possible via the provided variable binding named group. - - PeopleTable *table = [group getTable:@"employees" withClass:[PeopleTable class]]; + + PeopleTable *table = [group getTable:@"employees" withClass:[PeopleTable class] error:nil]; if ([table count] > 0) { NSLog(@"Not empty!"); return NO; // Rollback } - + [table addName:@"Bill" Age:53 Hired:YES]; NSLog(@"Row added!"); return YES; // Commit - - }]; - + + } withError:nil]; + // A read transaction - - [sharedGroup readTransaction:^(TightdbGroup *group) { - + + [sharedGroup readWithBlock:^(TightdbGroup *group) { + // Read transactions with the shared group are possible via the provided variable binding named group. - - PeopleTable *table = [group getTable:@"employees" withClass:[PeopleTable class]]; - + + PeopleTable *table = [group getTable:@"employees" withClass:[PeopleTable class] error:nil]; + for (PeopleTable_Cursor *curser in table) { NSLog(@"Name: %@", [curser Name]); } @@ -250,11 +249,15 @@ void sharedGroupFunc() { // @@EndExample@@ } -int main(int argc, const char * argv[]) +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - @autoreleasepool { - tableFunc(); - groupFunc(); - sharedGroupFunc(); - } + + tableFunc(); + groupFunc(); + sharedGroupFunc(); + return YES; } + +@end diff --git a/examples/iOSTutorial/Base.lproj/Main_iPad.storyboard b/examples/iOSTutorial/Base.lproj/Main_iPad.storyboard new file mode 100644 index 0000000000..a185e8a5df --- /dev/null +++ b/examples/iOSTutorial/Base.lproj/Main_iPad.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/iOSTutorial/Base.lproj/Main_iPhone.storyboard b/examples/iOSTutorial/Base.lproj/Main_iPhone.storyboard new file mode 100644 index 0000000000..b99208bd77 --- /dev/null +++ b/examples/iOSTutorial/Base.lproj/Main_iPhone.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/iOSTutorial/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/iOSTutorial/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..91bf9c14a7 --- /dev/null +++ b/examples/iOSTutorial/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,53 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/iOSTutorial/Images.xcassets/LaunchImage.launchimage/Contents.json b/examples/iOSTutorial/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 0000000000..6f870a4629 --- /dev/null +++ b/examples/iOSTutorial/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,51 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "subtype" : "retina4", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/iOSTutorial/ViewController.h b/examples/iOSTutorial/ViewController.h new file mode 100644 index 0000000000..896709485e --- /dev/null +++ b/examples/iOSTutorial/ViewController.h @@ -0,0 +1,5 @@ +#import + +@interface ViewController : UIViewController + +@end diff --git a/examples/iOSTutorial/ViewController.m b/examples/iOSTutorial/ViewController.m new file mode 100644 index 0000000000..b79257c3b0 --- /dev/null +++ b/examples/iOSTutorial/ViewController.m @@ -0,0 +1,21 @@ +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/examples/iOSTutorial/en.lproj/InfoPlist.strings b/examples/iOSTutorial/en.lproj/InfoPlist.strings new file mode 100644 index 0000000000..477b28ff8f --- /dev/null +++ b/examples/iOSTutorial/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/examples/iOSTutorial/iOSTutorial-Info.plist b/examples/iOSTutorial/iOSTutorial-Info.plist new file mode 100644 index 0000000000..f7c7feda56 --- /dev/null +++ b/examples/iOSTutorial/iOSTutorial-Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.tightdb.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIMainStoryboardFile + Main_iPhone + UIMainStoryboardFile~ipad + Main_iPad + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/examples/iOSTutorial/iOSTutorial-Prefix.pch b/examples/iOSTutorial/iOSTutorial-Prefix.pch new file mode 100644 index 0000000000..82a2bb4507 --- /dev/null +++ b/examples/iOSTutorial/iOSTutorial-Prefix.pch @@ -0,0 +1,16 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/examples/iOSTutorial/main.m b/examples/iOSTutorial/main.m new file mode 100644 index 0000000000..d7d0bd5bc1 --- /dev/null +++ b/examples/iOSTutorial/main.m @@ -0,0 +1,18 @@ +// +// main.m +// iOSTutorial +// +// Created by Morten Kjaer on 27/02/14. +// Copyright (c) 2014 Morten Kjaer. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/examples/iOSTutorialTests/en.lproj/InfoPlist.strings b/examples/iOSTutorialTests/en.lproj/InfoPlist.strings new file mode 100644 index 0000000000..477b28ff8f --- /dev/null +++ b/examples/iOSTutorialTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/examples/iOSTutorialTests/iOSTutorialTests-Info.plist b/examples/iOSTutorialTests/iOSTutorialTests-Info.plist new file mode 100644 index 0000000000..b82c4d6395 --- /dev/null +++ b/examples/iOSTutorialTests/iOSTutorialTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.tightdb.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/examples/iOSTutorialTests/iOSTutorialTests.m b/examples/iOSTutorialTests/iOSTutorialTests.m new file mode 100644 index 0000000000..dc92d79311 --- /dev/null +++ b/examples/iOSTutorialTests/iOSTutorialTests.m @@ -0,0 +1,34 @@ +// +// iOSTutorialTests.m +// iOSTutorialTests +// +// Created by Morten Kjaer on 27/02/14. +// Copyright (c) 2014 Morten Kjaer. All rights reserved. +// + +#import + +@interface iOSTutorialTests : XCTestCase + +@end + +@implementation iOSTutorialTests + +- (void)setUp +{ + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown +{ + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample +{ + XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); +} + +@end diff --git a/src/tightdb/objc/table_macros.h.cheetah b/src/tightdb/objc/table_macros.h.cheetah index d6ef05fe07..04224cad04 100644 --- a/src/tightdb/objc/table_macros.h.cheetah +++ b/src/tightdb/objc/table_macros.h.cheetah @@ -90,7 +90,7 @@ CName${j+1}:(TIGHTDB_ARG_TYPE(CType${j+1}))CName${j+1}%slurp %end for ; \ -(TableName##_Query*)where; \ --(TableName##_Cursor*)addRow; \ +-(TableName##_Cursor*)addEmptyRow; \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx; \ -(TableName##_Cursor*)cursorAtLastIndex; \ -(TableName##_Cursor*)insertRowAtIndex:(size_t)ndx; \ @@ -244,9 +244,9 @@ CName${j+1}:(TIGHTDB_ARG_TYPE(CType${j+1}))CName${j+1} %slurp { \ return [[TableName##_Query alloc] initWithTable:self]; \ } \ --(TableName##_Cursor*)addRow \ +-(TableName##_Cursor*)addEmptyRow \ { \ - return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addRow]]; \ + return [[TableName##_Cursor alloc] initWithTable:self ndx:[super _addEmptyRow]]; \ } \ -(TableName##_Cursor*)cursorAtIndex:(size_t)ndx \ { \ diff --git a/tutorial/iPhoneMiniTutorial/iPhoneMiniTutorial/TViewController.m b/tutorial/iPhoneMiniTutorial/iPhoneMiniTutorial/TViewController.m index 69ff7eecab..f0dd65338a 100644 --- a/tutorial/iPhoneMiniTutorial/iPhoneMiniTutorial/TViewController.m +++ b/tutorial/iPhoneMiniTutorial/iPhoneMiniTutorial/TViewController.m @@ -20,13 +20,13 @@ - (void)viewDidLoad size_t const HIRED = [table addColumnWithType:tightdb_Bool andName:@"Hired"]; // Add new row to the table and set values - TightdbCursor *cursor0 = [table addRow]; + TightdbCursor *cursor0 = [table addEmptyRow]; [cursor0 setString:@"Jill" inColumn:NAME]; [cursor0 setInt: 21 inColumn:AGE]; [cursor0 setBool:YES inColumn:HIRED]; // Add one more row and set values - TightdbCursor *cursor1 = [table addRow]; + TightdbCursor *cursor1 = [table addEmptyRow]; [cursor1 setString:@"Mary" inColumn:NAME]; [cursor1 setInt: 40 inColumn:AGE]; [cursor1 setBool:NO inColumn:HIRED]; From 72640773eb8f82126ca90b906b4c69e3083aa9af Mon Sep 17 00:00:00 2001 From: mekjaer Date: Thu, 27 Feb 2014 13:45:44 +0100 Subject: [PATCH 3/7] relative path in Xcode project --- examples/TightdbTutorial.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/TightdbTutorial.xcodeproj/project.pbxproj b/examples/TightdbTutorial.xcodeproj/project.pbxproj index b677bcf191..4cbc612e58 100644 --- a/examples/TightdbTutorial.xcodeproj/project.pbxproj +++ b/examples/TightdbTutorial.xcodeproj/project.pbxproj @@ -412,7 +412,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", - /Users/mk/git/git/tightdb_objc, + ../, ); GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -449,7 +449,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", - /Users/mk/git/git/tightdb_objc, + ../, ); GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_PRECOMPILE_PREFIX_HEADER = YES; From b52627d61a67aa203abc3ed8859b71f9bac1921d Mon Sep 17 00:00:00 2001 From: mekjaer Date: Thu, 27 Feb 2014 13:57:18 +0100 Subject: [PATCH 4/7] enabled writeToBuffer --- examples/iOSTutorial/AppDelegate.m | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/iOSTutorial/AppDelegate.m b/examples/iOSTutorial/AppDelegate.m index 728bcbcafd..5edbbadcbe 100644 --- a/examples/iOSTutorial/AppDelegate.m +++ b/examples/iOSTutorial/AppDelegate.m @@ -192,17 +192,16 @@ void groupFunc() { } // Write same group to memory buffer - /*size_t len; - const char* buffer = [group writeToBuffer]; + TightdbBinary *buffer = [group writeToBuffer]; - // Load a group from memory (and print contents) - TightdbGroup *fromMem = [TightdbGroup groupWithBuffer:buffer withError:nil]; - PeopleTable *memTable = [fromMem getTable:@"employees" withClass:[PeopleTable class] error:nil]; - - for (size_t i = 0; i < [memTable count]; i++) { - PeopleTable_Cursor *cursor = [memTable cursorAtIndex:i]; - NSLog(@"%zu: %@", i, cursor.Name); // using dot-syntax - }*/ + // Load a group from memory (and print contents) + TightdbGroup *fromMem = [TightdbGroup groupWithBuffer:buffer withError:nil]; + PeopleTable *memTable = [fromMem getTable:@"employees" withClass:[PeopleTable class] error:nil]; + + for (size_t i = 0; i < [memTable count]; i++) { + PeopleTable_Cursor *cursor = [memTable cursorAtIndex:i]; + NSLog(@"%zu: %@", i, cursor.Name); // using dot-syntax + } // @@EndExample@@ From ba62d525e6ba6b676e11b722cbf834740781c2f3 Mon Sep 17 00:00:00 2001 From: mekjaer Date: Thu, 27 Feb 2014 14:13:42 +0100 Subject: [PATCH 5/7] updated examples files with addEmptyRow --- .../TightDbObjcDyn.xcodeproj/project.pbxproj | 16 ++++++++++++---- doc/ref/data/typed_table_ref.yaml | 6 +++--- doc/ref/examples/ex_objc_query_dynamic_intro.m | 8 ++++---- doc/ref/examples/ex_objc_table_dynamic_intro.m | 8 ++++---- doc/ref/examples/ex_objc_table_typed_intro.m | 6 +++--- .../examples/ex_objc_tableview_dynamic_intro.m | 8 ++++---- doc/ref/examples/ex_objc_tableview_typed_intro.m | 6 +++--- src/tightdb/objc/test/functional.m | 4 ++-- src/tightdb/objc/test/typed_table.m | 4 ++-- 9 files changed, 37 insertions(+), 29 deletions(-) diff --git a/TightDbObjcDyn/TightDbObjcDyn.xcodeproj/project.pbxproj b/TightDbObjcDyn/TightDbObjcDyn.xcodeproj/project.pbxproj index 0547855f29..9cd852e18d 100644 --- a/TightDbObjcDyn/TightDbObjcDyn.xcodeproj/project.pbxproj +++ b/TightDbObjcDyn/TightDbObjcDyn.xcodeproj/project.pbxproj @@ -8,6 +8,9 @@ /* Begin PBXBuildFile section */ 4D79966018BDFC3E009EB0C0 /* table_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D79965F18BDFC3E009EB0C0 /* table_macros.h */; }; + 4DB1DEFB18BF70AE005A7234 /* dynamic_table.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DB1DEF818BF70AE005A7234 /* dynamic_table.m */; }; + 4DB1DEFC18BF70AE005A7234 /* functional.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DB1DEF918BF70AE005A7234 /* functional.m */; }; + 4DB1DEFD18BF70AE005A7234 /* typed_table.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DB1DEFA18BF70AE005A7234 /* typed_table.m */; }; E918909D177B677900653D7A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E918909C177B677900653D7A /* Cocoa.framework */; }; E91890AF177B677900653D7A /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E91890AE177B677900653D7A /* SenTestingKit.framework */; }; E91890B0177B677900653D7A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E918909C177B677900653D7A /* Cocoa.framework */; }; @@ -41,7 +44,6 @@ E91890FD177B71E400653D7A /* shared_group.m in Sources */ = {isa = PBXBuildFile; fileRef = E91890EF177B71E400653D7A /* shared_group.m */; }; E91890FE177B71E400653D7A /* subtable.m in Sources */ = {isa = PBXBuildFile; fileRef = E91890F0177B71E400653D7A /* subtable.m */; }; E91890FF177B71E400653D7A /* table_delete_all.m in Sources */ = {isa = PBXBuildFile; fileRef = E91890F1177B71E400653D7A /* table_delete_all.m */; }; - E9189100177B71E400653D7A /* table.m in Sources */ = {isa = PBXBuildFile; fileRef = E91890F2177B71E400653D7A /* table.m */; }; E9189101177B71E400653D7A /* template.m in Sources */ = {isa = PBXBuildFile; fileRef = E91890F3177B71E400653D7A /* template.m */; }; E9189102177B71E400653D7A /* tutorial.m in Sources */ = {isa = PBXBuildFile; fileRef = E91890F4177B71E400653D7A /* tutorial.m */; }; /* End PBXBuildFile section */ @@ -58,6 +60,9 @@ /* Begin PBXFileReference section */ 4D79965F18BDFC3E009EB0C0 /* table_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = table_macros.h; path = ../../src/tightdb/objc/table_macros.h; sourceTree = ""; }; + 4DB1DEF818BF70AE005A7234 /* dynamic_table.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = dynamic_table.m; path = ../../src/tightdb/objc/test/dynamic_table.m; sourceTree = ""; }; + 4DB1DEF918BF70AE005A7234 /* functional.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = functional.m; path = ../../src/tightdb/objc/test/functional.m; sourceTree = ""; }; + 4DB1DEFA18BF70AE005A7234 /* typed_table.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = typed_table.m; path = ../../src/tightdb/objc/test/typed_table.m; sourceTree = ""; }; E9189099177B677900653D7A /* TightDbObjcDyn.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = TightDbObjcDyn.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; E918909C177B677900653D7A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; E918909F177B677900653D7A /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; @@ -96,7 +101,6 @@ E91890EF177B71E400653D7A /* shared_group.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = shared_group.m; path = ../../src/tightdb/objc/test/shared_group.m; sourceTree = ""; }; E91890F0177B71E400653D7A /* subtable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = subtable.m; path = ../../src/tightdb/objc/test/subtable.m; sourceTree = ""; }; E91890F1177B71E400653D7A /* table_delete_all.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = table_delete_all.m; path = ../../src/tightdb/objc/test/table_delete_all.m; sourceTree = ""; }; - E91890F2177B71E400653D7A /* table.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = table.m; path = ../../src/tightdb/objc/test/table.m; sourceTree = ""; }; E91890F3177B71E400653D7A /* template.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = template.m; path = ../../src/tightdb/objc/test/template.m; sourceTree = ""; }; E91890F4177B71E400653D7A /* tutorial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = tutorial.m; path = ../../src/tightdb/objc/test/tutorial.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -199,6 +203,9 @@ E91890B4177B677900653D7A /* TightDbObjcDynTests */ = { isa = PBXGroup; children = ( + 4DB1DEF818BF70AE005A7234 /* dynamic_table.m */, + 4DB1DEF918BF70AE005A7234 /* functional.m */, + 4DB1DEFA18BF70AE005A7234 /* typed_table.m */, E91890E7177B71E400653D7A /* data_type.mm */, E91890E8177B71E400653D7A /* enumerator.m */, E91890E9177B71E400653D7A /* err_handling.mm */, @@ -210,7 +217,6 @@ E91890EF177B71E400653D7A /* shared_group.m */, E91890F0177B71E400653D7A /* subtable.m */, E91890F1177B71E400653D7A /* table_delete_all.m */, - E91890F2177B71E400653D7A /* table.m */, E91890F3177B71E400653D7A /* template.m */, E91890F4177B71E400653D7A /* tutorial.m */, E91890B5177B677900653D7A /* Supporting Files */, @@ -370,8 +376,10 @@ E91890FC177B71E400653D7A /* query.m in Sources */, E91890FD177B71E400653D7A /* shared_group.m in Sources */, E91890FE177B71E400653D7A /* subtable.m in Sources */, + 4DB1DEFC18BF70AE005A7234 /* functional.m in Sources */, + 4DB1DEFD18BF70AE005A7234 /* typed_table.m in Sources */, E91890FF177B71E400653D7A /* table_delete_all.m in Sources */, - E9189100177B71E400653D7A /* table.m in Sources */, + 4DB1DEFB18BF70AE005A7234 /* dynamic_table.m in Sources */, E9189101177B71E400653D7A /* template.m in Sources */, E9189102177B71E400653D7A /* tutorial.m in Sources */, ); diff --git a/doc/ref/data/typed_table_ref.yaml b/doc/ref/data/typed_table_ref.yaml index 32b876f33e..8bd31f4ea9 100755 --- a/doc/ref/data/typed_table_ref.yaml +++ b/doc/ref/data/typed_table_ref.yaml @@ -4,7 +4,7 @@ #UNIMPLEMENTED columns(), front(), back(), insert_empty_row(), lookup(), findAll() # via table Propery, get_sorted_view(), where(), distinct() -#INCONSISTENCY add.., addRow, vs. add_empty_row, and number of rows cannot be specified +#INCONSISTENCY add.., number of rows cannot be specified #INCONSISTENCY popBack(), find_first_* ->> find* ("first" is omitted) ID : class_typed_table @@ -192,13 +192,13 @@ CATEGORIES: DESCR : - g_typed_table_add_empty_row: - NAME : addRow + NAME : addEmptyRow SUMMARY : &objc_typed_table_add_empty_row_summary Adds an empty row and returns a cursor. You can use the cursor to get or set the values. DESCR : &objc_typed_table_add_empty_row_descr This method adds one empty row at the end of the table. Default values (e.g. 0 or "") will be inserted for all the columns in the row. - SIGNATURE: -(TableName_Cursor *)addRow; + SIGNATURE: -(TableName_Cursor *)addEmptyRow; RETURN: TYPES : TableName_Cursor * DESCR : Returns a typed cursor at the added row. Note that TableName is replaced with the name of your typed table. diff --git a/doc/ref/examples/ex_objc_query_dynamic_intro.m b/doc/ref/examples/ex_objc_query_dynamic_intro.m index e9a4d9d984..e6d6a77430 100644 --- a/doc/ref/examples/ex_objc_query_dynamic_intro.m +++ b/doc/ref/examples/ex_objc_query_dynamic_intro.m @@ -26,7 +26,7 @@ int main() /* Row 0 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:23 inColumn:AGE]; [cursor setString:@"Joe" inColumn:NAME]; @@ -34,7 +34,7 @@ int main() /* Row 1 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:32 inColumn:AGE]; [cursor setString:@"Simon" inColumn:NAME]; @@ -42,7 +42,7 @@ int main() /* Row 2 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:12 inColumn:AGE]; [cursor setString:@"Steve" inColumn:NAME]; @@ -50,7 +50,7 @@ int main() /* Row 3 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:59 inColumn:AGE]; [cursor setString:@"Nick" inColumn:NAME]; diff --git a/doc/ref/examples/ex_objc_table_dynamic_intro.m b/doc/ref/examples/ex_objc_table_dynamic_intro.m index 3ee1a3d4c6..860c96dfa2 100644 --- a/doc/ref/examples/ex_objc_table_dynamic_intro.m +++ b/doc/ref/examples/ex_objc_table_dynamic_intro.m @@ -22,28 +22,28 @@ int main() /* Row 0 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:23 inColumn:AGE]; [cursor setString:@"Joe" inColumn:NAME]; /* Row 1 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:32 inColumn:AGE]; [cursor setString:@"Simon" inColumn:NAME]; /* Row 2 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:12 inColumn:AGE]; [cursor setString:@"Steve" inColumn:NAME]; /* Row 3 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:100 inColumn:AGE]; [cursor setString:@"Nick" inColumn:NAME]; diff --git a/doc/ref/examples/ex_objc_table_typed_intro.m b/doc/ref/examples/ex_objc_table_typed_intro.m index 01a960425a..28e52bfd16 100644 --- a/doc/ref/examples/ex_objc_table_typed_intro.m +++ b/doc/ref/examples/ex_objc_table_typed_intro.m @@ -19,11 +19,11 @@ int main() PeopleTable *table = [[PeopleTable alloc] init]; - PeopleTable_Cursor *cursor = [table addRow]; + PeopleTable_Cursor *cursor = [table addEmptyRow]; cursor.Name = @"Brian"; cursor.Age = 10; - cursor = [table addRow]; + cursor = [table addEmptyRow]; cursor.Name = @"Sofie"; cursor.Age = 40; @@ -32,7 +32,7 @@ int main() Name:@"Jesper" Age:200]; */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; cursor.Name = @"Jesper"; cursor.Age = 200; diff --git a/doc/ref/examples/ex_objc_tableview_dynamic_intro.m b/doc/ref/examples/ex_objc_tableview_dynamic_intro.m index 918393a16f..d9b00706af 100644 --- a/doc/ref/examples/ex_objc_tableview_dynamic_intro.m +++ b/doc/ref/examples/ex_objc_tableview_dynamic_intro.m @@ -26,7 +26,7 @@ int main() /* Row 0 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:23 inColumn:AGE]; [cursor setString:@"Joe" inColumn:NAME]; @@ -34,7 +34,7 @@ int main() /* Row 1 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:32 inColumn:AGE]; [cursor setString:@"Simon" inColumn:NAME]; @@ -42,7 +42,7 @@ int main() /* Row 2 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:12 inColumn:AGE]; [cursor setString:@"Steve" inColumn:NAME]; @@ -50,7 +50,7 @@ int main() /* Row 3 */ - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setInt:59 inColumn:AGE]; [cursor setString:@"Nick" inColumn:NAME]; diff --git a/doc/ref/examples/ex_objc_tableview_typed_intro.m b/doc/ref/examples/ex_objc_tableview_typed_intro.m index 20fc4fb31f..e8d128240a 100644 --- a/doc/ref/examples/ex_objc_tableview_typed_intro.m +++ b/doc/ref/examples/ex_objc_tableview_typed_intro.m @@ -19,15 +19,15 @@ int main() /* Adds rows to the table. */ - PeopleTable_Cursor *cursor = [table addRow]; + PeopleTable_Cursor *cursor = [table addEmptyRow]; cursor.Name = @"Brian"; cursor.Age = 10; - cursor = [table addRow]; + cursor = [table addEmptyRow]; cursor.Name = @"Sofie"; cursor.Age = 40; - cursor = [table addRow]; + cursor = [table addEmptyRow]; cursor.Name = @"Sam"; cursor.Age = 76; diff --git a/src/tightdb/objc/test/functional.m b/src/tightdb/objc/test/functional.m index 3876603c9f..5d6f21e411 100644 --- a/src/tightdb/objc/test/functional.m +++ b/src/tightdb/objc/test/functional.m @@ -33,7 +33,7 @@ - (void)testTypedCursor // Add rows for (int i = 0; i < TABLE_SIZE; i++) { - cursor = [table addRow]; + cursor = [table addEmptyRow]; cursor.Name = [@"Person_" stringByAppendingString: [NSString stringWithFormat:@"%d",i]]; cursor.Age = i; cursor.Hired = i%2 == 0; @@ -162,7 +162,7 @@ - (void)testDynamicCursor // Add rows for (int i = 0; i < TABLE_SIZE; i++) { - cursor = [table addRow]; + cursor = [table addEmptyRow]; [cursor setString:[@"Person_" stringByAppendingString: [NSString stringWithFormat:@"%d",i]] inColumn:NAME]; [cursor setInt:i inColumn:AGE]; [cursor setBool:i%2 == 0 inColumn:HIRED]; diff --git a/src/tightdb/objc/test/typed_table.m b/src/tightdb/objc/test/typed_table.m index 3c7d48203a..bf034c5a38 100644 --- a/src/tightdb/objc/test/typed_table.m +++ b/src/tightdb/objc/test/typed_table.m @@ -73,12 +73,12 @@ - (void)testDataTypes_Typed TestTableAllTypes_Cursor* c; - c = [table addRow]; + c = [table addEmptyRow]; c.BoolCol = NO ; c.IntCol = 54 ; c.FloatCol = 0.7 ; c.DoubleCol = 0.8 ; c.StringCol = @"foo"; c.BinaryCol = bin1 ; c.DateCol = 0 ; c.TableCol = subtab1 ; c.MixedCol = mixInt1 ; - c = [table addRow]; + c = [table addEmptyRow]; c.BoolCol = YES ; c.IntCol = 506 ; c.FloatCol = 7.7 ; c.DoubleCol = 8.8 ; c.StringCol = @"banach"; c.BinaryCol = bin2 ; c.DateCol = timeNow ; c.TableCol = subtab2 ; c.MixedCol = mixSubtab ; From fb148c1d320b019f386b65f14c0da94fd10e97c5 Mon Sep 17 00:00:00 2001 From: mekjaer Date: Thu, 27 Feb 2014 16:31:25 +0100 Subject: [PATCH 6/7] removal of unneeded indentation --- examples/iOSTutorial/AppDelegate.m | 112 ++++++++++++++--------------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/examples/iOSTutorial/AppDelegate.m b/examples/iOSTutorial/AppDelegate.m index 5edbbadcbe..5c4ad17010 100644 --- a/examples/iOSTutorial/AppDelegate.m +++ b/examples/iOSTutorial/AppDelegate.m @@ -16,55 +16,55 @@ void tableFunc() { PeopleTable *people = [[PeopleTable alloc] init]; // (...) // @@EndExample@@ - + // @@Example: insert_rows @@ - + PeopleTable_Cursor *cursor; - + // Row 1 cursor = [people addEmptyRow]; cursor.Name = @"John"; cursor.Age = 21; cursor.Hired = YES; - + // Row 2 cursor = [people addEmptyRow]; cursor.Name = @"Mary"; cursor.Age = 76; cursor.Hired = NO; - + // Row 3 cursor = [people addEmptyRow]; cursor.Name = @"Lars"; cursor.Age = 22; cursor.Hired = YES; - + // Row 4 cursor = [people addEmptyRow]; cursor.Name = @"Phil"; cursor.Age = 43; cursor.Hired = NO; - + // Row 5 cursor = [people addEmptyRow]; cursor.Name = @"Anni"; cursor.Age = 54; cursor.Hired = YES; // @@EndExample@@ - + // @@Example: insert_at_index @@ cursor = [people insertRowAtIndex:2]; cursor.Name = @"Frank"; cursor.Age = 34; cursor.Hired = YES; - + // @@EndExample@@ - + // @@Example: number_of_rows @@ size_t cnt1 = [people count]; // cnt = 6 BOOL empty = [people isEmpty]; // empty = NO // @@EndExample@@ - + // @@Example: accessing_rows @@ // Getting values directly NSString* name = [people cursorAtIndex:5].Name; // => 'Anni' @@ -72,50 +72,50 @@ void tableFunc() { PeopleTable_Cursor *myRow = [people cursorAtIndex:5]; int64_t age = myRow.Age; // => 54 BOOL hired = myRow.Hired; // => true - + // Setting values [[people cursorAtIndex:5] setAge:43]; // Getting younger // or with dot-syntax: myRow.Age += 1; // Happy birthday! // @@EndExample@@ - + // @@Example: last_row @@ NSString *last = [people cursorAtLastIndex].Name; // => "Anni" // @@EndExample@@ - + // @@Example: updating_entire_row @@ // (TODO: a curser should be used here) [people setAtIndex:4 Name:"Eric" Age:50 Hired:YES]; // @EndExample@@ - + // @@Example: deleting_row @@ [people removeRowAtIndex:2]; size_t cnt2 = [people count]; // cnt = 5 // @@EndExample@@ - + // @@Example: iteration @@ for (size_t i = 0; i < [people count]; ++i) { PeopleTable_Cursor *row = [people cursorAtIndex:i]; NSLog(@"%@ is %lld years old", row.Name, row.Age); } // @@EndExample@@ - + // @@Example: simple_seach @@ size_t row; row = [people.Name find:@"Philip"]; // (size_t)-1. Not found row = [people.Name find:@"Mary"]; // row = 1 // @@EndExample@@ - + // @@Example: advanced_search @@ // Create query (current employees between 20 and 30 years old) PeopleTable_Query *q = [[[people where].Hired columnIsEqualTo:YES] .Age columnIsBetween:20 and_:30]; - + // Get number of matching entries size_t cnt3 = [q count]; // => 2 - + // Get the average age (currently only a low-level interface) NSNumber *avg = [q.Age average]; - + // Execute the query and return a table (view) PeopleTable_View *res = [q findAll]; for (size_t i = 0; i < [res count]; ++i) { @@ -123,124 +123,122 @@ void tableFunc() { [people cursorAtIndex:i].Name, [people cursorAtIndex:i].Age); } - + // Alternatively with fast emunaration for (PeopleTable_Cursor *c in res) NSLog(@"%@ is %lld years old", c.Name, c.Age); - + // @@EndExample@@ - + } void groupFunc() { - + // @@Example: serialisation @@ // Create Table in Group TightdbGroup *group = [TightdbGroup group]; PeopleTable *people = [group getTable:@"employees" withClass:[PeopleTable class] error:nil]; - + // Add some rows PeopleTable_Cursor *cursor; - + // Row 1 cursor = [people addEmptyRow]; cursor.Name = @"John"; cursor.Age = 21; cursor.Hired = YES; - + // Row 2 cursor = [people addEmptyRow]; cursor.Name = @"Mary"; cursor.Age = 21; cursor.Hired = NO; - + // Row 3 cursor = [people addEmptyRow]; cursor.Name = @"Lars"; cursor.Age = 21; cursor.Hired = YES; - + // Row 4 cursor = [people addEmptyRow]; cursor.Name = @"Phil"; cursor.Age = 43; cursor.Hired = NO; - + // Row 5 cursor = [people addEmptyRow]; cursor.Name = @"Anni"; cursor.Age = 54; cursor.Hired = YES; - + // Delete any old file by same name // IMPORTANT: write will fail if the file exists. NSFileManager *manager = [NSFileManager defaultManager]; [manager removeItemAtPath:@"employees.tightdb" error:nil]; - + // Write to disk [group writeToFile:@"employees.tightdb" withError:nil]; - + // Load a group from disk (and print contents) TightdbGroup *fromDisk = [TightdbGroup groupWithFile:@"employees.tightdb" withError:nil]; PeopleTable *diskTable = [fromDisk getTable:@"employees" withClass:[PeopleTable class] error:nil]; - + NSLog(@"Disktable size: %zu", [diskTable count]); for (size_t i = 0; i < [diskTable count]; i++) { PeopleTable_Cursor *cursor = [diskTable cursorAtIndex:i]; NSLog(@"%zu: %@", i, [cursor Name]); // using std. method } - + // Write same group to memory buffer TightdbBinary *buffer = [group writeToBuffer]; - + // Load a group from memory (and print contents) TightdbGroup *fromMem = [TightdbGroup groupWithBuffer:buffer withError:nil]; PeopleTable *memTable = [fromMem getTable:@"employees" withClass:[PeopleTable class] error:nil]; - + for (size_t i = 0; i < [memTable count]; i++) { PeopleTable_Cursor *cursor = [memTable cursorAtIndex:i]; NSLog(@"%zu: %@", i, cursor.Name); // using dot-syntax - } - - - // @@EndExample@@ - - } + // @@EndExample@@ + + +} void sharedGroupFunc() { - + // @@Example: transaction @@ TightdbSharedGroup *sharedGroup = [TightdbSharedGroup sharedGroupWithFile:@"people.tightdb" withError:nil]; - + // A write transaction (with rollback if not first writer to employees table). - + [sharedGroup writeWithBlock:^(TightdbGroup *group) { - + // Write transactions with the shared group are possible via the provided variable binding named group. - + PeopleTable *table = [group getTable:@"employees" withClass:[PeopleTable class] error:nil]; if ([table count] > 0) { NSLog(@"Not empty!"); return NO; // Rollback } - + [table addName:@"Bill" Age:53 Hired:YES]; NSLog(@"Row added!"); return YES; // Commit - + } withError:nil]; - + // A read transaction - + [sharedGroup readWithBlock:^(TightdbGroup *group) { - + // Read transactions with the shared group are possible via the provided variable binding named group. - + PeopleTable *table = [group getTable:@"employees" withClass:[PeopleTable class] error:nil]; - + for (PeopleTable_Cursor *curser in table) { NSLog(@"Name: %@", [curser Name]); } @@ -252,7 +250,7 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - + tableFunc(); groupFunc(); sharedGroupFunc(); From 1d046902ca12d22cc45352b5bb2f5492eb958973 Mon Sep 17 00:00:00 2001 From: mekjaer Date: Thu, 27 Feb 2014 16:32:47 +0100 Subject: [PATCH 7/7] query syntax updated --- examples/iOSTutorial/AppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/iOSTutorial/AppDelegate.m b/examples/iOSTutorial/AppDelegate.m index 5c4ad17010..5f48b15059 100644 --- a/examples/iOSTutorial/AppDelegate.m +++ b/examples/iOSTutorial/AppDelegate.m @@ -108,7 +108,7 @@ void tableFunc() { // @@Example: advanced_search @@ // Create query (current employees between 20 and 30 years old) PeopleTable_Query *q = [[[people where].Hired columnIsEqualTo:YES] - .Age columnIsBetween:20 and_:30]; + .Age columnIsBetween:20 and_:30]; // Get number of matching entries size_t cnt3 = [q count]; // => 2