]> Dogcows Code - chaz/yoink/blob - src/stlplus/strings/print_smart_ptr.tpp
build system enhancements
[chaz/yoink] / src / stlplus / strings / print_smart_ptr.tpp
1 ////////////////////////////////////////////////////////////////////////////////
2
3 // Author: Andy Rushton
4 // Copyright: (c) Southampton University 1999-2004
5 // (c) Andy Rushton 2004-2009
6 // License: BSD License, see ../docs/license.html
7
8 ////////////////////////////////////////////////////////////////////////////////
9
10 namespace stlplus
11 {
12
13 template<typename T, typename S>
14 void print_smart_ptr(std::ostream& device,
15 const smart_ptr<T>& value,
16 S print_fn,
17 const std::string& null_string,
18 const std::string& prefix,
19 const std::string& suffix)
20 {
21 if (value)
22 {
23 device << prefix;
24 print_fn(device, *value);
25 device << suffix;
26 }
27 else
28 {
29 device << null_string;
30 }
31 }
32
33 template<typename T, typename S>
34 void print_smart_ptr_clone(std::ostream& device,
35 const smart_ptr_clone<T>& value,
36 S print_fn,
37 const std::string& null_string,
38 const std::string& prefix,
39 const std::string& suffix)
40 {
41 if (value)
42 {
43 device << prefix;
44 print_fn(device, *value);
45 device << suffix;
46 }
47 else
48 {
49 device << null_string;
50 }
51 }
52
53 template<typename T, typename S>
54 void print_smart_ptr_nocopy(std::ostream& device,
55 const smart_ptr_nocopy<T>& value,
56 S print_fn,
57 const std::string& null_string,
58 const std::string& prefix,
59 const std::string& suffix)
60 {
61 if (value)
62 {
63 device << prefix;
64 print_fn(device, *value);
65 device << suffix;
66 }
67 else
68 {
69 device << null_string;
70 }
71 }
72
73 } // end namespace stlplus
74
This page took 0.037175 seconds and 4 git commands to generate.