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)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
19 #ifndef ASSET_TESTASSET_H
20 #define ASSET_TESTASSET_H
21 
22 
23 #include "steam/asset.hpp"
24 #include "lib/format-string.hpp"
25 
26 
27 
28 namespace steam {
29 namespace asset{
30 namespace test {
31 
32  using util::_Fmt;
33 
34 
42  template<class A>
43  class TestAsset : public A
44  {
45  TestAsset () ;
46  TestAsset (PAsset&);
47 
48  static void deleter (TestAsset<A>* aa) { delete aa; }
49 
50  public:
51  using PA = lib::P<TestAsset<A>>;
52 
53  static PA create () { return (new TestAsset<A> )->ptrFromThis(); }
54  static PA create (PAsset& pRef) { return (new TestAsset<A> (pRef))->ptrFromThis(); }
55 
56  /* === interesting asset features we want to access for tests === */
57  void call_unlink () { this->unlink (); }
58  void call_unlink (IDA target) { this->unlink (target); }
59  void set_depend (PAsset parent) { this->defineDependency (parent); }
60 
61  private:
62  PA ptrFromThis ();
63  };
64 
65 
66 
67 }}} // namespace steam::asset::test
68 #endif
Definition: run.hpp:40
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:43
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35