efl/src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc

82 lines
1.7 KiB
C++
Raw Normal View History

/*
* Copyright 2019 by its authors. See AUTHORS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Disabled test while Ecore Eo API is still rapidly changing
#if 0
#include <iostream>
#include <thread>
#include <cassert>
#include <sstream>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Eo.h>
#include <Ecore.h>
#include <Evas.h>
#include <Ecore_Evas.h>
#include <Eina.hh>
#include <Eo.hh>
#include <Ecore.hh>
#include <Evas.hh>
#include <ecore_poller.eo.hh>
namespace efl { namespace ecore {
using ::ecore::poller;
} }
void
example_callbacks()
{
int count = 0;
efl::ecore::poller poller(
eolain_cxx: Fix C++ support for new Eolian features Added optional constructor methods for C++ Eolian wrappers. Changed the interface of wrappers' main constructors. If there are optional constructor methods they should be passed as variadic template argument at the end of the constructor. To support variadic template arguments, the optional "parent" parameter is now the first parameter and there is another constructor without the "parent" parameter. Checking for @optinal and @nullable attributes instead of @nonull. Now @nonull is the default, and eina::optional is only used when @optional or @nullable attribute is specified. The names of constructor methods no longer have the class name prefixed. Added unit tests for checking the binding of optional constructors. Added new .eo file to be used in the test. Changed the generated documentation of constructors. Changed the efl::eo::inherit accordingly, to address these new features. Now the constructor methods should be explicit called in the efl::eo::inherit constructor, which will receive them via variadic template arguments. Added another constructor to efl::eo::inherit for passing the parent object. Updated some tests and examples to follow the new interface. Removed some code that is no longer necessary. Also, fix Eolian C++ support for constructing properties. fix assertion when parsing constructing properties. Now if a property is a constructing property eolian_cxx will generate a constructor method that have the property name (without the "_set" suffix).
2015-03-26 07:48:09 -07:00
poller.constructor(ECORE_POLLER_CORE, 1,
[&count, &poller]
{
if (++count == 5)
{
std::cout << std::endl;
ecore_main_loop_quit();
return false;
}
poller.interval_set(2*poller.interval_get());
std::cout << "." << std::flush;
return true;
})
);
::ecore_main_loop_begin();
}
int main()
{
efl::eina::eina_init eina_;
efl::eo::eo_init eo_;
efl::ecore::ecore_init ecore_;
std::cerr << "[+] Running EFL++ example: Callbacks" << std::endl;
example_callbacks();
return 0;
}
#else
int main()
{
}
#endif