Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

82 wiersze
1.4 KiB

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