Lumiera  0.pre.03
»edit your freedom«
testasset.hpp
Go to the documentation of this file.
1 /*
2  TESTASSET.hpp - test asset (stub) for checking internal asset functionality
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
28 #ifndef ASSET_TESTASSET_H
29 #define ASSET_TESTASSET_H
30 
31 
32 #include "steam/asset.hpp"
33 #include "lib/format-string.hpp"
34 
35 
36 
37 namespace steam {
38 namespace asset{
39 namespace test {
40 
41  using util::_Fmt;
42 
43 
51  template<class A>
52  class TestAsset : public A
53  {
54  TestAsset () ;
55  TestAsset (PAsset&);
56 
57  static void deleter (TestAsset<A>* aa) { delete aa; }
58 
59  public:
60  using PA = lib::P<TestAsset<A>>;
61 
62  static PA create () { return (new TestAsset<A> )->ptrFromThis(); }
63  static PA create (PAsset& pRef) { return (new TestAsset<A> (pRef))->ptrFromThis(); }
64 
65  /* === interesting asset features we want to access for tests === */
66  void call_unlink () { this->unlink (); }
67  void call_unlink (IDA target) { this->unlink (target); }
68  void set_depend (PAsset parent) { this->defineDependency (parent); }
69 
70  private:
71  PA ptrFromThis ();
72  };
73 
74 
75 
76 }}} // namespace steam::asset::test
77 #endif
Definition: run.hpp:49
Front-end for printf-style string template interpolation.
Steam-Layer implementation namespace root.
A front-end for using printf-style formatting.
Steam-Layer Interface: Assets.
Test(mock) asset subclass usable for hijacking a given asset class (template parameter) and subsequen...
Definition: testasset.hpp:52
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:80
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:44