-/** Copyright (c) 2017 Samsung Electronics Co., Ltd.
+/** Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "string"
#include <dali/public-api/adaptor-framework/application.h>
#include <dali/devel-api/adaptor-framework/application-devel.h>
+#include <dali/integration-api/adaptors/adaptor.h>
/* Callback for returning strings to C# without leaking memory */
typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
extern SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback;
-
+namespace
+{
// keep argcs and argv so they're always available to DALi
-int argC = 1;
-char **argV = NULL;
+int gArgC = 0;
+char** gArgV = nullptr;
+} // unnamed namespace
SWIGINTERN bool Dali_Signal_Sl_void_Sp_Dali_DeviceStatus_Battery_Status_SP__Sg__Empty(Dali::Signal< void (Dali::DeviceStatus::Battery::Status) > const *self){
return self->Empty();
SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_1(int jarg1) {
void * jresult ;
- int *arg1 = (int *) 0 ;
- char ***arg2 ;
- Dali::Application result;
+ Dali::Application result;
{
- // Todo generate argv data from the C# args
- char **array; // two dimensional array
- int numStrings = 1; // number of strings
- int stringLength = 30; // max string length.
- array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
- argV = array;
-
- // allocate the string data
- for( int i=0; i < numStrings; i++)
- {
- array[i]=(char *)malloc( stringLength * sizeof(char) );
- }
- array[ numStrings ] = NULL; // we allocated +1 for hold the NULL part
-
- std::string temp = "dali-csharp-app";
- array[0][temp.copy(array[0], strlen(array[0])-1)] = '\0';
+ std::string app_name = "dali-csharp-app";
+ int stringLength = app_name.length();
+ gArgC = 1;
+ gArgV = new char*[gArgC + 1];
+ gArgV[0] = new char[stringLength + 1];
- arg1 = &argC;
- arg2 = &argV;
+ strncpy(gArgV[0], app_name.c_str(), stringLength);
+ gArgV[0][stringLength] = '\0';
+ gArgV[1] = NULL;
}
{
try {
- result = Dali::Application::New(arg1,arg2);
+ result = Dali::Application::New( &gArgC, &gArgV );
} catch (std::out_of_range& e) {
{
SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_2(int jarg1, char * jarg3) {
void * jresult ;
- int *arg1 = (int *) 0 ;
- char ***arg2 ;
- std::string *arg3 = 0 ;
- Dali::Application result;
+ std::string *arg3 = 0;
+ Dali::Application result;
{
- // Todo generate argv data from the C# args
- char **array; // two dimensional array
- int numStrings = 1; // number of strings
- int stringLength = 30; // max string length.
- array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
- argV = array;
+ std::string app_name = "dali-csharp-app";
+ int stringLength = app_name.length();
+ gArgC = 1;
+ gArgV = new char*[gArgC + 1];
+ gArgV[0] = new char[stringLength + 1];
- // allocate the string data
- for( int i=0; i < numStrings; i++)
- {
- array[i]=(char *)malloc( stringLength * sizeof(char) );
- }
- array[ numStrings ] = NULL; // we allocated +1 for hold the NULL part
-
- std::string temp = "dali-csharp-app";
- array[0][temp.copy(array[0], strlen(array[0])-1)] = '\0';
-
- arg1 = &argC;
- arg2 = &argV;
+ strncpy(gArgV[0], app_name.c_str(), stringLength);
+ gArgV[0][stringLength] = '\0';
+ gArgV[1] = NULL;
}
if (!jarg3) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+ delete []gArgV[0];
+ delete []gArgV;
+ gArgV = nullptr;
return 0;
}
std::string arg3_str(jarg3);
arg3 = &arg3_str;
{
try {
- result = Dali::Application::New(arg1,arg2,(std::string const &)*arg3);
+ result = Dali::Application::New( &gArgC, &gArgV, (std::string const &)*arg3 );
} catch (std::out_of_range& e) {
{
SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_3(int jarg1, char * jarg3, int jarg4) {
void * jresult ;
- int *arg1 = (int *) 0 ;
- char ***arg2 ;
- std::string *arg3 = 0 ;
- Dali::Application::WINDOW_MODE arg4 ;
- Dali::Application result;
+ Dali::Application::WINDOW_MODE arg4;
+ Dali::Application result;
{
- // Todo generate argv data from the C# args
- char **array; // two dimensional array
- int numStrings = 1; // number of strings
- int stringLength = 30; // max string length.
- array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
- argV = array;
+ std::string app_name = "dali-csharp-app";
+ int stringLength = app_name.length();
+ gArgC = 1;
+ gArgV = new char*[gArgC + 1];
+ gArgV[0] = new char[stringLength + 1];
- // allocate the string data
- for( int i=0; i < numStrings; i++)
- {
- array[i]=(char *)malloc( stringLength * sizeof(char) );
- }
- array[ numStrings ] = NULL; // we allocated +1 for hold the NULL part
-
- std::string temp = "dali-csharp-app";
- array[0][temp.copy(array[0], strlen(array[0])-1)] = '\0';
-
- arg1 = &argC;
- arg2 = &argV;
+ strncpy(gArgV[0], app_name.c_str(), stringLength);
+ gArgV[0][stringLength] = '\0';
+ gArgV[1] = NULL;
}
if (!jarg3) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+ delete []gArgV[0];
+ delete []gArgV;
+ gArgV = nullptr;
return 0;
}
- std::string arg3_str(jarg3);
- arg3 = &arg3_str;
+ std::string arg3(jarg3);
arg4 = (Dali::Application::WINDOW_MODE)jarg4;
{
try {
- result = Dali::Application::New(arg1,arg2,(std::string const &)*arg3,arg4);
+ result = Dali::Application::New( &gArgC, &gArgV, arg3, arg4 );
} catch (std::out_of_range& e) {
{
SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
void * jresult ;
int *arg1 = (int *) 0 ;
char ***arg2 ;
- std::string *arg3 = 0 ;
Dali::Application::WINDOW_MODE arg4 ;
Dali::Application result;
{
// Todo generate argv data from the C# args
int index = 0;
- char *retPtr;
+ int length = 0;
+ char *retPtr = NULL;
char *nextPtr;
- argV = new char*[jarg1 + 1];
+ gArgV = new char*[jarg1 + 1];
- retPtr = strtok_r(jarg2," ", &nextPtr);
- argV[index] = new char[strlen(retPtr)+1];
- strncpy( argV[index], retPtr, strlen(retPtr) );
- argV[index][strlen(retPtr)] = '\0';
- index++;
+ for(retPtr = strtok_r(jarg2, " ", &nextPtr);
+ retPtr != NULL && index < jarg1;
+ retPtr = strtok_r(NULL, " ", &nextPtr))
+ {
+ length = 0;
+ length = strlen(retPtr);
+ gArgV[ index ] = new char[ length + 1 ];
+ strncpy( gArgV[ index ], retPtr, length );
+ gArgV[ index ][ length ] = '\0';
+ index++;
+ }
while( index < jarg1 )
{
- retPtr = strtok_r(NULL," ", &nextPtr);
- argV[index] = new char[strlen(retPtr)+1];
- strncpy( argV[index], retPtr, strlen(retPtr) );
- argV[index][strlen(retPtr)] = '\0';
+ //if jarg1 - index >1, maybe cause error.
+ gArgV[index] = NULL;
index++;
}
- argV[jarg1] = NULL;
- argC = jarg1;
-
- arg1 = &argC;
- arg2 = &argV;
+ gArgV[jarg1] = NULL;
+ gArgC = jarg1;
+ arg1 = &gArgC;
+ arg2 = &gArgV;
}
- std::string arg3_str(jarg3);
- arg3 = &arg3_str;
+ std::string arg3(jarg3);
arg4 = (Dali::Application::WINDOW_MODE)jarg4;
{
try {
- result = Dali::Application::New(arg1,arg2,(std::string const &)*arg3,arg4);
+ result = Dali::Application::New( arg1, arg2, arg3, arg4);
} catch (std::out_of_range& e) {
{
SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
{
try {
delete arg1;
- if( argV )
+ if( gArgV )
{
// free string data
- for( int i=0; i < argC+1; i++)
+ for( int i=0; i < gArgC+1; i++)
{
- delete [] argV[i];
+ delete [] gArgV[i];
}
- delete [] argV;
+ delete [] gArgV;
}
} catch (std::out_of_range& e) {
{
return jresult;
}
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Dali_Application_GetWindowsListSize() {
+ unsigned int jresult ;
+ Dali::WindowContainer result;
+ {
+ try {
+ result = Dali::Adaptor::Get().GetWindows();
+ jresult = result.size();
+ } catch (std::out_of_range& e) {
+ {
+ SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (std::exception& e) {
+ {
+ SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (Dali::DaliException e) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
+ };
+ } catch (...) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+ };
+ }
+ }
+ return jresult;
+}
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_GetWindowsFromList(uint jarg1) {
+ void * jresult ;
+ uint index = jarg1;
+ Dali::WindowContainer result;
+
+ {
+ try {
+ result = Dali::Adaptor::Get().GetWindows();
+ } catch (std::out_of_range& e) {
+ {
+ SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (std::exception& e) {
+ {
+ SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (Dali::DaliException e) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
+ };
+ } catch (...) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+ };
+ }
+ }
+ jresult = new Dali::Window((const Dali::Window &)result[index]);
+ return jresult;
+}
SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Application_ReplaceWindow(void * jarg1, void * jarg2, char * jarg3) {
Dali::Application *arg1 = (Dali::Application *) 0 ;
void * jresult ;
int *arg1 = (int *) 0 ;
char ***arg2 ;
- std::string *arg3 = 0 ;
Dali::Application::WINDOW_MODE arg4 ;
Dali::PositionSize arg5 ;
Dali::PositionSize *argp5 ;
int numStrings = 1; // number of strings
int stringLength = 30; // max string length.
array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
- argV = array;
+ if(!array) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "array is null", 0);
+ return 0;
+ }
+ gArgV = array;
// allocate the string data
for( int i=0; i < numStrings; i++)
array[ numStrings ] = NULL; // we allocated +1 for hold the NULL part
std::string temp = "dali-csharp-app";
+
+ if(!array[0]) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "array[0] is null", 0);
+ return 0;
+ }
array[0][temp.copy(array[0], strlen(array[0])-1)] = '\0';
- arg1 = &argC;
- arg2 = &argV;
+ arg1 = &gArgC;
+ arg2 = &gArgV;
}
if (!jarg3) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return 0;
}
- std::string arg3_str(jarg3);
- arg3 = &arg3_str;
+ std::string arg3(jarg3);
arg4 = (Dali::Application::WINDOW_MODE)jarg4;
argp5 = (Dali::PositionSize *)jarg5;
if (!argp5) {
arg5 = *argp5;
{
try {
- result = Dali::Application::New(arg1,arg2,(std::string const &)*arg3,arg4,arg5);
+ result = Dali::Application::New( arg1, arg2, arg3, arg4, arg5 );
} catch (std::out_of_range& e) {
{
SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
}
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New_WithWindowSizePosition(int jarg1, char * jarg2, char * jarg3, int jarg4, void * jarg5) {
+ void * jresult ;
+ int *arg1 = (int *) 0 ;
+ char ***arg2 ;
+ Dali::Application::WINDOW_MODE arg4 ;
+ Dali::PositionSize arg5 ;
+ Dali::PositionSize *argp5 ;
+ Dali::Application result;
+ {
+ int index = 0;
+ int length = 0;
+ char *retPtr = NULL;
+ char *nextPtr;
+
+ gArgV = new char*[jarg1 + 1];
+
+ for(retPtr = strtok_r(jarg2, " ", &nextPtr);
+ retPtr != NULL && index < jarg1;
+ retPtr = strtok_r(NULL, " ", &nextPtr))
+ {
+ length = 0;
+ length = strlen(retPtr);
+ gArgV[ index ] = new char[ length + 1 ];
+ strncpy( gArgV[ index ], retPtr, length );
+ gArgV[ index ][ length ] = '\0';
+ index++;
+ }
+
+ while( index < jarg1 )
+ {
+ //if jarg1 - index >1, maybe cause error.
+ gArgV[index] = NULL;
+ index++;
+ }
+
+ gArgV[jarg1] = NULL;
+ gArgC = jarg1;
+
+ arg1 = &gArgC;
+ arg2 = &gArgV;
+ }
+
+ std::string arg3(jarg3);
+ arg4 = (Dali::Application::WINDOW_MODE)jarg4;
+ argp5 = (Dali::PositionSize *)jarg5;
+ if (!argp5) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::PositionSize", 0);
+ return 0;
+ }
+ arg5 = *argp5;
+ {
+ try {
+ result = Dali::Application::New( arg1, arg2, arg3, arg4, arg5 );
+ } catch (std::out_of_range& e) {
+ {
+ SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (std::exception& e) {
+ {
+ SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (Dali::DaliException e) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
+ };
+ } catch (...) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+ };
+ }
+ }
+ jresult = new Dali::Application((const Dali::Application &)result);
+ return jresult;
+}
+
#ifdef __cplusplus
}