OSDN Git Service

release part9
[moflib/moflib.git] / extlib / luabind-0.8 / luabind / detail / implicit_cast.hpp
1 // Copyright (c) 2003 Daniel Wallin and Arvid Norberg
2
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the "Software"),
5 // to deal in the Software without restriction, including without limitation
6 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 // and/or sell copies of the Software, and to permit persons to whom the
8 // Software is furnished to do so, subject to the following conditions:
9
10 // The above copyright notice and this permission notice shall be included
11 // in all copies or substantial portions of the Software.
12
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
14 // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
15 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17 // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
18 // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21 // OR OTHER DEALINGS IN THE SOFTWARE.
22
23
24 #ifndef LUABIND_IMPLICIT_CAST_HPP_INCLUDED
25 #define LUABIND_IMPLICIT_CAST_HPP_INCLUDED
26
27 #include <luabind/config.hpp>
28 #include <luabind/detail/class_rep.hpp>
29
30 namespace luabind { namespace detail
31 {
32         // returns -1 if there exists no implicit cast from the given class_rep
33         // to T. If there exists an implicit cast to T, the number of steps times 2
34         // is returned and pointer_offset is filled with the number of bytes
35         // the pointer have to be offseted to perform the cast
36         // the reason why we return the number of cast-steps times two, instead of
37         // just the number of steps is to be consistent with the function matchers. They
38         // have to give one matching-point extra to match const functions. There may be
39         // two functions that match their parameters exactly, but there is one const
40         // function and one non-const function, then (if the this-pointer is non-const)
41         // both functions will match. To avoid amiguaties, the const version will get
42         // one penalty point to make the match-selector select the non-const version. It
43         // the this-pointer is const, there's no problem, since the non-const function
44         // will not match at all.
45
46         LUABIND_API int implicit_cast(const class_rep*, LUABIND_TYPE_INFO const&, int&);
47
48 }}
49
50 #endif // LUABIND_IMPLICIT_CAST_HPP_INCLUDED
51