• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 Antony Polukhin.
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef BOOST_DLL_MY_CPP_PLUGIN_API_HPP
8 #define BOOST_DLL_MY_CPP_PLUGIN_API_HPP
9 
10 //[cppplug
11 #include <string>
12 
13 namespace space {
14 
15 class BOOST_SYMBOL_EXPORT my_plugin
16 {
17     std::string _name;
18 public:
19    std::string name() const;
20    float  calculate(float x, float y);
21    int    calculate(int, x,  int y);
22    static std::size_t size();
23    my_plugin(const std::string & name);
24    my_plugin();
25    ~my_plugin_api();
26    static int value;
27 };
28 
29 }
30 //]
31 
name() const32 std::string space::my_plugin_api::name() const {return _name;}
calculate(float x,float y)33 float  space::my_plugin::calculate(float x, float y) {return x/y;}
calculate(int,x,int y)34 int    space::my_plugin::calculate(int, x, int y)    {return x/y;}
size()35 std::size_t my_plugin::size() {return sizeof(my_plugin);}
my_plugin(const std::string & name)36 space::my_plugin::my_plugin(const std::string & name) : _name(name) {}
my_plugin()37 space::my_plugin::my_plugin() : _name("Empty") {}
~my_plugin_api()38 space::my_plugin::~my_plugin_api() {}
39 int space::my_plugin::value = 42;
40 
41 
42 #endif // BOOST_DLL_MY_PLUGIN_API_HPP
43 
44