1 
2 
3 
4 /* DEPRECATED! - use code/TinyFormatter.h instead.
5  *
6  *
7  * */
8 
9 #ifndef AI_BOOST_FORMAT_DUMMY_INCLUDED
10 #define AI_BOOST_FORMAT_DUMMY_INCLUDED
11 
12 #if (!defined BOOST_FORMAT_HPP) || (defined ASSIMP_FORCE_NOBOOST)
13 
14 #include <string>
15 #include <vector>
16 
17 namespace boost
18 {
19 
20 
21 	class format
22 	{
23 	public:
format(const std::string & _d)24 		format (const std::string& _d)
25 			: d(_d)
26 		{
27 		}
28 
29 		template <typename T>
operator %(T in)30 		format& operator % (T in)
31 		{
32 			// XXX add replacement for boost::lexical_cast?
33 
34 			std::ostringstream ss;
35 			ss << in; // note: ss cannot be an rvalue, or  the global operator << (const char*) is not called for T == const char*.
36 			chunks.push_back( ss.str());
37 			return *this;
38 		}
39 
40 
operator std::string() const41 		operator std::string () const {
42 			std::string res; // pray for NRVO to kick in
43 
44 			size_t start = 0, last = 0;
45 
46 			std::vector<std::string>::const_iterator chunkin = chunks.begin();
47 
48 			for ( start = d.find('%');start != std::string::npos;  start = d.find('%',last)) {
49 				res += d.substr(last,start-last);
50 				last = start+2;
51 				if (d[start+1] == '%') {
52 					res += "%";
53 					continue;
54 				}
55 
56 				if (chunkin == chunks.end()) {
57 					break;
58 				}
59 
60 				res += *chunkin++;
61 			}
62 			res += d.substr(last);
63 			return res;
64 		}
65 
66 	private:
67 		std::string d;
68 		std::vector<std::string> chunks;
69 	};
70 
str(const std::string & s)71 	inline std::string str(const std::string& s) {
72 		return s;
73 	}
74 }
75 
76 
77 #else
78 #	error "format.h was already included"
79 #endif //
80 #endif // !! AI_BOOST_FORMAT_DUMMY_INCLUDED
81 
82