summaryrefslogtreecommitdiff
path: root/tests/glibmm_ustring_format/main.cc
blob: 3f44a531633ea15786936975eacab53fb86e7cc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <glibmm.h>

#include <iostream>

int main(int, char**)
{
  Glib::init();

  char carr[10] = "UÅūduotys";
  char * const cptr = carr;

  /*
  std::wostringstream wsout;
  wsout << carr;
  const std::wstring& wstr = wsout.str();
  const gunichar * const data = reinterpret_cast<const gunichar *>(
                                  wstr.data());

  for(int i = 0; wstr.size() > i; ++i)
    std::cout << data[i] << std::endl;
  */

  //Check both the const char* and char* versions.
  Glib::ustring::format(carr);

  //This threw an exception before we added a ustring::FormatStream::stream(char*) overload.
  Glib::ustring::format(cptr);

  return EXIT_SUCCESS;
}