ni_nitdoc: simplified github option
[nit.git] / tests / test_ni_null.nit.c
1 /* This file is part of NIT ( http://www.nitlanguage.org ).
2 *
3 * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
4 *
5 * This file is free software, which comes along with NIT. This software is
6 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 * is kept unaltered, and a notification of the changes is added.
10 * You are allowed to redistribute it and sell it, alone or is a part of
11 * another product.
12 */
13
14 #include "test_ni_null.nit.h"
15
16 /*
17 C implementation of test_ni_null::A::is_int_null
18
19 Imported methods signatures:
20 int Int_is_null( nullable_Int value ) to check if a nullable Int is a Int
21 bigint bigint_as_not_null( nullable_Int value ) to cast from nullable Int to Int
22 */
23 int A_is_int_null___impl( A recv, nullable_Int ni )
24 {
25 return Int_is_null( ni );
26 }
27
28 /*
29 C implementation of test_ni_null::A::is_a_null
30
31 Imported methods signatures:
32 int A_is_null( nullable_A value ) to check if a nullable A is a A
33 A A_as_not_null( nullable_A value ) to cast from nullable A to A
34 */
35 int A_is_a_null___impl( A recv, nullable_A na )
36 {
37 return A_is_null( na );
38 }
39
40 /*
41 C implementation of test_ni_null::A::get_nullable_string
42
43 Imported methods signatures:
44 String NativeString_to_s( char * str ) for string::NativeString::to_s
45 nullable_String String_as_nullable( String value ) to cast from String to nullable String
46 */
47 nullable_String A_get_nullable_string___impl( A recv, int get_nulled )
48 {
49 if ( get_nulled )
50 {
51 return null_String();
52 }
53 else
54 {
55 return String_as_nullable( NativeString_to_s( "something" ) );
56 }
57 }