refcounting_plugin.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2014 Renato Tegon Forti, Antony Polukhin.
  2. // Copyright 2015-2019 Antony Polukhin.
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt
  6. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. // MinGW related workaround
  8. #define BOOST_DLL_FORCE_ALIAS_INSTANTIATION
  9. //[plugcpp_my_plugin_refcounting
  10. #include "refcounting_plugin.hpp"
  11. #include <boost/dll/runtime_symbol_info.hpp> // for this_line_location()
  12. namespace my_namespace {
  13. class my_plugin_refcounting : public my_refcounting_api {
  14. public:
  15. // Must be instantiated in plugin
  16. boost::dll::fs::path location() const {
  17. return boost::dll::this_line_location(); // location of this plugin
  18. }
  19. std::string name() const {
  20. return "refcounting";
  21. }
  22. // ...
  23. //<-
  24. // This block is invisible for Quickbook documentation
  25. float calculate(float /*x*/, float /*y*/) {
  26. return 0;
  27. }
  28. //->
  29. };
  30. } // namespace my_namespace
  31. // Factory method. Returns *simple pointer*!
  32. my_refcounting_api* create() {
  33. return new my_namespace::my_plugin_refcounting();
  34. }
  35. //]