testfrom_facet.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Copyright (c) 2004 CrystalClear Software, Inc.
  2. * Use, modification and distribution is subject to the
  3. * Boost Software License, Version 1.0. (See accompanying
  4. * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  5. * Author: Jeff Garland
  6. * $Date$
  7. *
  8. * This file isn't part of the official regression test suite at
  9. * the moment, but it is a basic test of the strings_from_facet.hpp
  10. * infrastructure that can be compiled trivially.
  11. */
  12. #include <string>
  13. #include <iostream>
  14. #include <sstream>
  15. #include <vector>
  16. #include <fstream>
  17. #include "boost/date_time/strings_from_facet.hpp"
  18. #include "algorithm_ext/container_print.hpp"
  19. int
  20. main()
  21. {
  22. using boost::date_time::gather_month_strings;
  23. using boost::date_time::gather_weekday_strings;
  24. std::vector<std::string> data;
  25. std::vector<std::wstring> wdata;
  26. data = gather_month_strings<char>(std::locale::classic());
  27. print(data, std::cout);
  28. data = gather_month_strings<char>(std::locale::classic(), false);
  29. print(data, std::cout);
  30. data = gather_weekday_strings<char>(std::locale::classic());
  31. print(data, std::cout);
  32. data = gather_weekday_strings<char>(std::locale::classic(), false);
  33. print(data, std::cout);
  34. wdata = gather_month_strings<wchar_t>(std::locale::classic());
  35. std::wofstream wof("from_facet_test.out");
  36. int i=0;
  37. while (i < wdata.size()) {
  38. wof << wdata[i] << std::endl;
  39. i++;
  40. }
  41. }