File indexing completed on 2025-02-16 07:42:47
0001 #pragma once 0002 /* 0003 * FakeIt - A Simplified C++ Mocking Framework 0004 * Copyright (c) Eran Pe'er 2013 0005 * Generated: 2021-05-12 13:47:05.726214 0006 * Distributed under the MIT License. Please refer to the LICENSE file at: 0007 * https://github.com/eranpeer/FakeIt 0008 */ 0009 /* 0010 SPDX-FileCopyrightText: (c) Eran Pe'er 2013 https://github.com/eranpeer/FakeIt 0011 SPDX-License-Identifier: MIT 0012 */ 0013 0014 #include <functional> 0015 #include <memory> 0016 #include <set> 0017 #include <vector> 0018 #include <stdexcept> 0019 #if defined (__GNUG__) || _MSC_VER >= 1900 0020 #define THROWS noexcept(false) 0021 #define NO_THROWS noexcept(true) 0022 #elif defined (_MSC_VER) 0023 #define THROWS throw(...) 0024 #define NO_THROWS 0025 #endif 0026 #include <typeinfo> 0027 #include <unordered_set> 0028 #include <tuple> 0029 #include <string> 0030 #include <iosfwd> 0031 #include <atomic> 0032 #include <tuple> 0033 0034 0035 namespace fakeit { 0036 0037 template<class C> 0038 struct naked_type { 0039 typedef typename std::remove_cv<typename std::remove_reference<C>::type>::type type; 0040 }; 0041 0042 template< class T > struct tuple_arg { typedef T type; }; 0043 template< class T > struct tuple_arg < T& > { typedef T& type; }; 0044 template< class T > struct tuple_arg < T&& > { typedef T&& type; }; 0045 0046 0047 0048 0049 template<typename... arglist> 0050 using ArgumentsTuple = std::tuple < arglist... > ; 0051 0052 template< class T > struct test_arg { typedef T& type; }; 0053 template< class T > struct test_arg< T& > { typedef T& type; }; 0054 template< class T > struct test_arg< T&& > { typedef T& type; }; 0055 0056 template< class T > struct production_arg { typedef T& type; }; 0057 template< class T > struct production_arg< T& > { typedef T& type; }; 0058 template< class T > struct production_arg< T&& > { typedef T&& type; }; 0059 0060 template <typename T> 0061 class is_ostreamable { 0062 struct no {}; 0063 #if defined(_MSC_VER) && _MSC_VER < 1900 0064 template <typename T1> 0065 static decltype(operator<<(std::declval<std::ostream&>(), std::declval<const T1>())) test(std::ostream &s, const T1 &t); 0066 #else 0067 template <typename T1> 0068 static auto test(std::ostream &s, const T1 &t) -> decltype(s << t); 0069 #endif 0070 static no test(...); 0071 public: 0072 0073 static const bool value = 0074 std::is_arithmetic<T>::value || 0075 std::is_pointer<T>::value || 0076 std::is_same<decltype(test(*(std::ostream *)nullptr, 0077 std::declval<T>())), std::ostream &>::value; 0078 }; 0079 0080 0081 template <> 0082 class is_ostreamable<std::ios_base& (*)(std::ios_base&)> { 0083 public: 0084 static const bool value = true; 0085 }; 0086 0087 template <typename CharT, typename Traits> 0088 class is_ostreamable<std::basic_ios<CharT,Traits>& (*)(std::basic_ios<CharT,Traits>&)> { 0089 public: 0090 static const bool value = true; 0091 }; 0092 0093 template <typename CharT, typename Traits> 0094 class is_ostreamable<std::basic_ostream<CharT,Traits>& (*)(std::basic_ostream<CharT,Traits>&)> { 0095 public: 0096 static const bool value = true; 0097 }; 0098 0099 template<typename R, typename... arglist> 0100 struct VTableMethodType { 0101 #if defined (__GNUG__) 0102 typedef R(*type)(void *, arglist...); 0103 #elif defined (_MSC_VER) 0104 typedef R(__thiscall *type)(void *, arglist...); 0105 #endif 0106 }; 0107 } 0108 #include <typeinfo> 0109 #include <tuple> 0110 #include <string> 0111 #include <iosfwd> 0112 #include <sstream> 0113 #include <string> 0114 0115 namespace fakeit { 0116 0117 struct FakeitContext; 0118 0119 template<typename C> 0120 struct MockObject { 0121 virtual ~MockObject() THROWS { }; 0122 0123 virtual C &get() = 0; 0124 0125 virtual FakeitContext &getFakeIt() = 0; 0126 }; 0127 0128 struct MethodInfo { 0129 0130 static unsigned int nextMethodOrdinal() { 0131 static std::atomic_uint ordinal{0}; 0132 return ++ordinal; 0133 } 0134 0135 MethodInfo(unsigned int anId, std::string aName) : 0136 _id(anId), _name(aName) { } 0137 0138 unsigned int id() const { 0139 return _id; 0140 } 0141 0142 std::string name() const { 0143 return _name; 0144 } 0145 0146 void setName(const std::string &value) { 0147 _name = value; 0148 } 0149 0150 private: 0151 unsigned int _id; 0152 std::string _name; 0153 }; 0154 0155 struct UnknownMethod { 0156 0157 static MethodInfo &instance() { 0158 static MethodInfo instance(MethodInfo::nextMethodOrdinal(), "unknown"); 0159 return instance; 0160 } 0161 0162 }; 0163 0164 } 0165 namespace fakeit { 0166 class Destructible { 0167 public: 0168 virtual ~Destructible() {} 0169 }; 0170 } 0171 0172 namespace fakeit { 0173 0174 struct Invocation : Destructible { 0175 0176 static unsigned int nextInvocationOrdinal() { 0177 static std::atomic_uint invocationOrdinal{0}; 0178 return ++invocationOrdinal; 0179 } 0180 0181 struct Matcher { 0182 0183 virtual ~Matcher() THROWS { 0184 } 0185 0186 virtual bool matches(Invocation &invocation) = 0; 0187 0188 virtual std::string format() const = 0; 0189 }; 0190 0191 Invocation(unsigned int ordinal, MethodInfo &method) : 0192 _ordinal(ordinal), _method(method), _isVerified(false) { 0193 } 0194 0195 virtual ~Invocation() override = default; 0196 0197 unsigned int getOrdinal() const { 0198 return _ordinal; 0199 } 0200 0201 MethodInfo &getMethod() const { 0202 return _method; 0203 } 0204 0205 void markAsVerified() { 0206 _isVerified = true; 0207 } 0208 0209 bool isVerified() const { 0210 return _isVerified; 0211 } 0212 0213 virtual std::string format() const = 0; 0214 0215 private: 0216 const unsigned int _ordinal; 0217 MethodInfo &_method; 0218 bool _isVerified; 0219 }; 0220 0221 } 0222 #include <iosfwd> 0223 #include <tuple> 0224 #include <string> 0225 #include <sstream> 0226 #include <ostream> 0227 0228 namespace fakeit { 0229 0230 template<typename T, class Enable = void> 0231 struct Formatter; 0232 0233 template <> 0234 struct Formatter<bool> 0235 { 0236 static std::string format(bool const &val) 0237 { 0238 return val ? "true" : "false"; 0239 } 0240 }; 0241 0242 template <> 0243 struct Formatter<char> 0244 { 0245 static std::string format(char const &val) 0246 { 0247 std::string s; 0248 s += "'"; 0249 s += val; 0250 s += "'"; 0251 return s; 0252 } 0253 }; 0254 0255 template <> 0256 struct Formatter<char const*> 0257 { 0258 static std::string format(char const* const &val) 0259 { 0260 std::string s; 0261 if(val != nullptr) 0262 { 0263 s += '"'; 0264 s += val; 0265 s += '"'; 0266 } 0267 else 0268 { 0269 s = "[nullptr]"; 0270 } 0271 return s; 0272 } 0273 }; 0274 0275 template <> 0276 struct Formatter<char*> 0277 { 0278 static std::string format(char* const &val) 0279 { 0280 return Formatter<char const*>::format( val ); 0281 } 0282 }; 0283 0284 template<class C> 0285 struct Formatter<C, typename std::enable_if<!is_ostreamable<C>::value>::type> { 0286 static std::string format(C const &) 0287 { 0288 return "?"; 0289 } 0290 }; 0291 0292 template<class C> 0293 struct Formatter<C, typename std::enable_if<is_ostreamable<C>::value>::type> { 0294 static std::string format(C const &val) 0295 { 0296 std::ostringstream os; 0297 os << val; 0298 return os.str(); 0299 } 0300 }; 0301 0302 0303 template <typename T> 0304 using TypeFormatter = Formatter<typename fakeit::naked_type<T>::type>; 0305 } 0306 0307 namespace fakeit { 0308 0309 0310 template<class Tuple, std::size_t N> 0311 struct TuplePrinter { 0312 static void print(std::ostream &strm, const Tuple &t) { 0313 TuplePrinter<Tuple, N - 1>::print(strm, t); 0314 strm << ", " << fakeit::TypeFormatter<decltype(std::get<N - 1>(t))>::format(std::get<N - 1>(t)); 0315 } 0316 }; 0317 0318 template<class Tuple> 0319 struct TuplePrinter<Tuple, 1> { 0320 static void print(std::ostream &strm, const Tuple &t) { 0321 strm << fakeit::TypeFormatter<decltype(std::get<0>(t))>::format(std::get<0>(t)); 0322 } 0323 }; 0324 0325 template<class Tuple> 0326 struct TuplePrinter<Tuple, 0> { 0327 static void print(std::ostream &, const Tuple &) { 0328 } 0329 }; 0330 0331 template<class ... Args> 0332 void print(std::ostream &strm, const std::tuple<Args...> &t) { 0333 strm << "("; 0334 TuplePrinter<decltype(t), sizeof...(Args)>::print(strm, t); 0335 strm << ")"; 0336 } 0337 0338 template<class ... Args> 0339 std::ostream &operator<<(std::ostream &strm, const std::tuple<Args...> &t) { 0340 print(strm, t); 0341 return strm; 0342 } 0343 0344 } 0345 0346 0347 namespace fakeit { 0348 0349 template<typename ... arglist> 0350 struct ActualInvocation : public Invocation { 0351 0352 struct Matcher : public virtual Destructible { 0353 virtual bool matches(ActualInvocation<arglist...> &actualInvocation) = 0; 0354 0355 virtual std::string format() const = 0; 0356 }; 0357 0358 ActualInvocation(unsigned int ordinal, MethodInfo &method, const typename fakeit::production_arg<arglist>::type... args) : 0359 Invocation(ordinal, method), _matcher{ nullptr } 0360 , actualArguments{ std::forward<arglist>(args)... } 0361 { 0362 } 0363 0364 ArgumentsTuple<arglist...> & getActualArguments() { 0365 return actualArguments; 0366 } 0367 0368 0369 void setActualMatcher(Matcher *matcher) { 0370 this->_matcher = matcher; 0371 } 0372 0373 Matcher *getActualMatcher() { 0374 return _matcher; 0375 } 0376 0377 virtual std::string format() const override { 0378 std::ostringstream out; 0379 out << getMethod().name(); 0380 print(out, actualArguments); 0381 return out.str(); 0382 } 0383 0384 private: 0385 0386 Matcher *_matcher; 0387 ArgumentsTuple<arglist...> actualArguments; 0388 }; 0389 0390 template<typename ... arglist> 0391 std::ostream &operator<<(std::ostream &strm, const ActualInvocation<arglist...> &ai) { 0392 strm << ai.format(); 0393 return strm; 0394 } 0395 0396 } 0397 0398 0399 0400 0401 0402 #include <unordered_set> 0403 0404 namespace fakeit { 0405 0406 struct ActualInvocationsContainer { 0407 virtual void clear() = 0; 0408 0409 virtual ~ActualInvocationsContainer() NO_THROWS { } 0410 }; 0411 0412 struct ActualInvocationsSource { 0413 virtual void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const = 0; 0414 0415 virtual ~ActualInvocationsSource() NO_THROWS { } 0416 }; 0417 0418 struct InvocationsSourceProxy : public ActualInvocationsSource { 0419 0420 InvocationsSourceProxy(ActualInvocationsSource *inner) : 0421 _inner(inner) { 0422 } 0423 0424 void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const override { 0425 _inner->getActualInvocations(into); 0426 } 0427 0428 private: 0429 std::shared_ptr<ActualInvocationsSource> _inner; 0430 }; 0431 0432 struct UnverifiedInvocationsSource : public ActualInvocationsSource { 0433 0434 UnverifiedInvocationsSource(InvocationsSourceProxy decorated) : _decorated(decorated) { 0435 } 0436 0437 void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const override { 0438 std::unordered_set<fakeit::Invocation *> all; 0439 _decorated.getActualInvocations(all); 0440 for (fakeit::Invocation *i : all) { 0441 if (!i->isVerified()) { 0442 into.insert(i); 0443 } 0444 } 0445 } 0446 0447 private: 0448 InvocationsSourceProxy _decorated; 0449 }; 0450 0451 struct AggregateInvocationsSource : public ActualInvocationsSource { 0452 0453 AggregateInvocationsSource(std::vector<ActualInvocationsSource *> &sources) : _sources(sources) { 0454 } 0455 0456 void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const override { 0457 std::unordered_set<fakeit::Invocation *> tmp; 0458 for (ActualInvocationsSource *source : _sources) { 0459 source->getActualInvocations(tmp); 0460 } 0461 filter(tmp, into); 0462 } 0463 0464 protected: 0465 bool shouldInclude(fakeit::Invocation *) const { 0466 return true; 0467 } 0468 0469 private: 0470 std::vector<ActualInvocationsSource *> _sources; 0471 0472 void filter(std::unordered_set<Invocation *> &source, std::unordered_set<Invocation *> &target) const { 0473 for (Invocation *i:source) { 0474 if (shouldInclude(i)) { 0475 target.insert(i); 0476 } 0477 } 0478 } 0479 }; 0480 } 0481 0482 namespace fakeit { 0483 0484 class Sequence { 0485 private: 0486 0487 protected: 0488 0489 Sequence() { 0490 } 0491 0492 virtual ~Sequence() THROWS { 0493 } 0494 0495 public: 0496 0497 0498 virtual void getExpectedSequence(std::vector<Invocation::Matcher *> &into) const = 0; 0499 0500 0501 virtual void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const = 0; 0502 0503 virtual unsigned int size() const = 0; 0504 0505 friend class VerifyFunctor; 0506 }; 0507 0508 class ConcatenatedSequence : public virtual Sequence { 0509 private: 0510 const Sequence &s1; 0511 const Sequence &s2; 0512 0513 protected: 0514 ConcatenatedSequence(const Sequence &seq1, const Sequence &seq2) : 0515 s1(seq1), s2(seq2) { 0516 } 0517 0518 public: 0519 ~ConcatenatedSequence() override {} 0520 0521 unsigned int size() const override { 0522 return s1.size() + s2.size(); 0523 } 0524 0525 const Sequence &getLeft() const { 0526 return s1; 0527 } 0528 0529 const Sequence &getRight() const { 0530 return s2; 0531 } 0532 0533 void getExpectedSequence(std::vector<Invocation::Matcher *> &into) const override { 0534 s1.getExpectedSequence(into); 0535 s2.getExpectedSequence(into); 0536 } 0537 0538 virtual void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const override { 0539 s1.getInvolvedMocks(into); 0540 s2.getInvolvedMocks(into); 0541 } 0542 0543 friend inline ConcatenatedSequence operator+(const Sequence &s1, const Sequence &s2); 0544 }; 0545 0546 class RepeatedSequence : public virtual Sequence { 0547 private: 0548 const Sequence &_s; 0549 const int times; 0550 0551 protected: 0552 RepeatedSequence(const Sequence &s, const int t) : 0553 _s(s), times(t) { 0554 } 0555 0556 public: 0557 ~RepeatedSequence() override {} 0558 0559 unsigned int size() const override { 0560 return _s.size() * times; 0561 } 0562 0563 friend inline RepeatedSequence operator*(const Sequence &s, int times); 0564 0565 friend inline RepeatedSequence operator*(int times, const Sequence &s); 0566 0567 void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const override { 0568 _s.getInvolvedMocks(into); 0569 } 0570 0571 void getExpectedSequence(std::vector<Invocation::Matcher *> &into) const override { 0572 for (int i = 0; i < times; i++) 0573 _s.getExpectedSequence(into); 0574 } 0575 0576 int getTimes() const { 0577 return times; 0578 } 0579 0580 const Sequence &getSequence() const { 0581 return _s; 0582 } 0583 }; 0584 0585 inline ConcatenatedSequence operator+(const Sequence &s1, const Sequence &s2) { 0586 return ConcatenatedSequence(s1, s2); 0587 } 0588 0589 inline RepeatedSequence operator*(const Sequence &s, int times) { 0590 if (times <= 0) 0591 throw std::invalid_argument("times"); 0592 return RepeatedSequence(s, times); 0593 } 0594 0595 inline RepeatedSequence operator*(int times, const Sequence &s) { 0596 if (times <= 0) 0597 throw std::invalid_argument("times"); 0598 return RepeatedSequence(s, times); 0599 } 0600 0601 } 0602 0603 namespace fakeit { 0604 0605 enum class VerificationType { 0606 Exact, AtLeast, NoMoreInvocations 0607 }; 0608 0609 enum class UnexpectedType { 0610 Unmocked, Unmatched 0611 }; 0612 0613 struct VerificationEvent { 0614 0615 VerificationEvent(VerificationType aVerificationType) : 0616 _verificationType(aVerificationType), _line(0) { 0617 } 0618 0619 virtual ~VerificationEvent() = default; 0620 0621 VerificationType verificationType() const { 0622 return _verificationType; 0623 } 0624 0625 void setFileInfo(const char * aFile, int aLine, const char * aCallingMethod) { 0626 _file = aFile; 0627 _callingMethod = aCallingMethod; 0628 _line = aLine; 0629 } 0630 0631 const char * file() const { 0632 return _file; 0633 } 0634 0635 int line() const { 0636 return _line; 0637 } 0638 0639 const char * callingMethod() const { 0640 return _callingMethod; 0641 } 0642 0643 private: 0644 VerificationType _verificationType; 0645 const char * _file; 0646 int _line; 0647 const char * _callingMethod; 0648 }; 0649 0650 struct NoMoreInvocationsVerificationEvent : public VerificationEvent { 0651 0652 ~NoMoreInvocationsVerificationEvent() override = default; 0653 0654 NoMoreInvocationsVerificationEvent( 0655 std::vector<Invocation *> &allTheIvocations, 0656 std::vector<Invocation *> &anUnverifedIvocations) : 0657 VerificationEvent(VerificationType::NoMoreInvocations), 0658 _allIvocations(allTheIvocations), 0659 _unverifedIvocations(anUnverifedIvocations) { 0660 } 0661 0662 const std::vector<Invocation *> &allIvocations() const { 0663 return _allIvocations; 0664 } 0665 0666 const std::vector<Invocation *> &unverifedIvocations() const { 0667 return _unverifedIvocations; 0668 } 0669 0670 private: 0671 const std::vector<Invocation *> _allIvocations; 0672 const std::vector<Invocation *> _unverifedIvocations; 0673 }; 0674 0675 struct SequenceVerificationEvent : public VerificationEvent { 0676 0677 ~SequenceVerificationEvent() override = default; 0678 0679 SequenceVerificationEvent(VerificationType aVerificationType, 0680 std::vector<Sequence *> &anExpectedPattern, 0681 std::vector<Invocation *> &anActualSequence, 0682 int anExpectedCount, 0683 int anActualCount) : 0684 VerificationEvent(aVerificationType), 0685 _expectedPattern(anExpectedPattern), 0686 _actualSequence(anActualSequence), 0687 _expectedCount(anExpectedCount), 0688 _actualCount(anActualCount) 0689 { 0690 } 0691 0692 const std::vector<Sequence *> &expectedPattern() const { 0693 return _expectedPattern; 0694 } 0695 0696 const std::vector<Invocation *> &actualSequence() const { 0697 return _actualSequence; 0698 } 0699 0700 int expectedCount() const { 0701 return _expectedCount; 0702 } 0703 0704 int actualCount() const { 0705 return _actualCount; 0706 } 0707 0708 private: 0709 const std::vector<Sequence *> _expectedPattern; 0710 const std::vector<Invocation *> _actualSequence; 0711 const int _expectedCount; 0712 const int _actualCount; 0713 }; 0714 0715 struct UnexpectedMethodCallEvent { 0716 UnexpectedMethodCallEvent(UnexpectedType unexpectedType, const Invocation &invocation) : 0717 _unexpectedType(unexpectedType), _invocation(invocation) { 0718 } 0719 0720 const Invocation &getInvocation() const { 0721 return _invocation; 0722 } 0723 0724 UnexpectedType getUnexpectedType() const { 0725 return _unexpectedType; 0726 } 0727 0728 const UnexpectedType _unexpectedType; 0729 const Invocation &_invocation; 0730 }; 0731 0732 } 0733 0734 namespace fakeit { 0735 0736 struct VerificationEventHandler { 0737 virtual void handle(const SequenceVerificationEvent &e) = 0; 0738 0739 virtual void handle(const NoMoreInvocationsVerificationEvent &e) = 0; 0740 }; 0741 0742 struct EventHandler : public VerificationEventHandler { 0743 using VerificationEventHandler::handle; 0744 0745 virtual void handle(const UnexpectedMethodCallEvent &e) = 0; 0746 }; 0747 0748 } 0749 #include <vector> 0750 #include <string> 0751 0752 namespace fakeit { 0753 0754 struct UnexpectedMethodCallEvent; 0755 struct SequenceVerificationEvent; 0756 struct NoMoreInvocationsVerificationEvent; 0757 0758 struct EventFormatter { 0759 0760 virtual std::string format(const fakeit::UnexpectedMethodCallEvent &e) = 0; 0761 0762 virtual std::string format(const fakeit::SequenceVerificationEvent &e) = 0; 0763 0764 virtual std::string format(const fakeit::NoMoreInvocationsVerificationEvent &e) = 0; 0765 0766 }; 0767 0768 } 0769 #ifdef FAKEIT_ASSERT_ON_UNEXPECTED_METHOD_INVOCATION 0770 #include <cassert> 0771 #endif 0772 0773 namespace fakeit { 0774 0775 struct FakeitContext : public EventHandler, protected EventFormatter { 0776 0777 virtual ~FakeitContext() = default; 0778 0779 void handle(const UnexpectedMethodCallEvent &e) override { 0780 fireEvent(e); 0781 auto &eh = getTestingFrameworkAdapter(); 0782 #ifdef FAKEIT_ASSERT_ON_UNEXPECTED_METHOD_INVOCATION 0783 assert(!"Unexpected method invocation"); 0784 #endif 0785 eh.handle(e); 0786 } 0787 0788 void handle(const SequenceVerificationEvent &e) override { 0789 fireEvent(e); 0790 auto &eh = getTestingFrameworkAdapter(); 0791 return eh.handle(e); 0792 } 0793 0794 void handle(const NoMoreInvocationsVerificationEvent &e) override { 0795 fireEvent(e); 0796 auto &eh = getTestingFrameworkAdapter(); 0797 return eh.handle(e); 0798 } 0799 0800 std::string format(const UnexpectedMethodCallEvent &e) override { 0801 auto &eventFormatter = getEventFormatter(); 0802 return eventFormatter.format(e); 0803 } 0804 0805 std::string format(const SequenceVerificationEvent &e) override { 0806 auto &eventFormatter = getEventFormatter(); 0807 return eventFormatter.format(e); 0808 } 0809 0810 std::string format(const NoMoreInvocationsVerificationEvent &e) override { 0811 auto &eventFormatter = getEventFormatter(); 0812 return eventFormatter.format(e); 0813 } 0814 0815 void addEventHandler(EventHandler &eventListener) { 0816 _eventListeners.push_back(&eventListener); 0817 } 0818 0819 void clearEventHandlers() { 0820 _eventListeners.clear(); 0821 } 0822 0823 protected: 0824 virtual EventHandler &getTestingFrameworkAdapter() = 0; 0825 0826 virtual EventFormatter &getEventFormatter() = 0; 0827 0828 private: 0829 std::vector<EventHandler *> _eventListeners; 0830 0831 void fireEvent(const NoMoreInvocationsVerificationEvent &evt) { 0832 for (auto listener : _eventListeners) 0833 listener->handle(evt); 0834 } 0835 0836 void fireEvent(const UnexpectedMethodCallEvent &evt) { 0837 for (auto listener : _eventListeners) 0838 listener->handle(evt); 0839 } 0840 0841 void fireEvent(const SequenceVerificationEvent &evt) { 0842 for (auto listener : _eventListeners) 0843 listener->handle(evt); 0844 } 0845 0846 }; 0847 0848 } 0849 #include <iostream> 0850 #include <iosfwd> 0851 0852 namespace fakeit { 0853 0854 struct DefaultEventFormatter : public EventFormatter { 0855 0856 virtual std::string format(const UnexpectedMethodCallEvent &e) override { 0857 std::ostringstream out; 0858 out << "Unexpected method invocation: "; 0859 out << e.getInvocation().format() << std::endl; 0860 if (UnexpectedType::Unmatched == e.getUnexpectedType()) { 0861 out << " Could not find any recorded behavior to support this method call."; 0862 } else { 0863 out << " An unmocked method was invoked. All used virtual methods must be stubbed!"; 0864 } 0865 return out.str(); 0866 } 0867 0868 0869 virtual std::string format(const SequenceVerificationEvent &e) override { 0870 std::ostringstream out; 0871 out << "Verification error" << std::endl; 0872 0873 out << "Expected pattern: "; 0874 const std::vector<fakeit::Sequence *> expectedPattern = e.expectedPattern(); 0875 out << formatExpectedPattern(expectedPattern) << std::endl; 0876 0877 out << "Expected matches: "; 0878 formatExpectedCount(out, e.verificationType(), e.expectedCount()); 0879 out << std::endl; 0880 0881 out << "Actual matches : " << e.actualCount() << std::endl; 0882 0883 auto actualSequence = e.actualSequence(); 0884 out << "Actual sequence : total of " << actualSequence.size() << " actual invocations"; 0885 if (actualSequence.size() == 0) { 0886 out << "."; 0887 } else { 0888 out << ":" << std::endl; 0889 } 0890 formatInvocationList(out, actualSequence); 0891 0892 return out.str(); 0893 } 0894 0895 virtual std::string format(const NoMoreInvocationsVerificationEvent &e) override { 0896 std::ostringstream out; 0897 out << "Verification error" << std::endl; 0898 out << "Expected no more invocations!! but the following unverified invocations were found:" << std::endl; 0899 formatInvocationList(out, e.unverifedIvocations()); 0900 return out.str(); 0901 } 0902 0903 static std::string formatExpectedPattern(const std::vector<fakeit::Sequence *> &expectedPattern) { 0904 std::string expectedPatternStr; 0905 for (unsigned int i = 0; i < expectedPattern.size(); i++) { 0906 Sequence *s = expectedPattern[i]; 0907 expectedPatternStr += formatSequence(*s); 0908 if (i < expectedPattern.size() - 1) 0909 expectedPatternStr += " ... "; 0910 } 0911 return expectedPatternStr; 0912 } 0913 0914 private: 0915 0916 static std::string formatSequence(const Sequence &val) { 0917 const ConcatenatedSequence *cs = dynamic_cast<const ConcatenatedSequence *>(&val); 0918 if (cs) { 0919 return format(*cs); 0920 } 0921 const RepeatedSequence *rs = dynamic_cast<const RepeatedSequence *>(&val); 0922 if (rs) { 0923 return format(*rs); 0924 } 0925 0926 0927 std::vector<Invocation::Matcher *> vec; 0928 val.getExpectedSequence(vec); 0929 return vec[0]->format(); 0930 } 0931 0932 static void formatExpectedCount(std::ostream &out, fakeit::VerificationType verificationType, 0933 int expectedCount) { 0934 if (verificationType == fakeit::VerificationType::Exact) 0935 out << "exactly "; 0936 0937 if (verificationType == fakeit::VerificationType::AtLeast) 0938 out << "at least "; 0939 0940 out << expectedCount; 0941 } 0942 0943 static void formatInvocationList(std::ostream &out, const std::vector<fakeit::Invocation *> &actualSequence) { 0944 size_t max_size = actualSequence.size(); 0945 if (max_size > 50) 0946 max_size = 50; 0947 0948 for (unsigned int i = 0; i < max_size; i++) { 0949 out << " "; 0950 auto invocation = actualSequence[i]; 0951 out << invocation->format(); 0952 if (i < max_size - 1) 0953 out << std::endl; 0954 } 0955 0956 if (actualSequence.size() > max_size) 0957 out << std::endl << " ..."; 0958 } 0959 0960 static std::string format(const ConcatenatedSequence &val) { 0961 std::ostringstream out; 0962 out << formatSequence(val.getLeft()) << " + " << formatSequence(val.getRight()); 0963 return out.str(); 0964 } 0965 0966 static std::string format(const RepeatedSequence &val) { 0967 std::ostringstream out; 0968 const ConcatenatedSequence *cs = dynamic_cast<const ConcatenatedSequence *>(&val.getSequence()); 0969 const RepeatedSequence *rs = dynamic_cast<const RepeatedSequence *>(&val.getSequence()); 0970 if (rs || cs) 0971 out << '('; 0972 out << formatSequence(val.getSequence()); 0973 if (rs || cs) 0974 out << ')'; 0975 0976 out << " * " << val.getTimes(); 0977 return out.str(); 0978 } 0979 }; 0980 } 0981 #include <exception> 0982 0983 0984 namespace fakeit { 0985 #if __cplusplus >= 201703L || defined(__cpp_lib_uncaught_exceptions) 0986 inline bool UncaughtException () { 0987 return std::uncaught_exceptions() >= 1; 0988 } 0989 #else 0990 inline bool UncaughtException () { 0991 return std::uncaught_exception(); 0992 } 0993 #endif 0994 0995 struct FakeitException { 0996 std::exception err; 0997 0998 virtual ~FakeitException() = default; 0999 1000 virtual std::string what() const = 0; 1001 1002 friend std::ostream &operator<<(std::ostream &os, const FakeitException &val) { 1003 os << val.what(); 1004 return os; 1005 } 1006 }; 1007 1008 1009 1010 1011 struct UnexpectedMethodCallException : public FakeitException { 1012 1013 UnexpectedMethodCallException(std::string format) : 1014 _format(format) { 1015 } 1016 1017 virtual std::string what() const override { 1018 return _format; 1019 } 1020 1021 private: 1022 std::string _format; 1023 }; 1024 1025 } 1026 1027 namespace fakeit { 1028 1029 struct DefaultEventLogger : public fakeit::EventHandler { 1030 1031 DefaultEventLogger(EventFormatter &formatter) : _formatter(formatter), _out(std::cout) { } 1032 1033 virtual void handle(const UnexpectedMethodCallEvent &e) override { 1034 _out << _formatter.format(e) << std::endl; 1035 } 1036 1037 virtual void handle(const SequenceVerificationEvent &e) override { 1038 _out << _formatter.format(e) << std::endl; 1039 } 1040 1041 virtual void handle(const NoMoreInvocationsVerificationEvent &e) override { 1042 _out << _formatter.format(e) << std::endl; 1043 } 1044 1045 private: 1046 EventFormatter &_formatter; 1047 std::ostream &_out; 1048 }; 1049 1050 } 1051 1052 namespace fakeit { 1053 1054 class AbstractFakeit : public FakeitContext { 1055 public: 1056 ~AbstractFakeit() override = default; 1057 1058 protected: 1059 1060 virtual fakeit::EventHandler &accessTestingFrameworkAdapter() = 0; 1061 1062 virtual EventFormatter &accessEventFormatter() = 0; 1063 }; 1064 1065 class DefaultFakeit : public AbstractFakeit { 1066 DefaultEventFormatter _formatter; 1067 fakeit::EventFormatter *_customFormatter; 1068 fakeit::EventHandler *_testingFrameworkAdapter; 1069 1070 public: 1071 1072 DefaultFakeit() : _formatter(), 1073 _customFormatter(nullptr), 1074 _testingFrameworkAdapter(nullptr) { 1075 } 1076 1077 ~DefaultFakeit() override = default; 1078 1079 void setCustomEventFormatter(fakeit::EventFormatter &customEventFormatter) { 1080 _customFormatter = &customEventFormatter; 1081 } 1082 1083 void resetCustomEventFormatter() { 1084 _customFormatter = nullptr; 1085 } 1086 1087 void setTestingFrameworkAdapter(fakeit::EventHandler &testingFrameforkAdapter) { 1088 _testingFrameworkAdapter = &testingFrameforkAdapter; 1089 } 1090 1091 void resetTestingFrameworkAdapter() { 1092 _testingFrameworkAdapter = nullptr; 1093 } 1094 1095 protected: 1096 1097 fakeit::EventHandler &getTestingFrameworkAdapter() override { 1098 if (_testingFrameworkAdapter) 1099 return *_testingFrameworkAdapter; 1100 return accessTestingFrameworkAdapter(); 1101 } 1102 1103 EventFormatter &getEventFormatter() override { 1104 if (_customFormatter) 1105 return *_customFormatter; 1106 return accessEventFormatter(); 1107 } 1108 1109 EventFormatter &accessEventFormatter() override { 1110 return _formatter; 1111 } 1112 1113 }; 1114 } 1115 #include <string> 1116 #include <sstream> 1117 #include <iomanip> 1118 1119 namespace fakeit { 1120 1121 template<typename T> 1122 static std::string to_string(const T &n) { 1123 std::ostringstream stm; 1124 stm << n; 1125 return stm.str(); 1126 } 1127 1128 } 1129 1130 namespace fakeit { 1131 1132 struct VerificationException : public std::exception { 1133 ~VerificationException() NO_THROWS{}; 1134 1135 VerificationException(std::string format) : 1136 _format(format) { 1137 } 1138 1139 friend std::ostream &operator<<(std::ostream &os, const VerificationException &val) { 1140 os << val.what(); 1141 return os; 1142 } 1143 1144 void setFileInfo(std::string aFile, int aLine, std::string aCallingMethod) { 1145 _file = aFile; 1146 _callingMethod = aCallingMethod; 1147 _line = aLine; 1148 } 1149 1150 const std::string& file() const { 1151 return _file; 1152 } 1153 int line() const { 1154 return _line; 1155 } 1156 const std::string& callingMethod() const { 1157 return _callingMethod; 1158 } 1159 1160 const char* what() const NO_THROWS override{ 1161 return _format.c_str(); 1162 } 1163 private: 1164 std::string _file; 1165 int _line; 1166 std::string _callingMethod; 1167 std::string _format; 1168 }; 1169 1170 struct NoMoreInvocationsVerificationException : public VerificationException { 1171 NoMoreInvocationsVerificationException(std::string format) : 1172 VerificationException(format) { 1173 } 1174 }; 1175 1176 struct SequenceVerificationException : public VerificationException { 1177 SequenceVerificationException(std::string format) : 1178 VerificationException(format) { 1179 } 1180 }; 1181 1182 struct StandaloneAdapter : public EventHandler { 1183 1184 std::string formatLineNumner(std::string file, int num){ 1185 #ifndef __GNUG__ 1186 return file + std::string("(") + fakeit::to_string(num) + std::string(")"); 1187 #else 1188 return file + std::string(":") + fakeit::to_string(num); 1189 #endif 1190 } 1191 1192 virtual ~StandaloneAdapter() = default; 1193 1194 StandaloneAdapter(EventFormatter &formatter) 1195 : _formatter(formatter) { 1196 } 1197 1198 virtual void handle(const UnexpectedMethodCallEvent &evt) override { 1199 std::string format = _formatter.format(evt); 1200 UnexpectedMethodCallException ex(format); 1201 throw ex; 1202 } 1203 1204 virtual void handle(const SequenceVerificationEvent &evt) override { 1205 std::string format(formatLineNumner(evt.file(), evt.line()) + ": " + _formatter.format(evt)); 1206 SequenceVerificationException e(format); 1207 e.setFileInfo(evt.file(), evt.line(), evt.callingMethod()); 1208 throw e; 1209 } 1210 1211 virtual void handle(const NoMoreInvocationsVerificationEvent &evt) override { 1212 std::string format(formatLineNumner(evt.file(), evt.line()) + ": " + _formatter.format(evt)); 1213 NoMoreInvocationsVerificationException e(format); 1214 e.setFileInfo(evt.file(), evt.line(), evt.callingMethod()); 1215 throw e; 1216 } 1217 1218 private: 1219 EventFormatter &_formatter; 1220 }; 1221 1222 class StandaloneFakeit : public DefaultFakeit { 1223 1224 public: 1225 ~StandaloneFakeit() override = default; 1226 1227 StandaloneFakeit() : _standaloneAdapter(*this) { 1228 } 1229 1230 static StandaloneFakeit &getInstance() { 1231 static StandaloneFakeit instance; 1232 return instance; 1233 } 1234 1235 protected: 1236 1237 fakeit::EventHandler &accessTestingFrameworkAdapter() override { 1238 return _standaloneAdapter; 1239 } 1240 1241 private: 1242 1243 StandaloneAdapter _standaloneAdapter; 1244 }; 1245 } 1246 1247 static fakeit::DefaultFakeit& Fakeit = fakeit::StandaloneFakeit::getInstance(); 1248 1249 1250 #include <type_traits> 1251 #include <unordered_set> 1252 1253 #include <memory> 1254 #undef max 1255 #include <functional> 1256 #include <type_traits> 1257 #include <vector> 1258 #include <array> 1259 #include <new> 1260 #include <limits> 1261 1262 #include <functional> 1263 #include <type_traits> 1264 namespace fakeit { 1265 1266 struct VirtualOffsetSelector { 1267 1268 unsigned int offset; 1269 1270 virtual unsigned int offset0(int) { 1271 return offset = 0; 1272 } 1273 1274 virtual unsigned int offset1(int) { 1275 return offset = 1; 1276 } 1277 1278 virtual unsigned int offset2(int) { 1279 return offset = 2; 1280 } 1281 1282 virtual unsigned int offset3(int) { 1283 return offset = 3; 1284 } 1285 1286 virtual unsigned int offset4(int) { 1287 return offset = 4; 1288 } 1289 1290 virtual unsigned int offset5(int) { 1291 return offset = 5; 1292 } 1293 1294 virtual unsigned int offset6(int) { 1295 return offset = 6; 1296 } 1297 1298 virtual unsigned int offset7(int) { 1299 return offset = 7; 1300 } 1301 1302 virtual unsigned int offset8(int) { 1303 return offset = 8; 1304 } 1305 1306 virtual unsigned int offset9(int) { 1307 return offset = 9; 1308 } 1309 1310 virtual unsigned int offset10(int) { 1311 return offset = 10; 1312 } 1313 1314 virtual unsigned int offset11(int) { 1315 return offset = 11; 1316 } 1317 1318 virtual unsigned int offset12(int) { 1319 return offset = 12; 1320 } 1321 1322 virtual unsigned int offset13(int) { 1323 return offset = 13; 1324 } 1325 1326 virtual unsigned int offset14(int) { 1327 return offset = 14; 1328 } 1329 1330 virtual unsigned int offset15(int) { 1331 return offset = 15; 1332 } 1333 1334 virtual unsigned int offset16(int) { 1335 return offset = 16; 1336 } 1337 1338 virtual unsigned int offset17(int) { 1339 return offset = 17; 1340 } 1341 1342 virtual unsigned int offset18(int) { 1343 return offset = 18; 1344 } 1345 1346 virtual unsigned int offset19(int) { 1347 return offset = 19; 1348 } 1349 1350 virtual unsigned int offset20(int) { 1351 return offset = 20; 1352 } 1353 1354 virtual unsigned int offset21(int) { 1355 return offset = 21; 1356 } 1357 1358 virtual unsigned int offset22(int) { 1359 return offset = 22; 1360 } 1361 1362 virtual unsigned int offset23(int) { 1363 return offset = 23; 1364 } 1365 1366 virtual unsigned int offset24(int) { 1367 return offset = 24; 1368 } 1369 1370 virtual unsigned int offset25(int) { 1371 return offset = 25; 1372 } 1373 1374 virtual unsigned int offset26(int) { 1375 return offset = 26; 1376 } 1377 1378 virtual unsigned int offset27(int) { 1379 return offset = 27; 1380 } 1381 1382 virtual unsigned int offset28(int) { 1383 return offset = 28; 1384 } 1385 1386 virtual unsigned int offset29(int) { 1387 return offset = 29; 1388 } 1389 1390 virtual unsigned int offset30(int) { 1391 return offset = 30; 1392 } 1393 1394 virtual unsigned int offset31(int) { 1395 return offset = 31; 1396 } 1397 1398 virtual unsigned int offset32(int) { 1399 return offset = 32; 1400 } 1401 1402 virtual unsigned int offset33(int) { 1403 return offset = 33; 1404 } 1405 1406 virtual unsigned int offset34(int) { 1407 return offset = 34; 1408 } 1409 1410 virtual unsigned int offset35(int) { 1411 return offset = 35; 1412 } 1413 1414 virtual unsigned int offset36(int) { 1415 return offset = 36; 1416 } 1417 1418 virtual unsigned int offset37(int) { 1419 return offset = 37; 1420 } 1421 1422 virtual unsigned int offset38(int) { 1423 return offset = 38; 1424 } 1425 1426 virtual unsigned int offset39(int) { 1427 return offset = 39; 1428 } 1429 1430 virtual unsigned int offset40(int) { 1431 return offset = 40; 1432 } 1433 1434 virtual unsigned int offset41(int) { 1435 return offset = 41; 1436 } 1437 1438 virtual unsigned int offset42(int) { 1439 return offset = 42; 1440 } 1441 1442 virtual unsigned int offset43(int) { 1443 return offset = 43; 1444 } 1445 1446 virtual unsigned int offset44(int) { 1447 return offset = 44; 1448 } 1449 1450 virtual unsigned int offset45(int) { 1451 return offset = 45; 1452 } 1453 1454 virtual unsigned int offset46(int) { 1455 return offset = 46; 1456 } 1457 1458 virtual unsigned int offset47(int) { 1459 return offset = 47; 1460 } 1461 1462 virtual unsigned int offset48(int) { 1463 return offset = 48; 1464 } 1465 1466 virtual unsigned int offset49(int) { 1467 return offset = 49; 1468 } 1469 1470 virtual unsigned int offset50(int) { 1471 return offset = 50; 1472 } 1473 1474 virtual unsigned int offset51(int) { 1475 return offset = 51; 1476 } 1477 1478 virtual unsigned int offset52(int) { 1479 return offset = 52; 1480 } 1481 1482 virtual unsigned int offset53(int) { 1483 return offset = 53; 1484 } 1485 1486 virtual unsigned int offset54(int) { 1487 return offset = 54; 1488 } 1489 1490 virtual unsigned int offset55(int) { 1491 return offset = 55; 1492 } 1493 1494 virtual unsigned int offset56(int) { 1495 return offset = 56; 1496 } 1497 1498 virtual unsigned int offset57(int) { 1499 return offset = 57; 1500 } 1501 1502 virtual unsigned int offset58(int) { 1503 return offset = 58; 1504 } 1505 1506 virtual unsigned int offset59(int) { 1507 return offset = 59; 1508 } 1509 1510 virtual unsigned int offset60(int) { 1511 return offset = 60; 1512 } 1513 1514 virtual unsigned int offset61(int) { 1515 return offset = 61; 1516 } 1517 1518 virtual unsigned int offset62(int) { 1519 return offset = 62; 1520 } 1521 1522 virtual unsigned int offset63(int) { 1523 return offset = 63; 1524 } 1525 1526 virtual unsigned int offset64(int) { 1527 return offset = 64; 1528 } 1529 1530 virtual unsigned int offset65(int) { 1531 return offset = 65; 1532 } 1533 1534 virtual unsigned int offset66(int) { 1535 return offset = 66; 1536 } 1537 1538 virtual unsigned int offset67(int) { 1539 return offset = 67; 1540 } 1541 1542 virtual unsigned int offset68(int) { 1543 return offset = 68; 1544 } 1545 1546 virtual unsigned int offset69(int) { 1547 return offset = 69; 1548 } 1549 1550 virtual unsigned int offset70(int) { 1551 return offset = 70; 1552 } 1553 1554 virtual unsigned int offset71(int) { 1555 return offset = 71; 1556 } 1557 1558 virtual unsigned int offset72(int) { 1559 return offset = 72; 1560 } 1561 1562 virtual unsigned int offset73(int) { 1563 return offset = 73; 1564 } 1565 1566 virtual unsigned int offset74(int) { 1567 return offset = 74; 1568 } 1569 1570 virtual unsigned int offset75(int) { 1571 return offset = 75; 1572 } 1573 1574 virtual unsigned int offset76(int) { 1575 return offset = 76; 1576 } 1577 1578 virtual unsigned int offset77(int) { 1579 return offset = 77; 1580 } 1581 1582 virtual unsigned int offset78(int) { 1583 return offset = 78; 1584 } 1585 1586 virtual unsigned int offset79(int) { 1587 return offset = 79; 1588 } 1589 1590 virtual unsigned int offset80(int) { 1591 return offset = 80; 1592 } 1593 1594 virtual unsigned int offset81(int) { 1595 return offset = 81; 1596 } 1597 1598 virtual unsigned int offset82(int) { 1599 return offset = 82; 1600 } 1601 1602 virtual unsigned int offset83(int) { 1603 return offset = 83; 1604 } 1605 1606 virtual unsigned int offset84(int) { 1607 return offset = 84; 1608 } 1609 1610 virtual unsigned int offset85(int) { 1611 return offset = 85; 1612 } 1613 1614 virtual unsigned int offset86(int) { 1615 return offset = 86; 1616 } 1617 1618 virtual unsigned int offset87(int) { 1619 return offset = 87; 1620 } 1621 1622 virtual unsigned int offset88(int) { 1623 return offset = 88; 1624 } 1625 1626 virtual unsigned int offset89(int) { 1627 return offset = 89; 1628 } 1629 1630 virtual unsigned int offset90(int) { 1631 return offset = 90; 1632 } 1633 1634 virtual unsigned int offset91(int) { 1635 return offset = 91; 1636 } 1637 1638 virtual unsigned int offset92(int) { 1639 return offset = 92; 1640 } 1641 1642 virtual unsigned int offset93(int) { 1643 return offset = 93; 1644 } 1645 1646 virtual unsigned int offset94(int) { 1647 return offset = 94; 1648 } 1649 1650 virtual unsigned int offset95(int) { 1651 return offset = 95; 1652 } 1653 1654 virtual unsigned int offset96(int) { 1655 return offset = 96; 1656 } 1657 1658 virtual unsigned int offset97(int) { 1659 return offset = 97; 1660 } 1661 1662 virtual unsigned int offset98(int) { 1663 return offset = 98; 1664 } 1665 1666 virtual unsigned int offset99(int) { 1667 return offset = 99; 1668 } 1669 1670 virtual unsigned int offset100(int) { 1671 return offset = 100; 1672 } 1673 1674 virtual unsigned int offset101(int) { 1675 return offset = 101; 1676 } 1677 1678 virtual unsigned int offset102(int) { 1679 return offset = 102; 1680 } 1681 1682 virtual unsigned int offset103(int) { 1683 return offset = 103; 1684 } 1685 1686 virtual unsigned int offset104(int) { 1687 return offset = 104; 1688 } 1689 1690 virtual unsigned int offset105(int) { 1691 return offset = 105; 1692 } 1693 1694 virtual unsigned int offset106(int) { 1695 return offset = 106; 1696 } 1697 1698 virtual unsigned int offset107(int) { 1699 return offset = 107; 1700 } 1701 1702 virtual unsigned int offset108(int) { 1703 return offset = 108; 1704 } 1705 1706 virtual unsigned int offset109(int) { 1707 return offset = 109; 1708 } 1709 1710 virtual unsigned int offset110(int) { 1711 return offset = 110; 1712 } 1713 1714 virtual unsigned int offset111(int) { 1715 return offset = 111; 1716 } 1717 1718 virtual unsigned int offset112(int) { 1719 return offset = 112; 1720 } 1721 1722 virtual unsigned int offset113(int) { 1723 return offset = 113; 1724 } 1725 1726 virtual unsigned int offset114(int) { 1727 return offset = 114; 1728 } 1729 1730 virtual unsigned int offset115(int) { 1731 return offset = 115; 1732 } 1733 1734 virtual unsigned int offset116(int) { 1735 return offset = 116; 1736 } 1737 1738 virtual unsigned int offset117(int) { 1739 return offset = 117; 1740 } 1741 1742 virtual unsigned int offset118(int) { 1743 return offset = 118; 1744 } 1745 1746 virtual unsigned int offset119(int) { 1747 return offset = 119; 1748 } 1749 1750 virtual unsigned int offset120(int) { 1751 return offset = 120; 1752 } 1753 1754 virtual unsigned int offset121(int) { 1755 return offset = 121; 1756 } 1757 1758 virtual unsigned int offset122(int) { 1759 return offset = 122; 1760 } 1761 1762 virtual unsigned int offset123(int) { 1763 return offset = 123; 1764 } 1765 1766 virtual unsigned int offset124(int) { 1767 return offset = 124; 1768 } 1769 1770 virtual unsigned int offset125(int) { 1771 return offset = 125; 1772 } 1773 1774 virtual unsigned int offset126(int) { 1775 return offset = 126; 1776 } 1777 1778 virtual unsigned int offset127(int) { 1779 return offset = 127; 1780 } 1781 1782 virtual unsigned int offset128(int) { 1783 return offset = 128; 1784 } 1785 1786 virtual unsigned int offset129(int) { 1787 return offset = 129; 1788 } 1789 1790 virtual unsigned int offset130(int) { 1791 return offset = 130; 1792 } 1793 1794 virtual unsigned int offset131(int) { 1795 return offset = 131; 1796 } 1797 1798 virtual unsigned int offset132(int) { 1799 return offset = 132; 1800 } 1801 1802 virtual unsigned int offset133(int) { 1803 return offset = 133; 1804 } 1805 1806 virtual unsigned int offset134(int) { 1807 return offset = 134; 1808 } 1809 1810 virtual unsigned int offset135(int) { 1811 return offset = 135; 1812 } 1813 1814 virtual unsigned int offset136(int) { 1815 return offset = 136; 1816 } 1817 1818 virtual unsigned int offset137(int) { 1819 return offset = 137; 1820 } 1821 1822 virtual unsigned int offset138(int) { 1823 return offset = 138; 1824 } 1825 1826 virtual unsigned int offset139(int) { 1827 return offset = 139; 1828 } 1829 1830 virtual unsigned int offset140(int) { 1831 return offset = 140; 1832 } 1833 1834 virtual unsigned int offset141(int) { 1835 return offset = 141; 1836 } 1837 1838 virtual unsigned int offset142(int) { 1839 return offset = 142; 1840 } 1841 1842 virtual unsigned int offset143(int) { 1843 return offset = 143; 1844 } 1845 1846 virtual unsigned int offset144(int) { 1847 return offset = 144; 1848 } 1849 1850 virtual unsigned int offset145(int) { 1851 return offset = 145; 1852 } 1853 1854 virtual unsigned int offset146(int) { 1855 return offset = 146; 1856 } 1857 1858 virtual unsigned int offset147(int) { 1859 return offset = 147; 1860 } 1861 1862 virtual unsigned int offset148(int) { 1863 return offset = 148; 1864 } 1865 1866 virtual unsigned int offset149(int) { 1867 return offset = 149; 1868 } 1869 1870 virtual unsigned int offset150(int) { 1871 return offset = 150; 1872 } 1873 1874 virtual unsigned int offset151(int) { 1875 return offset = 151; 1876 } 1877 1878 virtual unsigned int offset152(int) { 1879 return offset = 152; 1880 } 1881 1882 virtual unsigned int offset153(int) { 1883 return offset = 153; 1884 } 1885 1886 virtual unsigned int offset154(int) { 1887 return offset = 154; 1888 } 1889 1890 virtual unsigned int offset155(int) { 1891 return offset = 155; 1892 } 1893 1894 virtual unsigned int offset156(int) { 1895 return offset = 156; 1896 } 1897 1898 virtual unsigned int offset157(int) { 1899 return offset = 157; 1900 } 1901 1902 virtual unsigned int offset158(int) { 1903 return offset = 158; 1904 } 1905 1906 virtual unsigned int offset159(int) { 1907 return offset = 159; 1908 } 1909 1910 virtual unsigned int offset160(int) { 1911 return offset = 160; 1912 } 1913 1914 virtual unsigned int offset161(int) { 1915 return offset = 161; 1916 } 1917 1918 virtual unsigned int offset162(int) { 1919 return offset = 162; 1920 } 1921 1922 virtual unsigned int offset163(int) { 1923 return offset = 163; 1924 } 1925 1926 virtual unsigned int offset164(int) { 1927 return offset = 164; 1928 } 1929 1930 virtual unsigned int offset165(int) { 1931 return offset = 165; 1932 } 1933 1934 virtual unsigned int offset166(int) { 1935 return offset = 166; 1936 } 1937 1938 virtual unsigned int offset167(int) { 1939 return offset = 167; 1940 } 1941 1942 virtual unsigned int offset168(int) { 1943 return offset = 168; 1944 } 1945 1946 virtual unsigned int offset169(int) { 1947 return offset = 169; 1948 } 1949 1950 virtual unsigned int offset170(int) { 1951 return offset = 170; 1952 } 1953 1954 virtual unsigned int offset171(int) { 1955 return offset = 171; 1956 } 1957 1958 virtual unsigned int offset172(int) { 1959 return offset = 172; 1960 } 1961 1962 virtual unsigned int offset173(int) { 1963 return offset = 173; 1964 } 1965 1966 virtual unsigned int offset174(int) { 1967 return offset = 174; 1968 } 1969 1970 virtual unsigned int offset175(int) { 1971 return offset = 175; 1972 } 1973 1974 virtual unsigned int offset176(int) { 1975 return offset = 176; 1976 } 1977 1978 virtual unsigned int offset177(int) { 1979 return offset = 177; 1980 } 1981 1982 virtual unsigned int offset178(int) { 1983 return offset = 178; 1984 } 1985 1986 virtual unsigned int offset179(int) { 1987 return offset = 179; 1988 } 1989 1990 virtual unsigned int offset180(int) { 1991 return offset = 180; 1992 } 1993 1994 virtual unsigned int offset181(int) { 1995 return offset = 181; 1996 } 1997 1998 virtual unsigned int offset182(int) { 1999 return offset = 182; 2000 } 2001 2002 virtual unsigned int offset183(int) { 2003 return offset = 183; 2004 } 2005 2006 virtual unsigned int offset184(int) { 2007 return offset = 184; 2008 } 2009 2010 virtual unsigned int offset185(int) { 2011 return offset = 185; 2012 } 2013 2014 virtual unsigned int offset186(int) { 2015 return offset = 186; 2016 } 2017 2018 virtual unsigned int offset187(int) { 2019 return offset = 187; 2020 } 2021 2022 virtual unsigned int offset188(int) { 2023 return offset = 188; 2024 } 2025 2026 virtual unsigned int offset189(int) { 2027 return offset = 189; 2028 } 2029 2030 virtual unsigned int offset190(int) { 2031 return offset = 190; 2032 } 2033 2034 virtual unsigned int offset191(int) { 2035 return offset = 191; 2036 } 2037 2038 virtual unsigned int offset192(int) { 2039 return offset = 192; 2040 } 2041 2042 virtual unsigned int offset193(int) { 2043 return offset = 193; 2044 } 2045 2046 virtual unsigned int offset194(int) { 2047 return offset = 194; 2048 } 2049 2050 virtual unsigned int offset195(int) { 2051 return offset = 195; 2052 } 2053 2054 virtual unsigned int offset196(int) { 2055 return offset = 196; 2056 } 2057 2058 virtual unsigned int offset197(int) { 2059 return offset = 197; 2060 } 2061 2062 virtual unsigned int offset198(int) { 2063 return offset = 198; 2064 } 2065 2066 virtual unsigned int offset199(int) { 2067 return offset = 199; 2068 } 2069 2070 2071 virtual unsigned int offset200(int) { 2072 return offset = 200; 2073 } 2074 2075 virtual unsigned int offset201(int) { 2076 return offset = 201; 2077 } 2078 2079 virtual unsigned int offset202(int) { 2080 return offset = 202; 2081 } 2082 2083 virtual unsigned int offset203(int) { 2084 return offset = 203; 2085 } 2086 2087 virtual unsigned int offset204(int) { 2088 return offset = 204; 2089 } 2090 2091 virtual unsigned int offset205(int) { 2092 return offset = 205; 2093 } 2094 2095 virtual unsigned int offset206(int) { 2096 return offset = 206; 2097 } 2098 2099 virtual unsigned int offset207(int) { 2100 return offset = 207; 2101 } 2102 2103 virtual unsigned int offset208(int) { 2104 return offset = 208; 2105 } 2106 2107 virtual unsigned int offset209(int) { 2108 return offset = 209; 2109 } 2110 2111 virtual unsigned int offset210(int) { 2112 return offset = 210; 2113 } 2114 2115 virtual unsigned int offset211(int) { 2116 return offset = 211; 2117 } 2118 2119 virtual unsigned int offset212(int) { 2120 return offset = 212; 2121 } 2122 2123 virtual unsigned int offset213(int) { 2124 return offset = 213; 2125 } 2126 2127 virtual unsigned int offset214(int) { 2128 return offset = 214; 2129 } 2130 2131 virtual unsigned int offset215(int) { 2132 return offset = 215; 2133 } 2134 2135 virtual unsigned int offset216(int) { 2136 return offset = 216; 2137 } 2138 2139 virtual unsigned int offset217(int) { 2140 return offset = 217; 2141 } 2142 2143 virtual unsigned int offset218(int) { 2144 return offset = 218; 2145 } 2146 2147 virtual unsigned int offset219(int) { 2148 return offset = 219; 2149 } 2150 2151 virtual unsigned int offset220(int) { 2152 return offset = 220; 2153 } 2154 2155 virtual unsigned int offset221(int) { 2156 return offset = 221; 2157 } 2158 2159 virtual unsigned int offset222(int) { 2160 return offset = 222; 2161 } 2162 2163 virtual unsigned int offset223(int) { 2164 return offset = 223; 2165 } 2166 2167 virtual unsigned int offset224(int) { 2168 return offset = 224; 2169 } 2170 2171 virtual unsigned int offset225(int) { 2172 return offset = 225; 2173 } 2174 2175 virtual unsigned int offset226(int) { 2176 return offset = 226; 2177 } 2178 2179 virtual unsigned int offset227(int) { 2180 return offset = 227; 2181 } 2182 2183 virtual unsigned int offset228(int) { 2184 return offset = 228; 2185 } 2186 2187 virtual unsigned int offset229(int) { 2188 return offset = 229; 2189 } 2190 2191 virtual unsigned int offset230(int) { 2192 return offset = 230; 2193 } 2194 2195 virtual unsigned int offset231(int) { 2196 return offset = 231; 2197 } 2198 2199 virtual unsigned int offset232(int) { 2200 return offset = 232; 2201 } 2202 2203 virtual unsigned int offset233(int) { 2204 return offset = 233; 2205 } 2206 2207 virtual unsigned int offset234(int) { 2208 return offset = 234; 2209 } 2210 2211 virtual unsigned int offset235(int) { 2212 return offset = 235; 2213 } 2214 2215 virtual unsigned int offset236(int) { 2216 return offset = 236; 2217 } 2218 2219 virtual unsigned int offset237(int) { 2220 return offset = 237; 2221 } 2222 2223 virtual unsigned int offset238(int) { 2224 return offset = 238; 2225 } 2226 2227 virtual unsigned int offset239(int) { 2228 return offset = 239; 2229 } 2230 2231 virtual unsigned int offset240(int) { 2232 return offset = 240; 2233 } 2234 2235 virtual unsigned int offset241(int) { 2236 return offset = 241; 2237 } 2238 2239 virtual unsigned int offset242(int) { 2240 return offset = 242; 2241 } 2242 2243 virtual unsigned int offset243(int) { 2244 return offset = 243; 2245 } 2246 2247 virtual unsigned int offset244(int) { 2248 return offset = 244; 2249 } 2250 2251 virtual unsigned int offset245(int) { 2252 return offset = 245; 2253 } 2254 2255 virtual unsigned int offset246(int) { 2256 return offset = 246; 2257 } 2258 2259 virtual unsigned int offset247(int) { 2260 return offset = 247; 2261 } 2262 2263 virtual unsigned int offset248(int) { 2264 return offset = 248; 2265 } 2266 2267 virtual unsigned int offset249(int) { 2268 return offset = 249; 2269 } 2270 2271 virtual unsigned int offset250(int) { 2272 return offset = 250; 2273 } 2274 2275 virtual unsigned int offset251(int) { 2276 return offset = 251; 2277 } 2278 2279 virtual unsigned int offset252(int) { 2280 return offset = 252; 2281 } 2282 2283 virtual unsigned int offset253(int) { 2284 return offset = 253; 2285 } 2286 2287 virtual unsigned int offset254(int) { 2288 return offset = 254; 2289 } 2290 2291 virtual unsigned int offset255(int) { 2292 return offset = 255; 2293 } 2294 2295 virtual unsigned int offset256(int) { 2296 return offset = 256; 2297 } 2298 2299 virtual unsigned int offset257(int) { 2300 return offset = 257; 2301 } 2302 2303 virtual unsigned int offset258(int) { 2304 return offset = 258; 2305 } 2306 2307 virtual unsigned int offset259(int) { 2308 return offset = 259; 2309 } 2310 2311 virtual unsigned int offset260(int) { 2312 return offset = 260; 2313 } 2314 2315 virtual unsigned int offset261(int) { 2316 return offset = 261; 2317 } 2318 2319 virtual unsigned int offset262(int) { 2320 return offset = 262; 2321 } 2322 2323 virtual unsigned int offset263(int) { 2324 return offset = 263; 2325 } 2326 2327 virtual unsigned int offset264(int) { 2328 return offset = 264; 2329 } 2330 2331 virtual unsigned int offset265(int) { 2332 return offset = 265; 2333 } 2334 2335 virtual unsigned int offset266(int) { 2336 return offset = 266; 2337 } 2338 2339 virtual unsigned int offset267(int) { 2340 return offset = 267; 2341 } 2342 2343 virtual unsigned int offset268(int) { 2344 return offset = 268; 2345 } 2346 2347 virtual unsigned int offset269(int) { 2348 return offset = 269; 2349 } 2350 2351 virtual unsigned int offset270(int) { 2352 return offset = 270; 2353 } 2354 2355 virtual unsigned int offset271(int) { 2356 return offset = 271; 2357 } 2358 2359 virtual unsigned int offset272(int) { 2360 return offset = 272; 2361 } 2362 2363 virtual unsigned int offset273(int) { 2364 return offset = 273; 2365 } 2366 2367 virtual unsigned int offset274(int) { 2368 return offset = 274; 2369 } 2370 2371 virtual unsigned int offset275(int) { 2372 return offset = 275; 2373 } 2374 2375 virtual unsigned int offset276(int) { 2376 return offset = 276; 2377 } 2378 2379 virtual unsigned int offset277(int) { 2380 return offset = 277; 2381 } 2382 2383 virtual unsigned int offset278(int) { 2384 return offset = 278; 2385 } 2386 2387 virtual unsigned int offset279(int) { 2388 return offset = 279; 2389 } 2390 2391 virtual unsigned int offset280(int) { 2392 return offset = 280; 2393 } 2394 2395 virtual unsigned int offset281(int) { 2396 return offset = 281; 2397 } 2398 2399 virtual unsigned int offset282(int) { 2400 return offset = 282; 2401 } 2402 2403 virtual unsigned int offset283(int) { 2404 return offset = 283; 2405 } 2406 2407 virtual unsigned int offset284(int) { 2408 return offset = 284; 2409 } 2410 2411 virtual unsigned int offset285(int) { 2412 return offset = 285; 2413 } 2414 2415 virtual unsigned int offset286(int) { 2416 return offset = 286; 2417 } 2418 2419 virtual unsigned int offset287(int) { 2420 return offset = 287; 2421 } 2422 2423 virtual unsigned int offset288(int) { 2424 return offset = 288; 2425 } 2426 2427 virtual unsigned int offset289(int) { 2428 return offset = 289; 2429 } 2430 2431 virtual unsigned int offset290(int) { 2432 return offset = 290; 2433 } 2434 2435 virtual unsigned int offset291(int) { 2436 return offset = 291; 2437 } 2438 2439 virtual unsigned int offset292(int) { 2440 return offset = 292; 2441 } 2442 2443 virtual unsigned int offset293(int) { 2444 return offset = 293; 2445 } 2446 2447 virtual unsigned int offset294(int) { 2448 return offset = 294; 2449 } 2450 2451 virtual unsigned int offset295(int) { 2452 return offset = 295; 2453 } 2454 2455 virtual unsigned int offset296(int) { 2456 return offset = 296; 2457 } 2458 2459 virtual unsigned int offset297(int) { 2460 return offset = 297; 2461 } 2462 2463 virtual unsigned int offset298(int) { 2464 return offset = 298; 2465 } 2466 2467 virtual unsigned int offset299(int) { 2468 return offset = 299; 2469 } 2470 2471 2472 virtual unsigned int offset300(int) { 2473 return offset = 300; 2474 } 2475 2476 virtual unsigned int offset301(int) { 2477 return offset = 301; 2478 } 2479 2480 virtual unsigned int offset302(int) { 2481 return offset = 302; 2482 } 2483 2484 virtual unsigned int offset303(int) { 2485 return offset = 303; 2486 } 2487 2488 virtual unsigned int offset304(int) { 2489 return offset = 304; 2490 } 2491 2492 virtual unsigned int offset305(int) { 2493 return offset = 305; 2494 } 2495 2496 virtual unsigned int offset306(int) { 2497 return offset = 306; 2498 } 2499 2500 virtual unsigned int offset307(int) { 2501 return offset = 307; 2502 } 2503 2504 virtual unsigned int offset308(int) { 2505 return offset = 308; 2506 } 2507 2508 virtual unsigned int offset309(int) { 2509 return offset = 309; 2510 } 2511 2512 virtual unsigned int offset310(int) { 2513 return offset = 310; 2514 } 2515 2516 virtual unsigned int offset311(int) { 2517 return offset = 311; 2518 } 2519 2520 virtual unsigned int offset312(int) { 2521 return offset = 312; 2522 } 2523 2524 virtual unsigned int offset313(int) { 2525 return offset = 313; 2526 } 2527 2528 virtual unsigned int offset314(int) { 2529 return offset = 314; 2530 } 2531 2532 virtual unsigned int offset315(int) { 2533 return offset = 315; 2534 } 2535 2536 virtual unsigned int offset316(int) { 2537 return offset = 316; 2538 } 2539 2540 virtual unsigned int offset317(int) { 2541 return offset = 317; 2542 } 2543 2544 virtual unsigned int offset318(int) { 2545 return offset = 318; 2546 } 2547 2548 virtual unsigned int offset319(int) { 2549 return offset = 319; 2550 } 2551 2552 virtual unsigned int offset320(int) { 2553 return offset = 320; 2554 } 2555 2556 virtual unsigned int offset321(int) { 2557 return offset = 321; 2558 } 2559 2560 virtual unsigned int offset322(int) { 2561 return offset = 322; 2562 } 2563 2564 virtual unsigned int offset323(int) { 2565 return offset = 323; 2566 } 2567 2568 virtual unsigned int offset324(int) { 2569 return offset = 324; 2570 } 2571 2572 virtual unsigned int offset325(int) { 2573 return offset = 325; 2574 } 2575 2576 virtual unsigned int offset326(int) { 2577 return offset = 326; 2578 } 2579 2580 virtual unsigned int offset327(int) { 2581 return offset = 327; 2582 } 2583 2584 virtual unsigned int offset328(int) { 2585 return offset = 328; 2586 } 2587 2588 virtual unsigned int offset329(int) { 2589 return offset = 329; 2590 } 2591 2592 virtual unsigned int offset330(int) { 2593 return offset = 330; 2594 } 2595 2596 virtual unsigned int offset331(int) { 2597 return offset = 331; 2598 } 2599 2600 virtual unsigned int offset332(int) { 2601 return offset = 332; 2602 } 2603 2604 virtual unsigned int offset333(int) { 2605 return offset = 333; 2606 } 2607 2608 virtual unsigned int offset334(int) { 2609 return offset = 334; 2610 } 2611 2612 virtual unsigned int offset335(int) { 2613 return offset = 335; 2614 } 2615 2616 virtual unsigned int offset336(int) { 2617 return offset = 336; 2618 } 2619 2620 virtual unsigned int offset337(int) { 2621 return offset = 337; 2622 } 2623 2624 virtual unsigned int offset338(int) { 2625 return offset = 338; 2626 } 2627 2628 virtual unsigned int offset339(int) { 2629 return offset = 339; 2630 } 2631 2632 virtual unsigned int offset340(int) { 2633 return offset = 340; 2634 } 2635 2636 virtual unsigned int offset341(int) { 2637 return offset = 341; 2638 } 2639 2640 virtual unsigned int offset342(int) { 2641 return offset = 342; 2642 } 2643 2644 virtual unsigned int offset343(int) { 2645 return offset = 343; 2646 } 2647 2648 virtual unsigned int offset344(int) { 2649 return offset = 344; 2650 } 2651 2652 virtual unsigned int offset345(int) { 2653 return offset = 345; 2654 } 2655 2656 virtual unsigned int offset346(int) { 2657 return offset = 346; 2658 } 2659 2660 virtual unsigned int offset347(int) { 2661 return offset = 347; 2662 } 2663 2664 virtual unsigned int offset348(int) { 2665 return offset = 348; 2666 } 2667 2668 virtual unsigned int offset349(int) { 2669 return offset = 349; 2670 } 2671 2672 virtual unsigned int offset350(int) { 2673 return offset = 350; 2674 } 2675 2676 virtual unsigned int offset351(int) { 2677 return offset = 351; 2678 } 2679 2680 virtual unsigned int offset352(int) { 2681 return offset = 352; 2682 } 2683 2684 virtual unsigned int offset353(int) { 2685 return offset = 353; 2686 } 2687 2688 virtual unsigned int offset354(int) { 2689 return offset = 354; 2690 } 2691 2692 virtual unsigned int offset355(int) { 2693 return offset = 355; 2694 } 2695 2696 virtual unsigned int offset356(int) { 2697 return offset = 356; 2698 } 2699 2700 virtual unsigned int offset357(int) { 2701 return offset = 357; 2702 } 2703 2704 virtual unsigned int offset358(int) { 2705 return offset = 358; 2706 } 2707 2708 virtual unsigned int offset359(int) { 2709 return offset = 359; 2710 } 2711 2712 virtual unsigned int offset360(int) { 2713 return offset = 360; 2714 } 2715 2716 virtual unsigned int offset361(int) { 2717 return offset = 361; 2718 } 2719 2720 virtual unsigned int offset362(int) { 2721 return offset = 362; 2722 } 2723 2724 virtual unsigned int offset363(int) { 2725 return offset = 363; 2726 } 2727 2728 virtual unsigned int offset364(int) { 2729 return offset = 364; 2730 } 2731 2732 virtual unsigned int offset365(int) { 2733 return offset = 365; 2734 } 2735 2736 virtual unsigned int offset366(int) { 2737 return offset = 366; 2738 } 2739 2740 virtual unsigned int offset367(int) { 2741 return offset = 367; 2742 } 2743 2744 virtual unsigned int offset368(int) { 2745 return offset = 368; 2746 } 2747 2748 virtual unsigned int offset369(int) { 2749 return offset = 369; 2750 } 2751 2752 virtual unsigned int offset370(int) { 2753 return offset = 370; 2754 } 2755 2756 virtual unsigned int offset371(int) { 2757 return offset = 371; 2758 } 2759 2760 virtual unsigned int offset372(int) { 2761 return offset = 372; 2762 } 2763 2764 virtual unsigned int offset373(int) { 2765 return offset = 373; 2766 } 2767 2768 virtual unsigned int offset374(int) { 2769 return offset = 374; 2770 } 2771 2772 virtual unsigned int offset375(int) { 2773 return offset = 375; 2774 } 2775 2776 virtual unsigned int offset376(int) { 2777 return offset = 376; 2778 } 2779 2780 virtual unsigned int offset377(int) { 2781 return offset = 377; 2782 } 2783 2784 virtual unsigned int offset378(int) { 2785 return offset = 378; 2786 } 2787 2788 virtual unsigned int offset379(int) { 2789 return offset = 379; 2790 } 2791 2792 virtual unsigned int offset380(int) { 2793 return offset = 380; 2794 } 2795 2796 virtual unsigned int offset381(int) { 2797 return offset = 381; 2798 } 2799 2800 virtual unsigned int offset382(int) { 2801 return offset = 382; 2802 } 2803 2804 virtual unsigned int offset383(int) { 2805 return offset = 383; 2806 } 2807 2808 virtual unsigned int offset384(int) { 2809 return offset = 384; 2810 } 2811 2812 virtual unsigned int offset385(int) { 2813 return offset = 385; 2814 } 2815 2816 virtual unsigned int offset386(int) { 2817 return offset = 386; 2818 } 2819 2820 virtual unsigned int offset387(int) { 2821 return offset = 387; 2822 } 2823 2824 virtual unsigned int offset388(int) { 2825 return offset = 388; 2826 } 2827 2828 virtual unsigned int offset389(int) { 2829 return offset = 389; 2830 } 2831 2832 virtual unsigned int offset390(int) { 2833 return offset = 390; 2834 } 2835 2836 virtual unsigned int offset391(int) { 2837 return offset = 391; 2838 } 2839 2840 virtual unsigned int offset392(int) { 2841 return offset = 392; 2842 } 2843 2844 virtual unsigned int offset393(int) { 2845 return offset = 393; 2846 } 2847 2848 virtual unsigned int offset394(int) { 2849 return offset = 394; 2850 } 2851 2852 virtual unsigned int offset395(int) { 2853 return offset = 395; 2854 } 2855 2856 virtual unsigned int offset396(int) { 2857 return offset = 396; 2858 } 2859 2860 virtual unsigned int offset397(int) { 2861 return offset = 397; 2862 } 2863 2864 virtual unsigned int offset398(int) { 2865 return offset = 398; 2866 } 2867 2868 virtual unsigned int offset399(int) { 2869 return offset = 399; 2870 } 2871 2872 2873 virtual unsigned int offset400(int) { 2874 return offset = 400; 2875 } 2876 2877 virtual unsigned int offset401(int) { 2878 return offset = 401; 2879 } 2880 2881 virtual unsigned int offset402(int) { 2882 return offset = 402; 2883 } 2884 2885 virtual unsigned int offset403(int) { 2886 return offset = 403; 2887 } 2888 2889 virtual unsigned int offset404(int) { 2890 return offset = 404; 2891 } 2892 2893 virtual unsigned int offset405(int) { 2894 return offset = 405; 2895 } 2896 2897 virtual unsigned int offset406(int) { 2898 return offset = 406; 2899 } 2900 2901 virtual unsigned int offset407(int) { 2902 return offset = 407; 2903 } 2904 2905 virtual unsigned int offset408(int) { 2906 return offset = 408; 2907 } 2908 2909 virtual unsigned int offset409(int) { 2910 return offset = 409; 2911 } 2912 2913 virtual unsigned int offset410(int) { 2914 return offset = 410; 2915 } 2916 2917 virtual unsigned int offset411(int) { 2918 return offset = 411; 2919 } 2920 2921 virtual unsigned int offset412(int) { 2922 return offset = 412; 2923 } 2924 2925 virtual unsigned int offset413(int) { 2926 return offset = 413; 2927 } 2928 2929 virtual unsigned int offset414(int) { 2930 return offset = 414; 2931 } 2932 2933 virtual unsigned int offset415(int) { 2934 return offset = 415; 2935 } 2936 2937 virtual unsigned int offset416(int) { 2938 return offset = 416; 2939 } 2940 2941 virtual unsigned int offset417(int) { 2942 return offset = 417; 2943 } 2944 2945 virtual unsigned int offset418(int) { 2946 return offset = 418; 2947 } 2948 2949 virtual unsigned int offset419(int) { 2950 return offset = 419; 2951 } 2952 2953 virtual unsigned int offset420(int) { 2954 return offset = 420; 2955 } 2956 2957 virtual unsigned int offset421(int) { 2958 return offset = 421; 2959 } 2960 2961 virtual unsigned int offset422(int) { 2962 return offset = 422; 2963 } 2964 2965 virtual unsigned int offset423(int) { 2966 return offset = 423; 2967 } 2968 2969 virtual unsigned int offset424(int) { 2970 return offset = 424; 2971 } 2972 2973 virtual unsigned int offset425(int) { 2974 return offset = 425; 2975 } 2976 2977 virtual unsigned int offset426(int) { 2978 return offset = 426; 2979 } 2980 2981 virtual unsigned int offset427(int) { 2982 return offset = 427; 2983 } 2984 2985 virtual unsigned int offset428(int) { 2986 return offset = 428; 2987 } 2988 2989 virtual unsigned int offset429(int) { 2990 return offset = 429; 2991 } 2992 2993 virtual unsigned int offset430(int) { 2994 return offset = 430; 2995 } 2996 2997 virtual unsigned int offset431(int) { 2998 return offset = 431; 2999 } 3000 3001 virtual unsigned int offset432(int) { 3002 return offset = 432; 3003 } 3004 3005 virtual unsigned int offset433(int) { 3006 return offset = 433; 3007 } 3008 3009 virtual unsigned int offset434(int) { 3010 return offset = 434; 3011 } 3012 3013 virtual unsigned int offset435(int) { 3014 return offset = 435; 3015 } 3016 3017 virtual unsigned int offset436(int) { 3018 return offset = 436; 3019 } 3020 3021 virtual unsigned int offset437(int) { 3022 return offset = 437; 3023 } 3024 3025 virtual unsigned int offset438(int) { 3026 return offset = 438; 3027 } 3028 3029 virtual unsigned int offset439(int) { 3030 return offset = 439; 3031 } 3032 3033 virtual unsigned int offset440(int) { 3034 return offset = 440; 3035 } 3036 3037 virtual unsigned int offset441(int) { 3038 return offset = 441; 3039 } 3040 3041 virtual unsigned int offset442(int) { 3042 return offset = 442; 3043 } 3044 3045 virtual unsigned int offset443(int) { 3046 return offset = 443; 3047 } 3048 3049 virtual unsigned int offset444(int) { 3050 return offset = 444; 3051 } 3052 3053 virtual unsigned int offset445(int) { 3054 return offset = 445; 3055 } 3056 3057 virtual unsigned int offset446(int) { 3058 return offset = 446; 3059 } 3060 3061 virtual unsigned int offset447(int) { 3062 return offset = 447; 3063 } 3064 3065 virtual unsigned int offset448(int) { 3066 return offset = 448; 3067 } 3068 3069 virtual unsigned int offset449(int) { 3070 return offset = 449; 3071 } 3072 3073 virtual unsigned int offset450(int) { 3074 return offset = 450; 3075 } 3076 3077 virtual unsigned int offset451(int) { 3078 return offset = 451; 3079 } 3080 3081 virtual unsigned int offset452(int) { 3082 return offset = 452; 3083 } 3084 3085 virtual unsigned int offset453(int) { 3086 return offset = 453; 3087 } 3088 3089 virtual unsigned int offset454(int) { 3090 return offset = 454; 3091 } 3092 3093 virtual unsigned int offset455(int) { 3094 return offset = 455; 3095 } 3096 3097 virtual unsigned int offset456(int) { 3098 return offset = 456; 3099 } 3100 3101 virtual unsigned int offset457(int) { 3102 return offset = 457; 3103 } 3104 3105 virtual unsigned int offset458(int) { 3106 return offset = 458; 3107 } 3108 3109 virtual unsigned int offset459(int) { 3110 return offset = 459; 3111 } 3112 3113 virtual unsigned int offset460(int) { 3114 return offset = 460; 3115 } 3116 3117 virtual unsigned int offset461(int) { 3118 return offset = 461; 3119 } 3120 3121 virtual unsigned int offset462(int) { 3122 return offset = 462; 3123 } 3124 3125 virtual unsigned int offset463(int) { 3126 return offset = 463; 3127 } 3128 3129 virtual unsigned int offset464(int) { 3130 return offset = 464; 3131 } 3132 3133 virtual unsigned int offset465(int) { 3134 return offset = 465; 3135 } 3136 3137 virtual unsigned int offset466(int) { 3138 return offset = 466; 3139 } 3140 3141 virtual unsigned int offset467(int) { 3142 return offset = 467; 3143 } 3144 3145 virtual unsigned int offset468(int) { 3146 return offset = 468; 3147 } 3148 3149 virtual unsigned int offset469(int) { 3150 return offset = 469; 3151 } 3152 3153 virtual unsigned int offset470(int) { 3154 return offset = 470; 3155 } 3156 3157 virtual unsigned int offset471(int) { 3158 return offset = 471; 3159 } 3160 3161 virtual unsigned int offset472(int) { 3162 return offset = 472; 3163 } 3164 3165 virtual unsigned int offset473(int) { 3166 return offset = 473; 3167 } 3168 3169 virtual unsigned int offset474(int) { 3170 return offset = 474; 3171 } 3172 3173 virtual unsigned int offset475(int) { 3174 return offset = 475; 3175 } 3176 3177 virtual unsigned int offset476(int) { 3178 return offset = 476; 3179 } 3180 3181 virtual unsigned int offset477(int) { 3182 return offset = 477; 3183 } 3184 3185 virtual unsigned int offset478(int) { 3186 return offset = 478; 3187 } 3188 3189 virtual unsigned int offset479(int) { 3190 return offset = 479; 3191 } 3192 3193 virtual unsigned int offset480(int) { 3194 return offset = 480; 3195 } 3196 3197 virtual unsigned int offset481(int) { 3198 return offset = 481; 3199 } 3200 3201 virtual unsigned int offset482(int) { 3202 return offset = 482; 3203 } 3204 3205 virtual unsigned int offset483(int) { 3206 return offset = 483; 3207 } 3208 3209 virtual unsigned int offset484(int) { 3210 return offset = 484; 3211 } 3212 3213 virtual unsigned int offset485(int) { 3214 return offset = 485; 3215 } 3216 3217 virtual unsigned int offset486(int) { 3218 return offset = 486; 3219 } 3220 3221 virtual unsigned int offset487(int) { 3222 return offset = 487; 3223 } 3224 3225 virtual unsigned int offset488(int) { 3226 return offset = 488; 3227 } 3228 3229 virtual unsigned int offset489(int) { 3230 return offset = 489; 3231 } 3232 3233 virtual unsigned int offset490(int) { 3234 return offset = 490; 3235 } 3236 3237 virtual unsigned int offset491(int) { 3238 return offset = 491; 3239 } 3240 3241 virtual unsigned int offset492(int) { 3242 return offset = 492; 3243 } 3244 3245 virtual unsigned int offset493(int) { 3246 return offset = 493; 3247 } 3248 3249 virtual unsigned int offset494(int) { 3250 return offset = 494; 3251 } 3252 3253 virtual unsigned int offset495(int) { 3254 return offset = 495; 3255 } 3256 3257 virtual unsigned int offset496(int) { 3258 return offset = 496; 3259 } 3260 3261 virtual unsigned int offset497(int) { 3262 return offset = 497; 3263 } 3264 3265 virtual unsigned int offset498(int) { 3266 return offset = 498; 3267 } 3268 3269 virtual unsigned int offset499(int) { 3270 return offset = 499; 3271 } 3272 3273 3274 virtual unsigned int offset500(int) { 3275 return offset = 500; 3276 } 3277 3278 virtual unsigned int offset501(int) { 3279 return offset = 501; 3280 } 3281 3282 virtual unsigned int offset502(int) { 3283 return offset = 502; 3284 } 3285 3286 virtual unsigned int offset503(int) { 3287 return offset = 503; 3288 } 3289 3290 virtual unsigned int offset504(int) { 3291 return offset = 504; 3292 } 3293 3294 virtual unsigned int offset505(int) { 3295 return offset = 505; 3296 } 3297 3298 virtual unsigned int offset506(int) { 3299 return offset = 506; 3300 } 3301 3302 virtual unsigned int offset507(int) { 3303 return offset = 507; 3304 } 3305 3306 virtual unsigned int offset508(int) { 3307 return offset = 508; 3308 } 3309 3310 virtual unsigned int offset509(int) { 3311 return offset = 509; 3312 } 3313 3314 virtual unsigned int offset510(int) { 3315 return offset = 510; 3316 } 3317 3318 virtual unsigned int offset511(int) { 3319 return offset = 511; 3320 } 3321 3322 virtual unsigned int offset512(int) { 3323 return offset = 512; 3324 } 3325 3326 virtual unsigned int offset513(int) { 3327 return offset = 513; 3328 } 3329 3330 virtual unsigned int offset514(int) { 3331 return offset = 514; 3332 } 3333 3334 virtual unsigned int offset515(int) { 3335 return offset = 515; 3336 } 3337 3338 virtual unsigned int offset516(int) { 3339 return offset = 516; 3340 } 3341 3342 virtual unsigned int offset517(int) { 3343 return offset = 517; 3344 } 3345 3346 virtual unsigned int offset518(int) { 3347 return offset = 518; 3348 } 3349 3350 virtual unsigned int offset519(int) { 3351 return offset = 519; 3352 } 3353 3354 virtual unsigned int offset520(int) { 3355 return offset = 520; 3356 } 3357 3358 virtual unsigned int offset521(int) { 3359 return offset = 521; 3360 } 3361 3362 virtual unsigned int offset522(int) { 3363 return offset = 522; 3364 } 3365 3366 virtual unsigned int offset523(int) { 3367 return offset = 523; 3368 } 3369 3370 virtual unsigned int offset524(int) { 3371 return offset = 524; 3372 } 3373 3374 virtual unsigned int offset525(int) { 3375 return offset = 525; 3376 } 3377 3378 virtual unsigned int offset526(int) { 3379 return offset = 526; 3380 } 3381 3382 virtual unsigned int offset527(int) { 3383 return offset = 527; 3384 } 3385 3386 virtual unsigned int offset528(int) { 3387 return offset = 528; 3388 } 3389 3390 virtual unsigned int offset529(int) { 3391 return offset = 529; 3392 } 3393 3394 virtual unsigned int offset530(int) { 3395 return offset = 530; 3396 } 3397 3398 virtual unsigned int offset531(int) { 3399 return offset = 531; 3400 } 3401 3402 virtual unsigned int offset532(int) { 3403 return offset = 532; 3404 } 3405 3406 virtual unsigned int offset533(int) { 3407 return offset = 533; 3408 } 3409 3410 virtual unsigned int offset534(int) { 3411 return offset = 534; 3412 } 3413 3414 virtual unsigned int offset535(int) { 3415 return offset = 535; 3416 } 3417 3418 virtual unsigned int offset536(int) { 3419 return offset = 536; 3420 } 3421 3422 virtual unsigned int offset537(int) { 3423 return offset = 537; 3424 } 3425 3426 virtual unsigned int offset538(int) { 3427 return offset = 538; 3428 } 3429 3430 virtual unsigned int offset539(int) { 3431 return offset = 539; 3432 } 3433 3434 virtual unsigned int offset540(int) { 3435 return offset = 540; 3436 } 3437 3438 virtual unsigned int offset541(int) { 3439 return offset = 541; 3440 } 3441 3442 virtual unsigned int offset542(int) { 3443 return offset = 542; 3444 } 3445 3446 virtual unsigned int offset543(int) { 3447 return offset = 543; 3448 } 3449 3450 virtual unsigned int offset544(int) { 3451 return offset = 544; 3452 } 3453 3454 virtual unsigned int offset545(int) { 3455 return offset = 545; 3456 } 3457 3458 virtual unsigned int offset546(int) { 3459 return offset = 546; 3460 } 3461 3462 virtual unsigned int offset547(int) { 3463 return offset = 547; 3464 } 3465 3466 virtual unsigned int offset548(int) { 3467 return offset = 548; 3468 } 3469 3470 virtual unsigned int offset549(int) { 3471 return offset = 549; 3472 } 3473 3474 virtual unsigned int offset550(int) { 3475 return offset = 550; 3476 } 3477 3478 virtual unsigned int offset551(int) { 3479 return offset = 551; 3480 } 3481 3482 virtual unsigned int offset552(int) { 3483 return offset = 552; 3484 } 3485 3486 virtual unsigned int offset553(int) { 3487 return offset = 553; 3488 } 3489 3490 virtual unsigned int offset554(int) { 3491 return offset = 554; 3492 } 3493 3494 virtual unsigned int offset555(int) { 3495 return offset = 555; 3496 } 3497 3498 virtual unsigned int offset556(int) { 3499 return offset = 556; 3500 } 3501 3502 virtual unsigned int offset557(int) { 3503 return offset = 557; 3504 } 3505 3506 virtual unsigned int offset558(int) { 3507 return offset = 558; 3508 } 3509 3510 virtual unsigned int offset559(int) { 3511 return offset = 559; 3512 } 3513 3514 virtual unsigned int offset560(int) { 3515 return offset = 560; 3516 } 3517 3518 virtual unsigned int offset561(int) { 3519 return offset = 561; 3520 } 3521 3522 virtual unsigned int offset562(int) { 3523 return offset = 562; 3524 } 3525 3526 virtual unsigned int offset563(int) { 3527 return offset = 563; 3528 } 3529 3530 virtual unsigned int offset564(int) { 3531 return offset = 564; 3532 } 3533 3534 virtual unsigned int offset565(int) { 3535 return offset = 565; 3536 } 3537 3538 virtual unsigned int offset566(int) { 3539 return offset = 566; 3540 } 3541 3542 virtual unsigned int offset567(int) { 3543 return offset = 567; 3544 } 3545 3546 virtual unsigned int offset568(int) { 3547 return offset = 568; 3548 } 3549 3550 virtual unsigned int offset569(int) { 3551 return offset = 569; 3552 } 3553 3554 virtual unsigned int offset570(int) { 3555 return offset = 570; 3556 } 3557 3558 virtual unsigned int offset571(int) { 3559 return offset = 571; 3560 } 3561 3562 virtual unsigned int offset572(int) { 3563 return offset = 572; 3564 } 3565 3566 virtual unsigned int offset573(int) { 3567 return offset = 573; 3568 } 3569 3570 virtual unsigned int offset574(int) { 3571 return offset = 574; 3572 } 3573 3574 virtual unsigned int offset575(int) { 3575 return offset = 575; 3576 } 3577 3578 virtual unsigned int offset576(int) { 3579 return offset = 576; 3580 } 3581 3582 virtual unsigned int offset577(int) { 3583 return offset = 577; 3584 } 3585 3586 virtual unsigned int offset578(int) { 3587 return offset = 578; 3588 } 3589 3590 virtual unsigned int offset579(int) { 3591 return offset = 579; 3592 } 3593 3594 virtual unsigned int offset580(int) { 3595 return offset = 580; 3596 } 3597 3598 virtual unsigned int offset581(int) { 3599 return offset = 581; 3600 } 3601 3602 virtual unsigned int offset582(int) { 3603 return offset = 582; 3604 } 3605 3606 virtual unsigned int offset583(int) { 3607 return offset = 583; 3608 } 3609 3610 virtual unsigned int offset584(int) { 3611 return offset = 584; 3612 } 3613 3614 virtual unsigned int offset585(int) { 3615 return offset = 585; 3616 } 3617 3618 virtual unsigned int offset586(int) { 3619 return offset = 586; 3620 } 3621 3622 virtual unsigned int offset587(int) { 3623 return offset = 587; 3624 } 3625 3626 virtual unsigned int offset588(int) { 3627 return offset = 588; 3628 } 3629 3630 virtual unsigned int offset589(int) { 3631 return offset = 589; 3632 } 3633 3634 virtual unsigned int offset590(int) { 3635 return offset = 590; 3636 } 3637 3638 virtual unsigned int offset591(int) { 3639 return offset = 591; 3640 } 3641 3642 virtual unsigned int offset592(int) { 3643 return offset = 592; 3644 } 3645 3646 virtual unsigned int offset593(int) { 3647 return offset = 593; 3648 } 3649 3650 virtual unsigned int offset594(int) { 3651 return offset = 594; 3652 } 3653 3654 virtual unsigned int offset595(int) { 3655 return offset = 595; 3656 } 3657 3658 virtual unsigned int offset596(int) { 3659 return offset = 596; 3660 } 3661 3662 virtual unsigned int offset597(int) { 3663 return offset = 597; 3664 } 3665 3666 virtual unsigned int offset598(int) { 3667 return offset = 598; 3668 } 3669 3670 virtual unsigned int offset599(int) { 3671 return offset = 599; 3672 } 3673 3674 3675 virtual unsigned int offset600(int) { 3676 return offset = 600; 3677 } 3678 3679 virtual unsigned int offset601(int) { 3680 return offset = 601; 3681 } 3682 3683 virtual unsigned int offset602(int) { 3684 return offset = 602; 3685 } 3686 3687 virtual unsigned int offset603(int) { 3688 return offset = 603; 3689 } 3690 3691 virtual unsigned int offset604(int) { 3692 return offset = 604; 3693 } 3694 3695 virtual unsigned int offset605(int) { 3696 return offset = 605; 3697 } 3698 3699 virtual unsigned int offset606(int) { 3700 return offset = 606; 3701 } 3702 3703 virtual unsigned int offset607(int) { 3704 return offset = 607; 3705 } 3706 3707 virtual unsigned int offset608(int) { 3708 return offset = 608; 3709 } 3710 3711 virtual unsigned int offset609(int) { 3712 return offset = 609; 3713 } 3714 3715 virtual unsigned int offset610(int) { 3716 return offset = 610; 3717 } 3718 3719 virtual unsigned int offset611(int) { 3720 return offset = 611; 3721 } 3722 3723 virtual unsigned int offset612(int) { 3724 return offset = 612; 3725 } 3726 3727 virtual unsigned int offset613(int) { 3728 return offset = 613; 3729 } 3730 3731 virtual unsigned int offset614(int) { 3732 return offset = 614; 3733 } 3734 3735 virtual unsigned int offset615(int) { 3736 return offset = 615; 3737 } 3738 3739 virtual unsigned int offset616(int) { 3740 return offset = 616; 3741 } 3742 3743 virtual unsigned int offset617(int) { 3744 return offset = 617; 3745 } 3746 3747 virtual unsigned int offset618(int) { 3748 return offset = 618; 3749 } 3750 3751 virtual unsigned int offset619(int) { 3752 return offset = 619; 3753 } 3754 3755 virtual unsigned int offset620(int) { 3756 return offset = 620; 3757 } 3758 3759 virtual unsigned int offset621(int) { 3760 return offset = 621; 3761 } 3762 3763 virtual unsigned int offset622(int) { 3764 return offset = 622; 3765 } 3766 3767 virtual unsigned int offset623(int) { 3768 return offset = 623; 3769 } 3770 3771 virtual unsigned int offset624(int) { 3772 return offset = 624; 3773 } 3774 3775 virtual unsigned int offset625(int) { 3776 return offset = 625; 3777 } 3778 3779 virtual unsigned int offset626(int) { 3780 return offset = 626; 3781 } 3782 3783 virtual unsigned int offset627(int) { 3784 return offset = 627; 3785 } 3786 3787 virtual unsigned int offset628(int) { 3788 return offset = 628; 3789 } 3790 3791 virtual unsigned int offset629(int) { 3792 return offset = 629; 3793 } 3794 3795 virtual unsigned int offset630(int) { 3796 return offset = 630; 3797 } 3798 3799 virtual unsigned int offset631(int) { 3800 return offset = 631; 3801 } 3802 3803 virtual unsigned int offset632(int) { 3804 return offset = 632; 3805 } 3806 3807 virtual unsigned int offset633(int) { 3808 return offset = 633; 3809 } 3810 3811 virtual unsigned int offset634(int) { 3812 return offset = 634; 3813 } 3814 3815 virtual unsigned int offset635(int) { 3816 return offset = 635; 3817 } 3818 3819 virtual unsigned int offset636(int) { 3820 return offset = 636; 3821 } 3822 3823 virtual unsigned int offset637(int) { 3824 return offset = 637; 3825 } 3826 3827 virtual unsigned int offset638(int) { 3828 return offset = 638; 3829 } 3830 3831 virtual unsigned int offset639(int) { 3832 return offset = 639; 3833 } 3834 3835 virtual unsigned int offset640(int) { 3836 return offset = 640; 3837 } 3838 3839 virtual unsigned int offset641(int) { 3840 return offset = 641; 3841 } 3842 3843 virtual unsigned int offset642(int) { 3844 return offset = 642; 3845 } 3846 3847 virtual unsigned int offset643(int) { 3848 return offset = 643; 3849 } 3850 3851 virtual unsigned int offset644(int) { 3852 return offset = 644; 3853 } 3854 3855 virtual unsigned int offset645(int) { 3856 return offset = 645; 3857 } 3858 3859 virtual unsigned int offset646(int) { 3860 return offset = 646; 3861 } 3862 3863 virtual unsigned int offset647(int) { 3864 return offset = 647; 3865 } 3866 3867 virtual unsigned int offset648(int) { 3868 return offset = 648; 3869 } 3870 3871 virtual unsigned int offset649(int) { 3872 return offset = 649; 3873 } 3874 3875 virtual unsigned int offset650(int) { 3876 return offset = 650; 3877 } 3878 3879 virtual unsigned int offset651(int) { 3880 return offset = 651; 3881 } 3882 3883 virtual unsigned int offset652(int) { 3884 return offset = 652; 3885 } 3886 3887 virtual unsigned int offset653(int) { 3888 return offset = 653; 3889 } 3890 3891 virtual unsigned int offset654(int) { 3892 return offset = 654; 3893 } 3894 3895 virtual unsigned int offset655(int) { 3896 return offset = 655; 3897 } 3898 3899 virtual unsigned int offset656(int) { 3900 return offset = 656; 3901 } 3902 3903 virtual unsigned int offset657(int) { 3904 return offset = 657; 3905 } 3906 3907 virtual unsigned int offset658(int) { 3908 return offset = 658; 3909 } 3910 3911 virtual unsigned int offset659(int) { 3912 return offset = 659; 3913 } 3914 3915 virtual unsigned int offset660(int) { 3916 return offset = 660; 3917 } 3918 3919 virtual unsigned int offset661(int) { 3920 return offset = 661; 3921 } 3922 3923 virtual unsigned int offset662(int) { 3924 return offset = 662; 3925 } 3926 3927 virtual unsigned int offset663(int) { 3928 return offset = 663; 3929 } 3930 3931 virtual unsigned int offset664(int) { 3932 return offset = 664; 3933 } 3934 3935 virtual unsigned int offset665(int) { 3936 return offset = 665; 3937 } 3938 3939 virtual unsigned int offset666(int) { 3940 return offset = 666; 3941 } 3942 3943 virtual unsigned int offset667(int) { 3944 return offset = 667; 3945 } 3946 3947 virtual unsigned int offset668(int) { 3948 return offset = 668; 3949 } 3950 3951 virtual unsigned int offset669(int) { 3952 return offset = 669; 3953 } 3954 3955 virtual unsigned int offset670(int) { 3956 return offset = 670; 3957 } 3958 3959 virtual unsigned int offset671(int) { 3960 return offset = 671; 3961 } 3962 3963 virtual unsigned int offset672(int) { 3964 return offset = 672; 3965 } 3966 3967 virtual unsigned int offset673(int) { 3968 return offset = 673; 3969 } 3970 3971 virtual unsigned int offset674(int) { 3972 return offset = 674; 3973 } 3974 3975 virtual unsigned int offset675(int) { 3976 return offset = 675; 3977 } 3978 3979 virtual unsigned int offset676(int) { 3980 return offset = 676; 3981 } 3982 3983 virtual unsigned int offset677(int) { 3984 return offset = 677; 3985 } 3986 3987 virtual unsigned int offset678(int) { 3988 return offset = 678; 3989 } 3990 3991 virtual unsigned int offset679(int) { 3992 return offset = 679; 3993 } 3994 3995 virtual unsigned int offset680(int) { 3996 return offset = 680; 3997 } 3998 3999 virtual unsigned int offset681(int) { 4000 return offset = 681; 4001 } 4002 4003 virtual unsigned int offset682(int) { 4004 return offset = 682; 4005 } 4006 4007 virtual unsigned int offset683(int) { 4008 return offset = 683; 4009 } 4010 4011 virtual unsigned int offset684(int) { 4012 return offset = 684; 4013 } 4014 4015 virtual unsigned int offset685(int) { 4016 return offset = 685; 4017 } 4018 4019 virtual unsigned int offset686(int) { 4020 return offset = 686; 4021 } 4022 4023 virtual unsigned int offset687(int) { 4024 return offset = 687; 4025 } 4026 4027 virtual unsigned int offset688(int) { 4028 return offset = 688; 4029 } 4030 4031 virtual unsigned int offset689(int) { 4032 return offset = 689; 4033 } 4034 4035 virtual unsigned int offset690(int) { 4036 return offset = 690; 4037 } 4038 4039 virtual unsigned int offset691(int) { 4040 return offset = 691; 4041 } 4042 4043 virtual unsigned int offset692(int) { 4044 return offset = 692; 4045 } 4046 4047 virtual unsigned int offset693(int) { 4048 return offset = 693; 4049 } 4050 4051 virtual unsigned int offset694(int) { 4052 return offset = 694; 4053 } 4054 4055 virtual unsigned int offset695(int) { 4056 return offset = 695; 4057 } 4058 4059 virtual unsigned int offset696(int) { 4060 return offset = 696; 4061 } 4062 4063 virtual unsigned int offset697(int) { 4064 return offset = 697; 4065 } 4066 4067 virtual unsigned int offset698(int) { 4068 return offset = 698; 4069 } 4070 4071 virtual unsigned int offset699(int) { 4072 return offset = 699; 4073 } 4074 4075 4076 virtual unsigned int offset700(int) { 4077 return offset = 700; 4078 } 4079 4080 virtual unsigned int offset701(int) { 4081 return offset = 701; 4082 } 4083 4084 virtual unsigned int offset702(int) { 4085 return offset = 702; 4086 } 4087 4088 virtual unsigned int offset703(int) { 4089 return offset = 703; 4090 } 4091 4092 virtual unsigned int offset704(int) { 4093 return offset = 704; 4094 } 4095 4096 virtual unsigned int offset705(int) { 4097 return offset = 705; 4098 } 4099 4100 virtual unsigned int offset706(int) { 4101 return offset = 706; 4102 } 4103 4104 virtual unsigned int offset707(int) { 4105 return offset = 707; 4106 } 4107 4108 virtual unsigned int offset708(int) { 4109 return offset = 708; 4110 } 4111 4112 virtual unsigned int offset709(int) { 4113 return offset = 709; 4114 } 4115 4116 virtual unsigned int offset710(int) { 4117 return offset = 710; 4118 } 4119 4120 virtual unsigned int offset711(int) { 4121 return offset = 711; 4122 } 4123 4124 virtual unsigned int offset712(int) { 4125 return offset = 712; 4126 } 4127 4128 virtual unsigned int offset713(int) { 4129 return offset = 713; 4130 } 4131 4132 virtual unsigned int offset714(int) { 4133 return offset = 714; 4134 } 4135 4136 virtual unsigned int offset715(int) { 4137 return offset = 715; 4138 } 4139 4140 virtual unsigned int offset716(int) { 4141 return offset = 716; 4142 } 4143 4144 virtual unsigned int offset717(int) { 4145 return offset = 717; 4146 } 4147 4148 virtual unsigned int offset718(int) { 4149 return offset = 718; 4150 } 4151 4152 virtual unsigned int offset719(int) { 4153 return offset = 719; 4154 } 4155 4156 virtual unsigned int offset720(int) { 4157 return offset = 720; 4158 } 4159 4160 virtual unsigned int offset721(int) { 4161 return offset = 721; 4162 } 4163 4164 virtual unsigned int offset722(int) { 4165 return offset = 722; 4166 } 4167 4168 virtual unsigned int offset723(int) { 4169 return offset = 723; 4170 } 4171 4172 virtual unsigned int offset724(int) { 4173 return offset = 724; 4174 } 4175 4176 virtual unsigned int offset725(int) { 4177 return offset = 725; 4178 } 4179 4180 virtual unsigned int offset726(int) { 4181 return offset = 726; 4182 } 4183 4184 virtual unsigned int offset727(int) { 4185 return offset = 727; 4186 } 4187 4188 virtual unsigned int offset728(int) { 4189 return offset = 728; 4190 } 4191 4192 virtual unsigned int offset729(int) { 4193 return offset = 729; 4194 } 4195 4196 virtual unsigned int offset730(int) { 4197 return offset = 730; 4198 } 4199 4200 virtual unsigned int offset731(int) { 4201 return offset = 731; 4202 } 4203 4204 virtual unsigned int offset732(int) { 4205 return offset = 732; 4206 } 4207 4208 virtual unsigned int offset733(int) { 4209 return offset = 733; 4210 } 4211 4212 virtual unsigned int offset734(int) { 4213 return offset = 734; 4214 } 4215 4216 virtual unsigned int offset735(int) { 4217 return offset = 735; 4218 } 4219 4220 virtual unsigned int offset736(int) { 4221 return offset = 736; 4222 } 4223 4224 virtual unsigned int offset737(int) { 4225 return offset = 737; 4226 } 4227 4228 virtual unsigned int offset738(int) { 4229 return offset = 738; 4230 } 4231 4232 virtual unsigned int offset739(int) { 4233 return offset = 739; 4234 } 4235 4236 virtual unsigned int offset740(int) { 4237 return offset = 740; 4238 } 4239 4240 virtual unsigned int offset741(int) { 4241 return offset = 741; 4242 } 4243 4244 virtual unsigned int offset742(int) { 4245 return offset = 742; 4246 } 4247 4248 virtual unsigned int offset743(int) { 4249 return offset = 743; 4250 } 4251 4252 virtual unsigned int offset744(int) { 4253 return offset = 744; 4254 } 4255 4256 virtual unsigned int offset745(int) { 4257 return offset = 745; 4258 } 4259 4260 virtual unsigned int offset746(int) { 4261 return offset = 746; 4262 } 4263 4264 virtual unsigned int offset747(int) { 4265 return offset = 747; 4266 } 4267 4268 virtual unsigned int offset748(int) { 4269 return offset = 748; 4270 } 4271 4272 virtual unsigned int offset749(int) { 4273 return offset = 749; 4274 } 4275 4276 virtual unsigned int offset750(int) { 4277 return offset = 750; 4278 } 4279 4280 virtual unsigned int offset751(int) { 4281 return offset = 751; 4282 } 4283 4284 virtual unsigned int offset752(int) { 4285 return offset = 752; 4286 } 4287 4288 virtual unsigned int offset753(int) { 4289 return offset = 753; 4290 } 4291 4292 virtual unsigned int offset754(int) { 4293 return offset = 754; 4294 } 4295 4296 virtual unsigned int offset755(int) { 4297 return offset = 755; 4298 } 4299 4300 virtual unsigned int offset756(int) { 4301 return offset = 756; 4302 } 4303 4304 virtual unsigned int offset757(int) { 4305 return offset = 757; 4306 } 4307 4308 virtual unsigned int offset758(int) { 4309 return offset = 758; 4310 } 4311 4312 virtual unsigned int offset759(int) { 4313 return offset = 759; 4314 } 4315 4316 virtual unsigned int offset760(int) { 4317 return offset = 760; 4318 } 4319 4320 virtual unsigned int offset761(int) { 4321 return offset = 761; 4322 } 4323 4324 virtual unsigned int offset762(int) { 4325 return offset = 762; 4326 } 4327 4328 virtual unsigned int offset763(int) { 4329 return offset = 763; 4330 } 4331 4332 virtual unsigned int offset764(int) { 4333 return offset = 764; 4334 } 4335 4336 virtual unsigned int offset765(int) { 4337 return offset = 765; 4338 } 4339 4340 virtual unsigned int offset766(int) { 4341 return offset = 766; 4342 } 4343 4344 virtual unsigned int offset767(int) { 4345 return offset = 767; 4346 } 4347 4348 virtual unsigned int offset768(int) { 4349 return offset = 768; 4350 } 4351 4352 virtual unsigned int offset769(int) { 4353 return offset = 769; 4354 } 4355 4356 virtual unsigned int offset770(int) { 4357 return offset = 770; 4358 } 4359 4360 virtual unsigned int offset771(int) { 4361 return offset = 771; 4362 } 4363 4364 virtual unsigned int offset772(int) { 4365 return offset = 772; 4366 } 4367 4368 virtual unsigned int offset773(int) { 4369 return offset = 773; 4370 } 4371 4372 virtual unsigned int offset774(int) { 4373 return offset = 774; 4374 } 4375 4376 virtual unsigned int offset775(int) { 4377 return offset = 775; 4378 } 4379 4380 virtual unsigned int offset776(int) { 4381 return offset = 776; 4382 } 4383 4384 virtual unsigned int offset777(int) { 4385 return offset = 777; 4386 } 4387 4388 virtual unsigned int offset778(int) { 4389 return offset = 778; 4390 } 4391 4392 virtual unsigned int offset779(int) { 4393 return offset = 779; 4394 } 4395 4396 virtual unsigned int offset780(int) { 4397 return offset = 780; 4398 } 4399 4400 virtual unsigned int offset781(int) { 4401 return offset = 781; 4402 } 4403 4404 virtual unsigned int offset782(int) { 4405 return offset = 782; 4406 } 4407 4408 virtual unsigned int offset783(int) { 4409 return offset = 783; 4410 } 4411 4412 virtual unsigned int offset784(int) { 4413 return offset = 784; 4414 } 4415 4416 virtual unsigned int offset785(int) { 4417 return offset = 785; 4418 } 4419 4420 virtual unsigned int offset786(int) { 4421 return offset = 786; 4422 } 4423 4424 virtual unsigned int offset787(int) { 4425 return offset = 787; 4426 } 4427 4428 virtual unsigned int offset788(int) { 4429 return offset = 788; 4430 } 4431 4432 virtual unsigned int offset789(int) { 4433 return offset = 789; 4434 } 4435 4436 virtual unsigned int offset790(int) { 4437 return offset = 790; 4438 } 4439 4440 virtual unsigned int offset791(int) { 4441 return offset = 791; 4442 } 4443 4444 virtual unsigned int offset792(int) { 4445 return offset = 792; 4446 } 4447 4448 virtual unsigned int offset793(int) { 4449 return offset = 793; 4450 } 4451 4452 virtual unsigned int offset794(int) { 4453 return offset = 794; 4454 } 4455 4456 virtual unsigned int offset795(int) { 4457 return offset = 795; 4458 } 4459 4460 virtual unsigned int offset796(int) { 4461 return offset = 796; 4462 } 4463 4464 virtual unsigned int offset797(int) { 4465 return offset = 797; 4466 } 4467 4468 virtual unsigned int offset798(int) { 4469 return offset = 798; 4470 } 4471 4472 virtual unsigned int offset799(int) { 4473 return offset = 799; 4474 } 4475 4476 4477 virtual unsigned int offset800(int) { 4478 return offset = 800; 4479 } 4480 4481 virtual unsigned int offset801(int) { 4482 return offset = 801; 4483 } 4484 4485 virtual unsigned int offset802(int) { 4486 return offset = 802; 4487 } 4488 4489 virtual unsigned int offset803(int) { 4490 return offset = 803; 4491 } 4492 4493 virtual unsigned int offset804(int) { 4494 return offset = 804; 4495 } 4496 4497 virtual unsigned int offset805(int) { 4498 return offset = 805; 4499 } 4500 4501 virtual unsigned int offset806(int) { 4502 return offset = 806; 4503 } 4504 4505 virtual unsigned int offset807(int) { 4506 return offset = 807; 4507 } 4508 4509 virtual unsigned int offset808(int) { 4510 return offset = 808; 4511 } 4512 4513 virtual unsigned int offset809(int) { 4514 return offset = 809; 4515 } 4516 4517 virtual unsigned int offset810(int) { 4518 return offset = 810; 4519 } 4520 4521 virtual unsigned int offset811(int) { 4522 return offset = 811; 4523 } 4524 4525 virtual unsigned int offset812(int) { 4526 return offset = 812; 4527 } 4528 4529 virtual unsigned int offset813(int) { 4530 return offset = 813; 4531 } 4532 4533 virtual unsigned int offset814(int) { 4534 return offset = 814; 4535 } 4536 4537 virtual unsigned int offset815(int) { 4538 return offset = 815; 4539 } 4540 4541 virtual unsigned int offset816(int) { 4542 return offset = 816; 4543 } 4544 4545 virtual unsigned int offset817(int) { 4546 return offset = 817; 4547 } 4548 4549 virtual unsigned int offset818(int) { 4550 return offset = 818; 4551 } 4552 4553 virtual unsigned int offset819(int) { 4554 return offset = 819; 4555 } 4556 4557 virtual unsigned int offset820(int) { 4558 return offset = 820; 4559 } 4560 4561 virtual unsigned int offset821(int) { 4562 return offset = 821; 4563 } 4564 4565 virtual unsigned int offset822(int) { 4566 return offset = 822; 4567 } 4568 4569 virtual unsigned int offset823(int) { 4570 return offset = 823; 4571 } 4572 4573 virtual unsigned int offset824(int) { 4574 return offset = 824; 4575 } 4576 4577 virtual unsigned int offset825(int) { 4578 return offset = 825; 4579 } 4580 4581 virtual unsigned int offset826(int) { 4582 return offset = 826; 4583 } 4584 4585 virtual unsigned int offset827(int) { 4586 return offset = 827; 4587 } 4588 4589 virtual unsigned int offset828(int) { 4590 return offset = 828; 4591 } 4592 4593 virtual unsigned int offset829(int) { 4594 return offset = 829; 4595 } 4596 4597 virtual unsigned int offset830(int) { 4598 return offset = 830; 4599 } 4600 4601 virtual unsigned int offset831(int) { 4602 return offset = 831; 4603 } 4604 4605 virtual unsigned int offset832(int) { 4606 return offset = 832; 4607 } 4608 4609 virtual unsigned int offset833(int) { 4610 return offset = 833; 4611 } 4612 4613 virtual unsigned int offset834(int) { 4614 return offset = 834; 4615 } 4616 4617 virtual unsigned int offset835(int) { 4618 return offset = 835; 4619 } 4620 4621 virtual unsigned int offset836(int) { 4622 return offset = 836; 4623 } 4624 4625 virtual unsigned int offset837(int) { 4626 return offset = 837; 4627 } 4628 4629 virtual unsigned int offset838(int) { 4630 return offset = 838; 4631 } 4632 4633 virtual unsigned int offset839(int) { 4634 return offset = 839; 4635 } 4636 4637 virtual unsigned int offset840(int) { 4638 return offset = 840; 4639 } 4640 4641 virtual unsigned int offset841(int) { 4642 return offset = 841; 4643 } 4644 4645 virtual unsigned int offset842(int) { 4646 return offset = 842; 4647 } 4648 4649 virtual unsigned int offset843(int) { 4650 return offset = 843; 4651 } 4652 4653 virtual unsigned int offset844(int) { 4654 return offset = 844; 4655 } 4656 4657 virtual unsigned int offset845(int) { 4658 return offset = 845; 4659 } 4660 4661 virtual unsigned int offset846(int) { 4662 return offset = 846; 4663 } 4664 4665 virtual unsigned int offset847(int) { 4666 return offset = 847; 4667 } 4668 4669 virtual unsigned int offset848(int) { 4670 return offset = 848; 4671 } 4672 4673 virtual unsigned int offset849(int) { 4674 return offset = 849; 4675 } 4676 4677 virtual unsigned int offset850(int) { 4678 return offset = 850; 4679 } 4680 4681 virtual unsigned int offset851(int) { 4682 return offset = 851; 4683 } 4684 4685 virtual unsigned int offset852(int) { 4686 return offset = 852; 4687 } 4688 4689 virtual unsigned int offset853(int) { 4690 return offset = 853; 4691 } 4692 4693 virtual unsigned int offset854(int) { 4694 return offset = 854; 4695 } 4696 4697 virtual unsigned int offset855(int) { 4698 return offset = 855; 4699 } 4700 4701 virtual unsigned int offset856(int) { 4702 return offset = 856; 4703 } 4704 4705 virtual unsigned int offset857(int) { 4706 return offset = 857; 4707 } 4708 4709 virtual unsigned int offset858(int) { 4710 return offset = 858; 4711 } 4712 4713 virtual unsigned int offset859(int) { 4714 return offset = 859; 4715 } 4716 4717 virtual unsigned int offset860(int) { 4718 return offset = 860; 4719 } 4720 4721 virtual unsigned int offset861(int) { 4722 return offset = 861; 4723 } 4724 4725 virtual unsigned int offset862(int) { 4726 return offset = 862; 4727 } 4728 4729 virtual unsigned int offset863(int) { 4730 return offset = 863; 4731 } 4732 4733 virtual unsigned int offset864(int) { 4734 return offset = 864; 4735 } 4736 4737 virtual unsigned int offset865(int) { 4738 return offset = 865; 4739 } 4740 4741 virtual unsigned int offset866(int) { 4742 return offset = 866; 4743 } 4744 4745 virtual unsigned int offset867(int) { 4746 return offset = 867; 4747 } 4748 4749 virtual unsigned int offset868(int) { 4750 return offset = 868; 4751 } 4752 4753 virtual unsigned int offset869(int) { 4754 return offset = 869; 4755 } 4756 4757 virtual unsigned int offset870(int) { 4758 return offset = 870; 4759 } 4760 4761 virtual unsigned int offset871(int) { 4762 return offset = 871; 4763 } 4764 4765 virtual unsigned int offset872(int) { 4766 return offset = 872; 4767 } 4768 4769 virtual unsigned int offset873(int) { 4770 return offset = 873; 4771 } 4772 4773 virtual unsigned int offset874(int) { 4774 return offset = 874; 4775 } 4776 4777 virtual unsigned int offset875(int) { 4778 return offset = 875; 4779 } 4780 4781 virtual unsigned int offset876(int) { 4782 return offset = 876; 4783 } 4784 4785 virtual unsigned int offset877(int) { 4786 return offset = 877; 4787 } 4788 4789 virtual unsigned int offset878(int) { 4790 return offset = 878; 4791 } 4792 4793 virtual unsigned int offset879(int) { 4794 return offset = 879; 4795 } 4796 4797 virtual unsigned int offset880(int) { 4798 return offset = 880; 4799 } 4800 4801 virtual unsigned int offset881(int) { 4802 return offset = 881; 4803 } 4804 4805 virtual unsigned int offset882(int) { 4806 return offset = 882; 4807 } 4808 4809 virtual unsigned int offset883(int) { 4810 return offset = 883; 4811 } 4812 4813 virtual unsigned int offset884(int) { 4814 return offset = 884; 4815 } 4816 4817 virtual unsigned int offset885(int) { 4818 return offset = 885; 4819 } 4820 4821 virtual unsigned int offset886(int) { 4822 return offset = 886; 4823 } 4824 4825 virtual unsigned int offset887(int) { 4826 return offset = 887; 4827 } 4828 4829 virtual unsigned int offset888(int) { 4830 return offset = 888; 4831 } 4832 4833 virtual unsigned int offset889(int) { 4834 return offset = 889; 4835 } 4836 4837 virtual unsigned int offset890(int) { 4838 return offset = 890; 4839 } 4840 4841 virtual unsigned int offset891(int) { 4842 return offset = 891; 4843 } 4844 4845 virtual unsigned int offset892(int) { 4846 return offset = 892; 4847 } 4848 4849 virtual unsigned int offset893(int) { 4850 return offset = 893; 4851 } 4852 4853 virtual unsigned int offset894(int) { 4854 return offset = 894; 4855 } 4856 4857 virtual unsigned int offset895(int) { 4858 return offset = 895; 4859 } 4860 4861 virtual unsigned int offset896(int) { 4862 return offset = 896; 4863 } 4864 4865 virtual unsigned int offset897(int) { 4866 return offset = 897; 4867 } 4868 4869 virtual unsigned int offset898(int) { 4870 return offset = 898; 4871 } 4872 4873 virtual unsigned int offset899(int) { 4874 return offset = 899; 4875 } 4876 4877 4878 virtual unsigned int offset900(int) { 4879 return offset = 900; 4880 } 4881 4882 virtual unsigned int offset901(int) { 4883 return offset = 901; 4884 } 4885 4886 virtual unsigned int offset902(int) { 4887 return offset = 902; 4888 } 4889 4890 virtual unsigned int offset903(int) { 4891 return offset = 903; 4892 } 4893 4894 virtual unsigned int offset904(int) { 4895 return offset = 904; 4896 } 4897 4898 virtual unsigned int offset905(int) { 4899 return offset = 905; 4900 } 4901 4902 virtual unsigned int offset906(int) { 4903 return offset = 906; 4904 } 4905 4906 virtual unsigned int offset907(int) { 4907 return offset = 907; 4908 } 4909 4910 virtual unsigned int offset908(int) { 4911 return offset = 908; 4912 } 4913 4914 virtual unsigned int offset909(int) { 4915 return offset = 909; 4916 } 4917 4918 virtual unsigned int offset910(int) { 4919 return offset = 910; 4920 } 4921 4922 virtual unsigned int offset911(int) { 4923 return offset = 911; 4924 } 4925 4926 virtual unsigned int offset912(int) { 4927 return offset = 912; 4928 } 4929 4930 virtual unsigned int offset913(int) { 4931 return offset = 913; 4932 } 4933 4934 virtual unsigned int offset914(int) { 4935 return offset = 914; 4936 } 4937 4938 virtual unsigned int offset915(int) { 4939 return offset = 915; 4940 } 4941 4942 virtual unsigned int offset916(int) { 4943 return offset = 916; 4944 } 4945 4946 virtual unsigned int offset917(int) { 4947 return offset = 917; 4948 } 4949 4950 virtual unsigned int offset918(int) { 4951 return offset = 918; 4952 } 4953 4954 virtual unsigned int offset919(int) { 4955 return offset = 919; 4956 } 4957 4958 virtual unsigned int offset920(int) { 4959 return offset = 920; 4960 } 4961 4962 virtual unsigned int offset921(int) { 4963 return offset = 921; 4964 } 4965 4966 virtual unsigned int offset922(int) { 4967 return offset = 922; 4968 } 4969 4970 virtual unsigned int offset923(int) { 4971 return offset = 923; 4972 } 4973 4974 virtual unsigned int offset924(int) { 4975 return offset = 924; 4976 } 4977 4978 virtual unsigned int offset925(int) { 4979 return offset = 925; 4980 } 4981 4982 virtual unsigned int offset926(int) { 4983 return offset = 926; 4984 } 4985 4986 virtual unsigned int offset927(int) { 4987 return offset = 927; 4988 } 4989 4990 virtual unsigned int offset928(int) { 4991 return offset = 928; 4992 } 4993 4994 virtual unsigned int offset929(int) { 4995 return offset = 929; 4996 } 4997 4998 virtual unsigned int offset930(int) { 4999 return offset = 930; 5000 } 5001 5002 virtual unsigned int offset931(int) { 5003 return offset = 931; 5004 } 5005 5006 virtual unsigned int offset932(int) { 5007 return offset = 932; 5008 } 5009 5010 virtual unsigned int offset933(int) { 5011 return offset = 933; 5012 } 5013 5014 virtual unsigned int offset934(int) { 5015 return offset = 934; 5016 } 5017 5018 virtual unsigned int offset935(int) { 5019 return offset = 935; 5020 } 5021 5022 virtual unsigned int offset936(int) { 5023 return offset = 936; 5024 } 5025 5026 virtual unsigned int offset937(int) { 5027 return offset = 937; 5028 } 5029 5030 virtual unsigned int offset938(int) { 5031 return offset = 938; 5032 } 5033 5034 virtual unsigned int offset939(int) { 5035 return offset = 939; 5036 } 5037 5038 virtual unsigned int offset940(int) { 5039 return offset = 940; 5040 } 5041 5042 virtual unsigned int offset941(int) { 5043 return offset = 941; 5044 } 5045 5046 virtual unsigned int offset942(int) { 5047 return offset = 942; 5048 } 5049 5050 virtual unsigned int offset943(int) { 5051 return offset = 943; 5052 } 5053 5054 virtual unsigned int offset944(int) { 5055 return offset = 944; 5056 } 5057 5058 virtual unsigned int offset945(int) { 5059 return offset = 945; 5060 } 5061 5062 virtual unsigned int offset946(int) { 5063 return offset = 946; 5064 } 5065 5066 virtual unsigned int offset947(int) { 5067 return offset = 947; 5068 } 5069 5070 virtual unsigned int offset948(int) { 5071 return offset = 948; 5072 } 5073 5074 virtual unsigned int offset949(int) { 5075 return offset = 949; 5076 } 5077 5078 virtual unsigned int offset950(int) { 5079 return offset = 950; 5080 } 5081 5082 virtual unsigned int offset951(int) { 5083 return offset = 951; 5084 } 5085 5086 virtual unsigned int offset952(int) { 5087 return offset = 952; 5088 } 5089 5090 virtual unsigned int offset953(int) { 5091 return offset = 953; 5092 } 5093 5094 virtual unsigned int offset954(int) { 5095 return offset = 954; 5096 } 5097 5098 virtual unsigned int offset955(int) { 5099 return offset = 955; 5100 } 5101 5102 virtual unsigned int offset956(int) { 5103 return offset = 956; 5104 } 5105 5106 virtual unsigned int offset957(int) { 5107 return offset = 957; 5108 } 5109 5110 virtual unsigned int offset958(int) { 5111 return offset = 958; 5112 } 5113 5114 virtual unsigned int offset959(int) { 5115 return offset = 959; 5116 } 5117 5118 virtual unsigned int offset960(int) { 5119 return offset = 960; 5120 } 5121 5122 virtual unsigned int offset961(int) { 5123 return offset = 961; 5124 } 5125 5126 virtual unsigned int offset962(int) { 5127 return offset = 962; 5128 } 5129 5130 virtual unsigned int offset963(int) { 5131 return offset = 963; 5132 } 5133 5134 virtual unsigned int offset964(int) { 5135 return offset = 964; 5136 } 5137 5138 virtual unsigned int offset965(int) { 5139 return offset = 965; 5140 } 5141 5142 virtual unsigned int offset966(int) { 5143 return offset = 966; 5144 } 5145 5146 virtual unsigned int offset967(int) { 5147 return offset = 967; 5148 } 5149 5150 virtual unsigned int offset968(int) { 5151 return offset = 968; 5152 } 5153 5154 virtual unsigned int offset969(int) { 5155 return offset = 969; 5156 } 5157 5158 virtual unsigned int offset970(int) { 5159 return offset = 970; 5160 } 5161 5162 virtual unsigned int offset971(int) { 5163 return offset = 971; 5164 } 5165 5166 virtual unsigned int offset972(int) { 5167 return offset = 972; 5168 } 5169 5170 virtual unsigned int offset973(int) { 5171 return offset = 973; 5172 } 5173 5174 virtual unsigned int offset974(int) { 5175 return offset = 974; 5176 } 5177 5178 virtual unsigned int offset975(int) { 5179 return offset = 975; 5180 } 5181 5182 virtual unsigned int offset976(int) { 5183 return offset = 976; 5184 } 5185 5186 virtual unsigned int offset977(int) { 5187 return offset = 977; 5188 } 5189 5190 virtual unsigned int offset978(int) { 5191 return offset = 978; 5192 } 5193 5194 virtual unsigned int offset979(int) { 5195 return offset = 979; 5196 } 5197 5198 virtual unsigned int offset980(int) { 5199 return offset = 980; 5200 } 5201 5202 virtual unsigned int offset981(int) { 5203 return offset = 981; 5204 } 5205 5206 virtual unsigned int offset982(int) { 5207 return offset = 982; 5208 } 5209 5210 virtual unsigned int offset983(int) { 5211 return offset = 983; 5212 } 5213 5214 virtual unsigned int offset984(int) { 5215 return offset = 984; 5216 } 5217 5218 virtual unsigned int offset985(int) { 5219 return offset = 985; 5220 } 5221 5222 virtual unsigned int offset986(int) { 5223 return offset = 986; 5224 } 5225 5226 virtual unsigned int offset987(int) { 5227 return offset = 987; 5228 } 5229 5230 virtual unsigned int offset988(int) { 5231 return offset = 988; 5232 } 5233 5234 virtual unsigned int offset989(int) { 5235 return offset = 989; 5236 } 5237 5238 virtual unsigned int offset990(int) { 5239 return offset = 990; 5240 } 5241 5242 virtual unsigned int offset991(int) { 5243 return offset = 991; 5244 } 5245 5246 virtual unsigned int offset992(int) { 5247 return offset = 992; 5248 } 5249 5250 virtual unsigned int offset993(int) { 5251 return offset = 993; 5252 } 5253 5254 virtual unsigned int offset994(int) { 5255 return offset = 994; 5256 } 5257 5258 virtual unsigned int offset995(int) { 5259 return offset = 995; 5260 } 5261 5262 virtual unsigned int offset996(int) { 5263 return offset = 996; 5264 } 5265 5266 virtual unsigned int offset997(int) { 5267 return offset = 997; 5268 } 5269 5270 virtual unsigned int offset998(int) { 5271 return offset = 998; 5272 } 5273 5274 virtual unsigned int offset999(int) { 5275 return offset = 999; 5276 } 5277 5278 virtual unsigned int offset1000(int) { 5279 return offset = 1000; 5280 } 5281 5282 }; 5283 } 5284 #if defined(__GNUG__) && !defined(__clang__) 5285 #define FAKEIT_NO_DEVIRTUALIZE_ATTR [[gnu::optimize("no-devirtualize")]] 5286 #else 5287 #define FAKEIT_NO_DEVIRTUALIZE_ATTR 5288 #endif 5289 5290 namespace fakeit { 5291 5292 template<typename TARGET, typename SOURCE> 5293 FAKEIT_NO_DEVIRTUALIZE_ATTR 5294 TARGET union_cast(SOURCE source) { 5295 5296 union { 5297 SOURCE source; 5298 TARGET target; 5299 } u; 5300 u.source = source; 5301 return u.target; 5302 } 5303 5304 } 5305 5306 namespace fakeit { 5307 class NoVirtualDtor : public std::runtime_error { 5308 public: 5309 NoVirtualDtor() :std::runtime_error("Can't mock the destructor. No virtual destructor was found") {} 5310 }; 5311 5312 class VTUtils { 5313 public: 5314 5315 #if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 8 5316 #pragma GCC diagnostic push 5317 #pragma GCC diagnostic ignored "-Wcast-function-type" 5318 #endif 5319 template<typename C, typename R, typename ... arglist> 5320 static unsigned int getOffset(R (C::*vMethod)(arglist...)) { 5321 auto sMethod = reinterpret_cast<unsigned int (VirtualOffsetSelector::*)(int)>(vMethod); 5322 VirtualOffsetSelector offsetSelctor; 5323 return (offsetSelctor.*sMethod)(0); 5324 } 5325 #if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 8 5326 #pragma GCC diagnostic pop 5327 #endif 5328 5329 template<typename C> 5330 static typename std::enable_if<std::has_virtual_destructor<C>::value, unsigned int>::type 5331 getDestructorOffset() { 5332 VirtualOffsetSelector offsetSelctor; 5333 union_cast<C *>(&offsetSelctor)->~C(); 5334 return offsetSelctor.offset; 5335 } 5336 5337 template<typename C> 5338 static typename std::enable_if<!std::has_virtual_destructor<C>::value, unsigned int>::type 5339 getDestructorOffset() { 5340 throw NoVirtualDtor(); 5341 } 5342 5343 template<typename C> 5344 static typename std::enable_if<std::has_virtual_destructor<C>::value, bool>::type 5345 hasVirtualDestructor() { 5346 return true; 5347 } 5348 5349 template<typename C> 5350 static typename std::enable_if<!std::has_virtual_destructor<C>::value, bool>::type 5351 hasVirtualDestructor() { 5352 return false; 5353 } 5354 5355 template<typename C> 5356 static unsigned int getVTSize() { 5357 struct Derrived : public C { 5358 virtual void endOfVt() { 5359 } 5360 }; 5361 5362 unsigned int vtSize = getOffset(&Derrived::endOfVt); 5363 return vtSize; 5364 } 5365 }; 5366 5367 5368 } 5369 #ifdef _MSC_VER 5370 namespace fakeit { 5371 5372 typedef unsigned long dword_; 5373 5374 struct TypeDescriptor { 5375 TypeDescriptor() : 5376 ptrToVTable(0), spare(0) { 5377 5378 int **tiVFTPtr = (int **) (&typeid(void)); 5379 int *i = (int *) tiVFTPtr[0]; 5380 char *type_info_vft_ptr = (char *) i; 5381 ptrToVTable = type_info_vft_ptr; 5382 } 5383 5384 char *ptrToVTable; 5385 dword_ spare; 5386 char name[8]; 5387 }; 5388 5389 struct PMD { 5390 5391 5392 5393 int mdisp; 5394 5395 int pdisp; 5396 int vdisp; 5397 5398 PMD() : 5399 mdisp(0), pdisp(-1), vdisp(0) { 5400 } 5401 }; 5402 5403 struct RTTIBaseClassDescriptor { 5404 RTTIBaseClassDescriptor() : 5405 pTypeDescriptor(nullptr), numContainedBases(0), attributes(0) { 5406 } 5407 5408 const std::type_info *pTypeDescriptor; 5409 dword_ numContainedBases; 5410 struct PMD where; 5411 dword_ attributes; 5412 }; 5413 5414 template<typename C, typename... baseclasses> 5415 struct RTTIClassHierarchyDescriptor { 5416 RTTIClassHierarchyDescriptor() : 5417 signature(0), 5418 attributes(0), 5419 numBaseClasses(0), 5420 pBaseClassArray(nullptr) { 5421 pBaseClassArray = new RTTIBaseClassDescriptor *[1 + sizeof...(baseclasses)]; 5422 addBaseClass < C, baseclasses...>(); 5423 } 5424 5425 ~RTTIClassHierarchyDescriptor() { 5426 for (int i = 0; i < 1 + sizeof...(baseclasses); i++) { 5427 RTTIBaseClassDescriptor *desc = pBaseClassArray[i]; 5428 delete desc; 5429 } 5430 delete[] pBaseClassArray; 5431 } 5432 5433 dword_ signature; 5434 dword_ attributes; 5435 dword_ numBaseClasses; 5436 RTTIBaseClassDescriptor **pBaseClassArray; 5437 5438 template<typename BaseType> 5439 void addBaseClass() { 5440 static_assert(std::is_base_of<BaseType, C>::value, "C must be a derived class of BaseType"); 5441 RTTIBaseClassDescriptor *desc = new RTTIBaseClassDescriptor(); 5442 desc->pTypeDescriptor = &typeid(BaseType); 5443 pBaseClassArray[numBaseClasses] = desc; 5444 for (unsigned int i = 0; i < numBaseClasses; i++) { 5445 pBaseClassArray[i]->numContainedBases++; 5446 } 5447 numBaseClasses++; 5448 } 5449 5450 template<typename head, typename B1, typename... tail> 5451 void addBaseClass() { 5452 static_assert(std::is_base_of<B1, head>::value, "invalid inheritance list"); 5453 addBaseClass<head>(); 5454 addBaseClass<B1, tail...>(); 5455 } 5456 5457 }; 5458 5459 template<typename C, typename... baseclasses> 5460 struct RTTICompleteObjectLocator { 5461 #ifdef _WIN64 5462 RTTICompleteObjectLocator(const std::type_info &unused) : 5463 signature(0), offset(0), cdOffset(0), 5464 typeDescriptorOffset(0), classDescriptorOffset(0) 5465 { 5466 (void)unused; 5467 } 5468 5469 dword_ signature; 5470 dword_ offset; 5471 dword_ cdOffset; 5472 dword_ typeDescriptorOffset; 5473 dword_ classDescriptorOffset; 5474 #else 5475 RTTICompleteObjectLocator(const std::type_info &info) : 5476 signature(0), offset(0), cdOffset(0), 5477 pTypeDescriptor(&info), 5478 pClassDescriptor(new RTTIClassHierarchyDescriptor<C, baseclasses...>()) { 5479 } 5480 5481 ~RTTICompleteObjectLocator() { 5482 delete pClassDescriptor; 5483 } 5484 5485 dword_ signature; 5486 dword_ offset; 5487 dword_ cdOffset; 5488 const std::type_info *pTypeDescriptor; 5489 struct RTTIClassHierarchyDescriptor<C, baseclasses...> *pClassDescriptor; 5490 #endif 5491 }; 5492 5493 5494 struct VirtualTableBase { 5495 5496 static VirtualTableBase &getVTable(void *instance) { 5497 fakeit::VirtualTableBase *vt = (fakeit::VirtualTableBase *) (instance); 5498 return *vt; 5499 } 5500 5501 VirtualTableBase(void **firstMethod) : _firstMethod(firstMethod) { } 5502 5503 void *getCookie(int index) { 5504 return _firstMethod[-2 - index]; 5505 } 5506 5507 void setCookie(int index, void *value) { 5508 _firstMethod[-2 - index] = value; 5509 } 5510 5511 void *getMethod(unsigned int index) const { 5512 return _firstMethod[index]; 5513 } 5514 5515 void setMethod(unsigned int index, void *method) { 5516 _firstMethod[index] = method; 5517 } 5518 5519 protected: 5520 void **_firstMethod; 5521 }; 5522 5523 template<class C, class... baseclasses> 5524 struct VirtualTable : public VirtualTableBase { 5525 5526 class Handle { 5527 5528 friend struct VirtualTable<C, baseclasses...>; 5529 5530 void **firstMethod; 5531 5532 Handle(void **method) : firstMethod(method) { } 5533 5534 public: 5535 5536 VirtualTable<C, baseclasses...> &restore() { 5537 VirtualTable<C, baseclasses...> *vt = (VirtualTable<C, baseclasses...> *) this; 5538 return *vt; 5539 } 5540 }; 5541 5542 static VirtualTable<C, baseclasses...> &getVTable(C &instance) { 5543 fakeit::VirtualTable<C, baseclasses...> *vt = (fakeit::VirtualTable<C, baseclasses...> *) (&instance); 5544 return *vt; 5545 } 5546 5547 void copyFrom(VirtualTable<C, baseclasses...> &from) { 5548 unsigned int size = VTUtils::getVTSize<C>(); 5549 for (unsigned int i = 0; i < size; i++) { 5550 _firstMethod[i] = from.getMethod(i); 5551 } 5552 } 5553 5554 VirtualTable() : VirtualTable(buildVTArray()) { 5555 } 5556 5557 ~VirtualTable() { 5558 5559 } 5560 5561 void dispose() { 5562 _firstMethod--; 5563 RTTICompleteObjectLocator<C, baseclasses...> *locator = (RTTICompleteObjectLocator<C, baseclasses...> *) _firstMethod[0]; 5564 delete locator; 5565 _firstMethod -= numOfCookies; 5566 delete[] _firstMethod; 5567 } 5568 5569 5570 unsigned int dtor(int) { 5571 C *c = (C *) this; 5572 C &cRef = *c; 5573 auto vt = VirtualTable<C, baseclasses...>::getVTable(cRef); 5574 void *dtorPtr = vt.getCookie(numOfCookies - 1); 5575 void(*method)(C *) = reinterpret_cast<void (*)(C *)>(dtorPtr); 5576 method(c); 5577 return 0; 5578 } 5579 5580 void setDtor(void *method) { 5581 5582 5583 5584 5585 5586 void *dtorPtr = union_cast<void *>(&VirtualTable<C, baseclasses...>::dtor); 5587 unsigned int index = VTUtils::getDestructorOffset<C>(); 5588 _firstMethod[index] = dtorPtr; 5589 setCookie(numOfCookies - 1, method); 5590 } 5591 5592 unsigned int getSize() { 5593 return VTUtils::getVTSize<C>(); 5594 } 5595 5596 void initAll(void *value) { 5597 auto size = getSize(); 5598 for (unsigned int i = 0; i < size; i++) { 5599 setMethod(i, value); 5600 } 5601 } 5602 5603 Handle createHandle() { 5604 Handle h(_firstMethod); 5605 return h; 5606 } 5607 5608 private: 5609 5610 class SimpleType { 5611 }; 5612 5613 static_assert(sizeof(unsigned int (SimpleType::*)()) == sizeof(unsigned int (C::*)()), 5614 "Can't mock a type with multiple inheritance or with non-polymorphic base class"); 5615 static const unsigned int numOfCookies = 3; 5616 5617 static void **buildVTArray() { 5618 int vtSize = VTUtils::getVTSize<C>(); 5619 auto array = new void *[vtSize + numOfCookies + 1]{}; 5620 RTTICompleteObjectLocator<C, baseclasses...> *objectLocator = new RTTICompleteObjectLocator<C, baseclasses...>( 5621 typeid(C)); 5622 array += numOfCookies; 5623 array[0] = objectLocator; 5624 array++; 5625 return array; 5626 } 5627 5628 VirtualTable(void **firstMethod) : VirtualTableBase(firstMethod) { 5629 } 5630 }; 5631 } 5632 #else 5633 #ifndef __clang__ 5634 #include <type_traits> 5635 #include <tr2/type_traits> 5636 5637 namespace fakeit { 5638 template<typename ... T1> 5639 class has_one_base { 5640 }; 5641 5642 template<typename T1, typename T2, typename ... types> 5643 class has_one_base<std::tr2::__reflection_typelist<T1, T2, types...>> : public std::false_type { 5644 }; 5645 5646 template<typename T1> 5647 class has_one_base<std::tr2::__reflection_typelist<T1>> 5648 : public has_one_base<typename std::tr2::direct_bases<T1>::type> { 5649 }; 5650 5651 template<> 5652 class has_one_base<std::tr2::__reflection_typelist<>> : public std::true_type { 5653 }; 5654 5655 template<typename T> 5656 class is_simple_inheritance_layout : public has_one_base<typename std::tr2::direct_bases<T>::type> { 5657 }; 5658 } 5659 5660 #endif 5661 5662 namespace fakeit { 5663 5664 struct VirtualTableBase { 5665 5666 static VirtualTableBase &getVTable(void *instance) { 5667 fakeit::VirtualTableBase *vt = (fakeit::VirtualTableBase *) (instance); 5668 return *vt; 5669 } 5670 5671 VirtualTableBase(void **firstMethod) : _firstMethod(firstMethod) { } 5672 5673 void *getCookie(int index) { 5674 return _firstMethod[-3 - index]; 5675 } 5676 5677 void setCookie(int index, void *value) { 5678 _firstMethod[-3 - index] = value; 5679 } 5680 5681 void *getMethod(unsigned int index) const { 5682 return _firstMethod[index]; 5683 } 5684 5685 void setMethod(unsigned int index, void *method) { 5686 _firstMethod[index] = method; 5687 } 5688 5689 protected: 5690 void **_firstMethod; 5691 }; 5692 5693 template<class C, class ... baseclasses> 5694 struct VirtualTable : public VirtualTableBase { 5695 5696 #ifndef __clang__ 5697 static_assert(is_simple_inheritance_layout<C>::value, "Can't mock a type with multiple inheritance"); 5698 #endif 5699 5700 class Handle { 5701 5702 friend struct VirtualTable<C, baseclasses...>; 5703 void **firstMethod; 5704 5705 Handle(void **method) : 5706 firstMethod(method) { 5707 } 5708 5709 public: 5710 5711 VirtualTable<C, baseclasses...> &restore() { 5712 VirtualTable<C, baseclasses...> *vt = (VirtualTable<C, baseclasses...> *) this; 5713 return *vt; 5714 } 5715 }; 5716 5717 static VirtualTable<C, baseclasses...> &getVTable(C &instance) { 5718 fakeit::VirtualTable<C, baseclasses...> *vt = (fakeit::VirtualTable<C, baseclasses...> *) (&instance); 5719 return *vt; 5720 } 5721 5722 void copyFrom(VirtualTable<C, baseclasses...> &from) { 5723 unsigned int size = VTUtils::getVTSize<C>(); 5724 5725 for (size_t i = 0; i < size; ++i) { 5726 _firstMethod[i] = from.getMethod(i); 5727 } 5728 } 5729 5730 VirtualTable() : 5731 VirtualTable(buildVTArray()) { 5732 } 5733 5734 void dispose() { 5735 _firstMethod--; 5736 _firstMethod--; 5737 _firstMethod -= numOfCookies; 5738 delete[] _firstMethod; 5739 } 5740 5741 unsigned int dtor(int) { 5742 C *c = (C *) this; 5743 C &cRef = *c; 5744 auto vt = VirtualTable<C, baseclasses...>::getVTable(cRef); 5745 unsigned int index = VTUtils::getDestructorOffset<C>(); 5746 void *dtorPtr = vt.getMethod(index); 5747 void(*method)(C *) = union_cast<void (*)(C *)>(dtorPtr); 5748 method(c); 5749 return 0; 5750 } 5751 5752 5753 void setDtor(void *method) { 5754 unsigned int index = VTUtils::getDestructorOffset<C>(); 5755 void *dtorPtr = union_cast<void *>(&VirtualTable<C, baseclasses...>::dtor); 5756 5757 5758 _firstMethod[index] = method; 5759 5760 _firstMethod[index + 1] = dtorPtr; 5761 } 5762 5763 5764 unsigned int getSize() { 5765 return VTUtils::getVTSize<C>(); 5766 } 5767 5768 void initAll(void *value) { 5769 unsigned int size = getSize(); 5770 for (unsigned int i = 0; i < size; i++) { 5771 setMethod(i, value); 5772 } 5773 } 5774 5775 const std::type_info *getTypeId() { 5776 return (const std::type_info *) (_firstMethod[-1]); 5777 } 5778 5779 Handle createHandle() { 5780 Handle h(_firstMethod); 5781 return h; 5782 } 5783 5784 private: 5785 static const unsigned int numOfCookies = 2; 5786 5787 static void **buildVTArray() { 5788 int size = VTUtils::getVTSize<C>(); 5789 auto array = new void *[size + 2 + numOfCookies]{}; 5790 array += numOfCookies; 5791 array++; 5792 array[0] = const_cast<std::type_info *>(&typeid(C)); 5793 array++; 5794 return array; 5795 } 5796 5797 VirtualTable(void **firstMethod) : VirtualTableBase(firstMethod) { 5798 } 5799 5800 }; 5801 } 5802 #endif 5803 namespace fakeit { 5804 5805 struct NoMoreRecordedActionException { 5806 }; 5807 5808 template<typename R, typename ... arglist> 5809 struct MethodInvocationHandler : Destructible { 5810 virtual R handleMethodInvocation(const typename fakeit::production_arg<arglist>::type... args) = 0; 5811 }; 5812 5813 } 5814 #include <new> 5815 5816 5817 namespace fakeit 5818 { 5819 namespace details 5820 { 5821 template <int instanceAreaSize, typename C, typename... BaseClasses> 5822 class FakeObjectImpl 5823 { 5824 public: 5825 void initializeDataMembersArea() 5826 { 5827 for (size_t i = 0; i < instanceAreaSize; ++i) 5828 { 5829 instanceArea[i] = (char) 0; 5830 } 5831 } 5832 5833 protected: 5834 VirtualTable<C, BaseClasses...> vtable; 5835 char instanceArea[instanceAreaSize]; 5836 }; 5837 5838 template <typename C, typename... BaseClasses> 5839 class FakeObjectImpl<0, C, BaseClasses...> 5840 { 5841 public: 5842 void initializeDataMembersArea() 5843 {} 5844 5845 protected: 5846 VirtualTable<C, BaseClasses...> vtable; 5847 }; 5848 } 5849 5850 template <typename C, typename... BaseClasses> 5851 class FakeObject 5852 : public details::FakeObjectImpl<sizeof(C) - sizeof(VirtualTable<C, BaseClasses...>), C, BaseClasses...> 5853 { 5854 FakeObject(FakeObject const&) = delete; 5855 FakeObject& operator=(FakeObject const&) = delete; 5856 5857 public: 5858 FakeObject() 5859 { 5860 this->initializeDataMembersArea(); 5861 } 5862 5863 ~FakeObject() 5864 { 5865 this->vtable.dispose(); 5866 } 5867 5868 void setMethod(unsigned int index, void* method) 5869 { 5870 this->vtable.setMethod(index, method); 5871 } 5872 5873 VirtualTable<C, BaseClasses...>& getVirtualTable() 5874 { 5875 return this->vtable; 5876 } 5877 5878 void setVirtualTable(VirtualTable<C, BaseClasses...>& t) 5879 { 5880 this->vtable = t; 5881 } 5882 5883 void setDtor(void* dtor) 5884 { 5885 this->vtable.setDtor(dtor); 5886 } 5887 }; 5888 } 5889 namespace fakeit { 5890 5891 struct MethodProxy { 5892 5893 MethodProxy(unsigned int id, unsigned int offset, void *vMethod) : 5894 _id(id), 5895 _offset(offset), 5896 _vMethod(vMethod) { 5897 } 5898 5899 unsigned int getOffset() const { 5900 return _offset; 5901 } 5902 5903 unsigned int getId() const { 5904 return _id; 5905 } 5906 5907 void *getProxy() const { 5908 return union_cast<void *>(_vMethod); 5909 } 5910 5911 private: 5912 unsigned int _id; 5913 unsigned int _offset; 5914 void *_vMethod; 5915 }; 5916 } 5917 #include <utility> 5918 5919 5920 namespace fakeit { 5921 5922 struct InvocationHandlerCollection { 5923 static const unsigned int VT_COOKIE_INDEX = 0; 5924 5925 virtual Destructible *getInvocatoinHandlerPtrById(unsigned int index) = 0; 5926 5927 static InvocationHandlerCollection *getInvocationHandlerCollection(void *instance) { 5928 VirtualTableBase &vt = VirtualTableBase::getVTable(instance); 5929 InvocationHandlerCollection *invocationHandlerCollection = (InvocationHandlerCollection *) vt.getCookie( 5930 InvocationHandlerCollection::VT_COOKIE_INDEX); 5931 return invocationHandlerCollection; 5932 } 5933 }; 5934 5935 5936 template<typename R, typename ... arglist> 5937 class MethodProxyCreator { 5938 5939 5940 5941 public: 5942 5943 template<unsigned int id> 5944 MethodProxy createMethodProxy(unsigned int offset) { 5945 return MethodProxy(id, offset, union_cast<void *>(&MethodProxyCreator::methodProxyX < id > )); 5946 } 5947 5948 protected: 5949 5950 R methodProxy(unsigned int id, const typename fakeit::production_arg<arglist>::type... args) { 5951 InvocationHandlerCollection *invocationHandlerCollection = InvocationHandlerCollection::getInvocationHandlerCollection( 5952 this); 5953 MethodInvocationHandler<R, arglist...> *invocationHandler = 5954 (MethodInvocationHandler<R, arglist...> *) invocationHandlerCollection->getInvocatoinHandlerPtrById( 5955 id); 5956 return invocationHandler->handleMethodInvocation(std::forward<const typename fakeit::production_arg<arglist>::type>(args)...); 5957 } 5958 5959 template<int id> 5960 R methodProxyX(arglist ... args) { 5961 return methodProxy(id, std::forward<const typename fakeit::production_arg<arglist>::type>(args)...); 5962 } 5963 }; 5964 } 5965 5966 namespace fakeit { 5967 5968 class InvocationHandlers : public InvocationHandlerCollection { 5969 std::vector<std::shared_ptr<Destructible>> &_methodMocks; 5970 std::vector<unsigned int> &_offsets; 5971 5972 unsigned int getOffset(unsigned int id) const 5973 { 5974 unsigned int offset = 0; 5975 for (; offset < _offsets.size(); offset++) { 5976 if (_offsets[offset] == id) { 5977 break; 5978 } 5979 } 5980 return offset; 5981 } 5982 5983 public: 5984 InvocationHandlers( 5985 std::vector<std::shared_ptr<Destructible>> &methodMocks, 5986 std::vector<unsigned int> &offsets) : 5987 _methodMocks(methodMocks), _offsets(offsets) { 5988 for (std::vector<unsigned int>::iterator it = _offsets.begin(); it != _offsets.end(); ++it) 5989 { 5990 *it = std::numeric_limits<int>::max(); 5991 } 5992 } 5993 5994 Destructible *getInvocatoinHandlerPtrById(unsigned int id) override { 5995 unsigned int offset = getOffset(id); 5996 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 5997 return ptr.get(); 5998 } 5999 6000 }; 6001 6002 template<typename C, typename ... baseclasses> 6003 struct DynamicProxy { 6004 6005 static_assert(std::is_polymorphic<C>::value, "DynamicProxy requires a polymorphic type"); 6006 6007 DynamicProxy(C &inst) : 6008 instance(inst), 6009 originalVtHandle(VirtualTable<C, baseclasses...>::getVTable(instance).createHandle()), 6010 _methodMocks(VTUtils::getVTSize<C>()), 6011 _offsets(VTUtils::getVTSize<C>()), 6012 _invocationHandlers(_methodMocks, _offsets) { 6013 _cloneVt.copyFrom(originalVtHandle.restore()); 6014 _cloneVt.setCookie(InvocationHandlerCollection::VT_COOKIE_INDEX, &_invocationHandlers); 6015 getFake().setVirtualTable(_cloneVt); 6016 } 6017 6018 void detach() { 6019 getFake().setVirtualTable(originalVtHandle.restore()); 6020 } 6021 6022 ~DynamicProxy() { 6023 _cloneVt.dispose(); 6024 } 6025 6026 C &get() { 6027 return instance; 6028 } 6029 6030 void Reset() { 6031 _methodMocks = {}; 6032 _methodMocks.resize(VTUtils::getVTSize<C>()); 6033 _members = {}; 6034 _offsets = {}; 6035 _offsets.resize(VTUtils::getVTSize<C>()); 6036 _cloneVt.copyFrom(originalVtHandle.restore()); 6037 } 6038 6039 void Clear() 6040 { 6041 } 6042 6043 template<int id, typename R, typename ... arglist> 6044 void stubMethod(R(C::*vMethod)(arglist...), MethodInvocationHandler<R, arglist...> *methodInvocationHandler) { 6045 auto offset = VTUtils::getOffset(vMethod); 6046 MethodProxyCreator<R, arglist...> creator; 6047 bind(creator.template createMethodProxy<id + 1>(offset), methodInvocationHandler); 6048 } 6049 6050 void stubDtor(MethodInvocationHandler<void> *methodInvocationHandler) { 6051 auto offset = VTUtils::getDestructorOffset<C>(); 6052 MethodProxyCreator<void> creator; 6053 bindDtor(creator.createMethodProxy<0>(offset), methodInvocationHandler); 6054 } 6055 6056 template<typename R, typename ... arglist> 6057 bool isMethodStubbed(R(C::*vMethod)(arglist...)) { 6058 unsigned int offset = VTUtils::getOffset(vMethod); 6059 return isBinded(offset); 6060 } 6061 6062 bool isDtorStubbed() { 6063 unsigned int offset = VTUtils::getDestructorOffset<C>(); 6064 return isBinded(offset); 6065 } 6066 6067 template<typename R, typename ... arglist> 6068 Destructible *getMethodMock(R(C::*vMethod)(arglist...)) { 6069 auto offset = VTUtils::getOffset(vMethod); 6070 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6071 return ptr.get(); 6072 } 6073 6074 Destructible *getDtorMock() { 6075 auto offset = VTUtils::getDestructorOffset<C>(); 6076 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6077 return ptr.get(); 6078 } 6079 6080 template<typename DATA_TYPE, typename ... arglist> 6081 void stubDataMember(DATA_TYPE C::*member, const arglist &... initargs) { 6082 DATA_TYPE C::*theMember = (DATA_TYPE C::*) member; 6083 C &mock = get(); 6084 DATA_TYPE *memberPtr = &(mock.*theMember); 6085 _members.push_back( 6086 std::shared_ptr<DataMemeberWrapper < DATA_TYPE, arglist...> > 6087 {new DataMemeberWrapper < DATA_TYPE, arglist...>(memberPtr, 6088 initargs...)}); 6089 } 6090 6091 template<typename DATA_TYPE> 6092 void getMethodMocks(std::vector<DATA_TYPE> &into) const { 6093 for (std::shared_ptr<Destructible> ptr : _methodMocks) { 6094 DATA_TYPE p = dynamic_cast<DATA_TYPE>(ptr.get()); 6095 if (p) { 6096 into.push_back(p); 6097 } 6098 } 6099 } 6100 6101 VirtualTable<C, baseclasses...> &getOriginalVT() { 6102 VirtualTable<C, baseclasses...> &vt = originalVtHandle.restore(); 6103 return vt; 6104 } 6105 6106 private: 6107 6108 template<typename DATA_TYPE, typename ... arglist> 6109 class DataMemeberWrapper : public Destructible { 6110 private: 6111 DATA_TYPE *dataMember; 6112 public: 6113 DataMemeberWrapper(DATA_TYPE *dataMem, const arglist &... initargs) : 6114 dataMember(dataMem) { 6115 new(dataMember) DATA_TYPE{initargs ...}; 6116 } 6117 6118 ~DataMemeberWrapper() override 6119 { 6120 dataMember->~DATA_TYPE(); 6121 } 6122 }; 6123 6124 static_assert(sizeof(C) == sizeof(FakeObject<C, baseclasses...>), "This is a problem"); 6125 6126 C &instance; 6127 typename VirtualTable<C, baseclasses...>::Handle originalVtHandle; 6128 VirtualTable<C, baseclasses...> _cloneVt; 6129 6130 std::vector<std::shared_ptr<Destructible>> _methodMocks; 6131 std::vector<std::shared_ptr<Destructible>> _members; 6132 std::vector<unsigned int> _offsets; 6133 InvocationHandlers _invocationHandlers; 6134 6135 FakeObject<C, baseclasses...> &getFake() { 6136 return reinterpret_cast<FakeObject<C, baseclasses...> &>(instance); 6137 } 6138 6139 void bind(const MethodProxy &methodProxy, Destructible *invocationHandler) { 6140 getFake().setMethod(methodProxy.getOffset(), methodProxy.getProxy()); 6141 _methodMocks[methodProxy.getOffset()].reset(invocationHandler); 6142 _offsets[methodProxy.getOffset()] = methodProxy.getId(); 6143 } 6144 6145 void bindDtor(const MethodProxy &methodProxy, Destructible *invocationHandler) { 6146 getFake().setDtor(methodProxy.getProxy()); 6147 _methodMocks[methodProxy.getOffset()].reset(invocationHandler); 6148 _offsets[methodProxy.getOffset()] = methodProxy.getId(); 6149 } 6150 6151 template<typename DATA_TYPE> 6152 DATA_TYPE getMethodMock(unsigned int offset) { 6153 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6154 return dynamic_cast<DATA_TYPE>(ptr.get()); 6155 } 6156 6157 template<typename BaseClass> 6158 void checkMultipleInheritance() { 6159 C *ptr = (C *) (unsigned int) 1; 6160 BaseClass *basePtr = ptr; 6161 int delta = (unsigned long) basePtr - (unsigned long) ptr; 6162 if (delta > 0) { 6163 6164 6165 throw std::invalid_argument(std::string("multiple inheritance is not supported")); 6166 } 6167 } 6168 6169 bool isBinded(unsigned int offset) { 6170 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6171 return ptr.get() != nullptr; 6172 } 6173 6174 }; 6175 } 6176 #include <functional> 6177 #include <type_traits> 6178 #include <memory> 6179 #include <iosfwd> 6180 #include <vector> 6181 #include <functional> 6182 #include <tuple> 6183 #include <tuple> 6184 6185 namespace fakeit { 6186 6187 template<int N> 6188 struct apply_func { 6189 template<typename R, typename ... ArgsF, typename ... ArgsT, typename ... Args, typename FunctionType> 6190 static R applyTuple(FunctionType&& f, std::tuple<ArgsT...> &t, Args &... args) { 6191 return apply_func<N - 1>::template applyTuple<R>(std::forward<FunctionType>(f), t, std::get<N - 1>(t), args...); 6192 } 6193 }; 6194 6195 template<> 6196 struct apply_func < 0 > { 6197 template<typename R, typename ... ArgsF, typename ... ArgsT, typename ... Args, typename FunctionType> 6198 static R applyTuple(FunctionType&& f, std::tuple<ArgsT...> & , Args &... args) { 6199 return std::forward<FunctionType>(f)(args...); 6200 } 6201 }; 6202 6203 struct TupleDispatcher { 6204 6205 template<typename R, typename ... ArgsF, typename ... ArgsT, typename FunctionType> 6206 static R applyTuple(FunctionType&& f, std::tuple<ArgsT...> &t) { 6207 return apply_func<sizeof...(ArgsT)>::template applyTuple<R>(std::forward<FunctionType>(f), t); 6208 } 6209 6210 template<typename R, typename ...arglist, typename FunctionType> 6211 static R invoke(FunctionType&& func, const std::tuple<arglist...> &arguments) { 6212 std::tuple<arglist...> &args = const_cast<std::tuple<arglist...> &>(arguments); 6213 return applyTuple<R>(std::forward<FunctionType>(func), args); 6214 } 6215 6216 template<typename TupleType, typename FunctionType> 6217 static void for_each(TupleType &&, FunctionType &, 6218 std::integral_constant<size_t, std::tuple_size<typename std::remove_reference<TupleType>::type>::value>) { 6219 } 6220 6221 template<std::size_t I, typename TupleType, typename FunctionType, typename = typename std::enable_if< 6222 I != std::tuple_size<typename std::remove_reference<TupleType>::type>::value>::type> 6223 static void for_each(TupleType &&t, FunctionType &f, std::integral_constant<size_t, I>) { 6224 f(I, std::get < I >(t)); 6225 for_each(std::forward < TupleType >(t), f, std::integral_constant<size_t, I + 1>()); 6226 } 6227 6228 template<typename TupleType, typename FunctionType> 6229 static void for_each(TupleType &&t, FunctionType &f) { 6230 for_each(std::forward < TupleType >(t), f, std::integral_constant<size_t, 0>()); 6231 } 6232 6233 template<typename TupleType1, typename TupleType2, typename FunctionType> 6234 static void for_each(TupleType1 &&, TupleType2 &&, FunctionType &, 6235 std::integral_constant<size_t, std::tuple_size<typename std::remove_reference<TupleType1>::type>::value>) { 6236 } 6237 6238 template<std::size_t I, typename TupleType1, typename TupleType2, typename FunctionType, typename = typename std::enable_if< 6239 I != std::tuple_size<typename std::remove_reference<TupleType1>::type>::value>::type> 6240 static void for_each(TupleType1 &&t, TupleType2 &&t2, FunctionType &f, std::integral_constant<size_t, I>) { 6241 f(I, std::get < I >(t), std::get < I >(t2)); 6242 for_each(std::forward < TupleType1 >(t), std::forward < TupleType2 >(t2), f, std::integral_constant<size_t, I + 1>()); 6243 } 6244 6245 template<typename TupleType1, typename TupleType2, typename FunctionType> 6246 static void for_each(TupleType1 &&t, TupleType2 &&t2, FunctionType &f) { 6247 for_each(std::forward < TupleType1 >(t), std::forward < TupleType2 >(t2), f, std::integral_constant<size_t, 0>()); 6248 } 6249 }; 6250 } 6251 namespace fakeit { 6252 6253 template<typename R, typename ... arglist> 6254 struct ActualInvocationHandler : Destructible { 6255 virtual R handleMethodInvocation(ArgumentsTuple<arglist...> & args) = 0; 6256 }; 6257 6258 } 6259 #include <functional> 6260 #include <tuple> 6261 #include <string> 6262 #include <iosfwd> 6263 #include <type_traits> 6264 #include <typeinfo> 6265 6266 namespace fakeit { 6267 6268 struct DefaultValueInstatiationException { 6269 virtual ~DefaultValueInstatiationException() = default; 6270 6271 virtual std::string what() const = 0; 6272 }; 6273 6274 6275 template<class C> 6276 struct is_constructible_type { 6277 static const bool value = 6278 std::is_default_constructible<typename naked_type<C>::type>::value 6279 && !std::is_abstract<typename naked_type<C>::type>::value; 6280 }; 6281 6282 template<class C, class Enable = void> 6283 struct DefaultValue; 6284 6285 template<class C> 6286 struct DefaultValue<C, typename std::enable_if<!is_constructible_type<C>::value>::type> { 6287 static C &value() { 6288 if (std::is_reference<C>::value) { 6289 typename naked_type<C>::type *ptr = nullptr; 6290 return *ptr; 6291 } 6292 6293 class Exception : public DefaultValueInstatiationException { 6294 virtual std::string what() const 6295 6296 override { 6297 return (std::string("Type ") + std::string(typeid(C).name()) 6298 + std::string( 6299 " is not default constructible. Could not instantiate a default return value")).c_str(); 6300 } 6301 }; 6302 6303 throw Exception(); 6304 } 6305 }; 6306 6307 template<class C> 6308 struct DefaultValue<C, typename std::enable_if<is_constructible_type<C>::value>::type> { 6309 static C &value() { 6310 static typename naked_type<C>::type val{}; 6311 return val; 6312 } 6313 }; 6314 6315 6316 template<> 6317 struct DefaultValue<void> { 6318 static void value() { 6319 return; 6320 } 6321 }; 6322 6323 template<> 6324 struct DefaultValue<bool> { 6325 static bool &value() { 6326 static bool value{false}; 6327 return value; 6328 } 6329 }; 6330 6331 template<> 6332 struct DefaultValue<char> { 6333 static char &value() { 6334 static char value{0}; 6335 return value; 6336 } 6337 }; 6338 6339 template<> 6340 struct DefaultValue<char16_t> { 6341 static char16_t &value() { 6342 static char16_t value{0}; 6343 return value; 6344 } 6345 }; 6346 6347 template<> 6348 struct DefaultValue<char32_t> { 6349 static char32_t &value() { 6350 static char32_t value{0}; 6351 return value; 6352 } 6353 }; 6354 6355 template<> 6356 struct DefaultValue<wchar_t> { 6357 static wchar_t &value() { 6358 static wchar_t value{0}; 6359 return value; 6360 } 6361 }; 6362 6363 template<> 6364 struct DefaultValue<short> { 6365 static short &value() { 6366 static short value{0}; 6367 return value; 6368 } 6369 }; 6370 6371 template<> 6372 struct DefaultValue<int> { 6373 static int &value() { 6374 static int value{0}; 6375 return value; 6376 } 6377 }; 6378 6379 template<> 6380 struct DefaultValue<long> { 6381 static long &value() { 6382 static long value{0}; 6383 return value; 6384 } 6385 }; 6386 6387 template<> 6388 struct DefaultValue<long long> { 6389 static long long &value() { 6390 static long long value{0}; 6391 return value; 6392 } 6393 }; 6394 6395 template<> 6396 struct DefaultValue<std::string> { 6397 static std::string &value() { 6398 static std::string value{}; 6399 return value; 6400 } 6401 }; 6402 6403 } 6404 namespace fakeit { 6405 6406 struct IMatcher : Destructible { 6407 ~IMatcher() override = default; 6408 virtual std::string format() const = 0; 6409 }; 6410 6411 template<typename T> 6412 struct TypedMatcher : IMatcher { 6413 virtual bool matches(const T &actual) const = 0; 6414 }; 6415 6416 template<typename T> 6417 struct TypedMatcherCreator { 6418 6419 virtual ~TypedMatcherCreator() = default; 6420 6421 virtual TypedMatcher<T> *createMatcher() const = 0; 6422 }; 6423 6424 template<typename T> 6425 struct ComparisonMatcherCreator : public TypedMatcherCreator<T> { 6426 6427 virtual ~ComparisonMatcherCreator() = default; 6428 6429 ComparisonMatcherCreator(const T &arg) 6430 : _expected(arg) { 6431 } 6432 6433 struct Matcher : public TypedMatcher<T> { 6434 Matcher(const T &expected) 6435 : _expected(expected) { 6436 } 6437 6438 const T _expected; 6439 }; 6440 6441 const T &_expected; 6442 }; 6443 6444 namespace internal { 6445 template<typename T> 6446 struct TypedAnyMatcher : public TypedMatcherCreator<T> { 6447 6448 virtual ~TypedAnyMatcher() = default; 6449 6450 TypedAnyMatcher() { 6451 } 6452 6453 struct Matcher : public TypedMatcher<T> { 6454 virtual bool matches(const T &) const override { 6455 return true; 6456 } 6457 6458 virtual std::string format() const override { 6459 return "Any"; 6460 } 6461 }; 6462 6463 virtual TypedMatcher<T> *createMatcher() const override { 6464 return new Matcher(); 6465 } 6466 6467 }; 6468 6469 template<typename T> 6470 struct EqMatcherCreator : public ComparisonMatcherCreator<T> { 6471 6472 virtual ~EqMatcherCreator() = default; 6473 6474 EqMatcherCreator(const T &expected) 6475 : ComparisonMatcherCreator<T>(expected) { 6476 } 6477 6478 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { 6479 Matcher(const T &expected) 6480 : ComparisonMatcherCreator<T>::Matcher(expected) { 6481 } 6482 6483 virtual std::string format() const override { 6484 return TypeFormatter<T>::format(this->_expected); 6485 } 6486 6487 virtual bool matches(const T &actual) const override { 6488 return actual == this->_expected; 6489 } 6490 }; 6491 6492 virtual TypedMatcher<T> *createMatcher() const { 6493 return new Matcher(this->_expected); 6494 } 6495 6496 }; 6497 6498 template<typename T> 6499 struct GtMatcherCreator : public ComparisonMatcherCreator<T> { 6500 6501 virtual ~GtMatcherCreator() = default; 6502 6503 GtMatcherCreator(const T &expected) 6504 : ComparisonMatcherCreator<T>(expected) { 6505 } 6506 6507 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { 6508 Matcher(const T &expected) 6509 : ComparisonMatcherCreator<T>::Matcher(expected) { 6510 } 6511 6512 virtual bool matches(const T &actual) const override { 6513 return actual > this->_expected; 6514 } 6515 6516 virtual std::string format() const override { 6517 return std::string(">") + TypeFormatter<T>::format(this->_expected); 6518 } 6519 }; 6520 6521 virtual TypedMatcher<T> *createMatcher() const override { 6522 return new Matcher(this->_expected); 6523 } 6524 }; 6525 6526 template<typename T> 6527 struct GeMatcherCreator : public ComparisonMatcherCreator<T> { 6528 6529 virtual ~GeMatcherCreator() = default; 6530 6531 GeMatcherCreator(const T &expected) 6532 : ComparisonMatcherCreator<T>(expected) { 6533 } 6534 6535 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { 6536 Matcher(const T &expected) 6537 : ComparisonMatcherCreator<T>::Matcher(expected) { 6538 } 6539 6540 virtual bool matches(const T &actual) const override { 6541 return actual >= this->_expected; 6542 } 6543 6544 virtual std::string format() const override { 6545 return std::string(">=") + TypeFormatter<T>::format(this->_expected); 6546 } 6547 }; 6548 6549 virtual TypedMatcher<T> *createMatcher() const override { 6550 return new Matcher(this->_expected); 6551 } 6552 }; 6553 6554 template<typename T> 6555 struct LtMatcherCreator : public ComparisonMatcherCreator<T> { 6556 6557 virtual ~LtMatcherCreator() = default; 6558 6559 LtMatcherCreator(const T &expected) 6560 : ComparisonMatcherCreator<T>(expected) { 6561 } 6562 6563 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { 6564 Matcher(const T &expected) 6565 : ComparisonMatcherCreator<T>::Matcher(expected) { 6566 } 6567 6568 virtual bool matches(const T &actual) const override { 6569 return actual < this->_expected; 6570 } 6571 6572 virtual std::string format() const override { 6573 return std::string("<") + TypeFormatter<T>::format(this->_expected); 6574 } 6575 }; 6576 6577 virtual TypedMatcher<T> *createMatcher() const override { 6578 return new Matcher(this->_expected); 6579 } 6580 6581 }; 6582 6583 template<typename T> 6584 struct LeMatcherCreator : public ComparisonMatcherCreator<T> { 6585 6586 virtual ~LeMatcherCreator() = default; 6587 6588 LeMatcherCreator(const T &expected) 6589 : ComparisonMatcherCreator<T>(expected) { 6590 } 6591 6592 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { 6593 Matcher(const T &expected) 6594 : ComparisonMatcherCreator<T>::Matcher(expected) { 6595 } 6596 6597 virtual bool matches(const T &actual) const override { 6598 return actual <= this->_expected; 6599 } 6600 6601 virtual std::string format() const override { 6602 return std::string("<=") + TypeFormatter<T>::format(this->_expected); 6603 } 6604 }; 6605 6606 virtual TypedMatcher<T> *createMatcher() const override { 6607 return new Matcher(this->_expected); 6608 } 6609 6610 }; 6611 6612 template<typename T> 6613 struct NeMatcherCreator : public ComparisonMatcherCreator<T> { 6614 6615 virtual ~NeMatcherCreator() = default; 6616 6617 NeMatcherCreator(const T &expected) 6618 : ComparisonMatcherCreator<T>(expected) { 6619 } 6620 6621 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { 6622 Matcher(const T &expected) 6623 : ComparisonMatcherCreator<T>::Matcher(expected) { 6624 } 6625 6626 virtual bool matches(const T &actual) const override { 6627 return actual != this->_expected; 6628 } 6629 6630 virtual std::string format() const override { 6631 return std::string("!=") + TypeFormatter<T>::format(this->_expected); 6632 } 6633 6634 }; 6635 6636 virtual TypedMatcher<T> *createMatcher() const override { 6637 return new Matcher(this->_expected); 6638 } 6639 6640 }; 6641 } 6642 6643 struct AnyMatcher { 6644 } static _; 6645 6646 template<typename T> 6647 internal::TypedAnyMatcher<T> Any() { 6648 internal::TypedAnyMatcher<T> rv; 6649 return rv; 6650 } 6651 6652 template<typename T> 6653 internal::EqMatcherCreator<T> Eq(const T &arg) { 6654 internal::EqMatcherCreator<T> rv(arg); 6655 return rv; 6656 } 6657 6658 template<typename T> 6659 internal::GtMatcherCreator<T> Gt(const T &arg) { 6660 internal::GtMatcherCreator<T> rv(arg); 6661 return rv; 6662 } 6663 6664 template<typename T> 6665 internal::GeMatcherCreator<T> Ge(const T &arg) { 6666 internal::GeMatcherCreator<T> rv(arg); 6667 return rv; 6668 } 6669 6670 template<typename T> 6671 internal::LtMatcherCreator<T> Lt(const T &arg) { 6672 internal::LtMatcherCreator<T> rv(arg); 6673 return rv; 6674 } 6675 6676 template<typename T> 6677 internal::LeMatcherCreator<T> Le(const T &arg) { 6678 internal::LeMatcherCreator<T> rv(arg); 6679 return rv; 6680 } 6681 6682 template<typename T> 6683 internal::NeMatcherCreator<T> Ne(const T &arg) { 6684 internal::NeMatcherCreator<T> rv(arg); 6685 return rv; 6686 } 6687 6688 } 6689 6690 namespace fakeit { 6691 6692 template<typename ... arglist> 6693 struct ArgumentsMatcherInvocationMatcher : public ActualInvocation<arglist...>::Matcher { 6694 6695 virtual ~ArgumentsMatcherInvocationMatcher() { 6696 for (unsigned int i = 0; i < _matchers.size(); i++) 6697 delete _matchers[i]; 6698 } 6699 6700 ArgumentsMatcherInvocationMatcher(const std::vector<Destructible *> &args) 6701 : _matchers(args) { 6702 } 6703 6704 virtual bool matches(ActualInvocation<arglist...> &invocation) override { 6705 if (invocation.getActualMatcher() == this) 6706 return true; 6707 return matches(invocation.getActualArguments()); 6708 } 6709 6710 virtual std::string format() const override { 6711 std::ostringstream out; 6712 out << "("; 6713 for (unsigned int i = 0; i < _matchers.size(); i++) { 6714 if (i > 0) out << ", "; 6715 IMatcher *m = dynamic_cast<IMatcher *>(_matchers[i]); 6716 out << m->format(); 6717 } 6718 out << ")"; 6719 return out.str(); 6720 } 6721 6722 private: 6723 6724 struct MatchingLambda { 6725 MatchingLambda(const std::vector<Destructible *> &matchers) 6726 : _matchers(matchers) { 6727 } 6728 6729 template<typename A> 6730 void operator()(int index, A &actualArg) { 6731 TypedMatcher<typename naked_type<A>::type> *matcher = 6732 dynamic_cast<TypedMatcher<typename naked_type<A>::type> *>(_matchers[index]); 6733 if (_matching) 6734 _matching = matcher->matches(actualArg); 6735 } 6736 6737 bool isMatching() { 6738 return _matching; 6739 } 6740 6741 private: 6742 bool _matching = true; 6743 const std::vector<Destructible *> &_matchers; 6744 }; 6745 6746 virtual bool matches(ArgumentsTuple<arglist...>& actualArguments) { 6747 MatchingLambda l(_matchers); 6748 fakeit::TupleDispatcher::for_each(actualArguments, l); 6749 return l.isMatching(); 6750 } 6751 6752 const std::vector<Destructible *> _matchers; 6753 }; 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 template<typename ... arglist> 6787 struct UserDefinedInvocationMatcher : ActualInvocation<arglist...>::Matcher { 6788 virtual ~UserDefinedInvocationMatcher() = default; 6789 6790 UserDefinedInvocationMatcher(std::function<bool(arglist &...)> match) 6791 : matcher{match} { 6792 } 6793 6794 virtual bool matches(ActualInvocation<arglist...> &invocation) override { 6795 if (invocation.getActualMatcher() == this) 6796 return true; 6797 return matches(invocation.getActualArguments()); 6798 } 6799 6800 virtual std::string format() const override { 6801 return {"( user defined matcher )"}; 6802 } 6803 6804 private: 6805 virtual bool matches(ArgumentsTuple<arglist...>& actualArguments) { 6806 return TupleDispatcher::invoke<bool, typename tuple_arg<arglist>::type...>(matcher, actualArguments); 6807 } 6808 6809 const std::function<bool(arglist &...)> matcher; 6810 }; 6811 6812 template<typename ... arglist> 6813 struct DefaultInvocationMatcher : public ActualInvocation<arglist...>::Matcher { 6814 6815 ~DefaultInvocationMatcher() override = default; 6816 6817 DefaultInvocationMatcher() { 6818 } 6819 6820 virtual bool matches(ActualInvocation<arglist...> &invocation) override { 6821 return matches(invocation.getActualArguments()); 6822 } 6823 6824 virtual std::string format() const override { 6825 return {"( Any arguments )"}; 6826 } 6827 6828 private: 6829 6830 virtual bool matches(const ArgumentsTuple<arglist...>&) { 6831 return true; 6832 } 6833 }; 6834 6835 } 6836 6837 namespace fakeit { 6838 6839 6840 template<typename R, typename ... arglist> 6841 class RecordedMethodBody : public MethodInvocationHandler<R, arglist...>, public ActualInvocationsSource, public ActualInvocationsContainer { 6842 6843 struct MatchedInvocationHandler : ActualInvocationHandler<R, arglist...> { 6844 6845 ~MatchedInvocationHandler() override = default; 6846 6847 MatchedInvocationHandler(typename ActualInvocation<arglist...>::Matcher *matcher, 6848 ActualInvocationHandler<R, arglist...> *invocationHandler) : 6849 _matcher{matcher}, _invocationHandler{invocationHandler} { 6850 } 6851 6852 virtual R handleMethodInvocation(ArgumentsTuple<arglist...> & args) override 6853 { 6854 Destructible &destructable = *_invocationHandler; 6855 ActualInvocationHandler<R, arglist...> &invocationHandler = dynamic_cast<ActualInvocationHandler<R, arglist...> &>(destructable); 6856 return invocationHandler.handleMethodInvocation(args); 6857 } 6858 6859 typename ActualInvocation<arglist...>::Matcher &getMatcher() const { 6860 Destructible &destructable = *_matcher; 6861 typename ActualInvocation<arglist...>::Matcher &matcher = dynamic_cast<typename ActualInvocation<arglist...>::Matcher &>(destructable); 6862 return matcher; 6863 } 6864 6865 private: 6866 std::shared_ptr<Destructible> _matcher; 6867 std::shared_ptr<Destructible> _invocationHandler; 6868 }; 6869 6870 6871 FakeitContext &_fakeit; 6872 MethodInfo _method; 6873 6874 std::vector<std::shared_ptr<Destructible>> _invocationHandlers; 6875 std::vector<std::shared_ptr<Destructible>> _actualInvocations; 6876 6877 MatchedInvocationHandler *buildMatchedInvocationHandler( 6878 typename ActualInvocation<arglist...>::Matcher *invocationMatcher, 6879 ActualInvocationHandler<R, arglist...> *invocationHandler) { 6880 return new MatchedInvocationHandler(invocationMatcher, invocationHandler); 6881 } 6882 6883 MatchedInvocationHandler *getInvocationHandlerForActualArgs(ActualInvocation<arglist...> &invocation) { 6884 for (auto i = _invocationHandlers.rbegin(); i != _invocationHandlers.rend(); ++i) { 6885 std::shared_ptr<Destructible> curr = *i; 6886 Destructible &destructable = *curr; 6887 MatchedInvocationHandler &im = asMatchedInvocationHandler(destructable); 6888 if (im.getMatcher().matches(invocation)) { 6889 return &im; 6890 } 6891 } 6892 return nullptr; 6893 } 6894 6895 MatchedInvocationHandler &asMatchedInvocationHandler(Destructible &destructable) { 6896 MatchedInvocationHandler &im = dynamic_cast<MatchedInvocationHandler &>(destructable); 6897 return im; 6898 } 6899 6900 ActualInvocation<arglist...> &asActualInvocation(Destructible &destructable) const { 6901 ActualInvocation<arglist...> &invocation = dynamic_cast<ActualInvocation<arglist...> &>(destructable); 6902 return invocation; 6903 } 6904 6905 public: 6906 6907 RecordedMethodBody(FakeitContext &fakeit, std::string name) : 6908 _fakeit(fakeit), _method{MethodInfo::nextMethodOrdinal(), name} { } 6909 6910 ~RecordedMethodBody() NO_THROWS override {} 6911 6912 MethodInfo &getMethod() { 6913 return _method; 6914 } 6915 6916 bool isOfMethod(MethodInfo &method) { 6917 6918 return method.id() == _method.id(); 6919 } 6920 6921 void addMethodInvocationHandler(typename ActualInvocation<arglist...>::Matcher *matcher, 6922 ActualInvocationHandler<R, arglist...> *invocationHandler) { 6923 ActualInvocationHandler<R, arglist...> *mock = buildMatchedInvocationHandler(matcher, invocationHandler); 6924 std::shared_ptr<Destructible> destructable{mock}; 6925 _invocationHandlers.push_back(destructable); 6926 } 6927 6928 void reset() { 6929 _invocationHandlers.clear(); 6930 _actualInvocations.clear(); 6931 } 6932 6933 void clear() override { 6934 _actualInvocations.clear(); 6935 } 6936 6937 R handleMethodInvocation(const typename fakeit::production_arg<arglist>::type... args) override { 6938 unsigned int ordinal = Invocation::nextInvocationOrdinal(); 6939 MethodInfo &method = this->getMethod(); 6940 auto actualInvocation = new ActualInvocation<arglist...>(ordinal, method, std::forward<const typename fakeit::production_arg<arglist>::type>(args)...); 6941 6942 6943 std::shared_ptr<Destructible> actualInvocationDtor{actualInvocation}; 6944 6945 auto invocationHandler = getInvocationHandlerForActualArgs(*actualInvocation); 6946 if (invocationHandler) { 6947 auto &matcher = invocationHandler->getMatcher(); 6948 actualInvocation->setActualMatcher(&matcher); 6949 _actualInvocations.push_back(actualInvocationDtor); 6950 try { 6951 return invocationHandler->handleMethodInvocation(actualInvocation->getActualArguments()); 6952 } catch (NoMoreRecordedActionException &) { 6953 } 6954 } 6955 6956 UnexpectedMethodCallEvent event(UnexpectedType::Unmatched, *actualInvocation); 6957 _fakeit.handle(event); 6958 std::string format{_fakeit.format(event)}; 6959 UnexpectedMethodCallException e(format); 6960 throw e; 6961 } 6962 6963 void scanActualInvocations(const std::function<void(ActualInvocation<arglist...> &)> &scanner) { 6964 for (auto destructablePtr : _actualInvocations) { 6965 ActualInvocation<arglist...> &invocation = asActualInvocation(*destructablePtr); 6966 scanner(invocation); 6967 } 6968 } 6969 6970 void getActualInvocations(std::unordered_set<Invocation *> &into) const override { 6971 for (auto destructablePtr : _actualInvocations) { 6972 Invocation &invocation = asActualInvocation(*destructablePtr); 6973 into.insert(&invocation); 6974 } 6975 } 6976 6977 void setMethodDetails(const std::string &mockName, const std::string &methodName) { 6978 const std::string fullName{mockName + "." + methodName}; 6979 _method.setName(fullName); 6980 } 6981 6982 }; 6983 6984 } 6985 #include <functional> 6986 #include <type_traits> 6987 #include <stdexcept> 6988 #include <utility> 6989 #include <functional> 6990 #include <type_traits> 6991 6992 namespace fakeit { 6993 6994 struct Quantity { 6995 Quantity(const int q) : 6996 quantity(q) { 6997 } 6998 6999 const int quantity; 7000 } static Once(1); 7001 7002 template<typename R> 7003 struct Quantifier : public Quantity { 7004 Quantifier(const int q, const R &val) : 7005 Quantity(q), value(val) { 7006 } 7007 7008 const R &value; 7009 }; 7010 7011 template<> 7012 struct Quantifier<void> : public Quantity { 7013 explicit Quantifier(const int q) : 7014 Quantity(q) { 7015 } 7016 }; 7017 7018 struct QuantifierFunctor : public Quantifier<void> { 7019 QuantifierFunctor<