Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: None
    • Labels:
      None

      Description

      Currently, one cannot directly output a std::string through a logstream. Looking at the operator<< functions for char, I discovered the same pattern can be used for std::string. So, I added those functions and am attaching a patch.

      1. fixLogstream2.diff
        1 kB
        David Steck
      2. fixLogstream.diff
        1 kB
        David Steck

        Activity

        Hide
        David Steck added a comment -

        Patch to add functions for outputting a std::string with logstream.

        Show
        David Steck added a comment - Patch to add functions for outputting a std::string with logstream.
        Hide
        David Steck added a comment -

        After further investigation, I've discovered some more. In my previous build, I had passed --with-logchar=wchar_t to configure. Then, LogString was defined essentially as std::wstring. Adding my operator<<() functions gave a definition for std::string. But, if you don't pass --with-logchar=wchar_t to configure, you end up with multiple definitions of the function with the same prototype, since LogString is now also essentially std::string.

        So, perhaps a fix would be to define an operator<<() function for std::string if using wchar, and a function for std::wstring otherwise. I'm attaching a patch, to replace my previous patch, that fixes the one direction (defines operator<<() for std::string).

        Show
        David Steck added a comment - After further investigation, I've discovered some more. In my previous build, I had passed --with-logchar=wchar_t to configure. Then, LogString was defined essentially as std::wstring. Adding my operator<<() functions gave a definition for std::string. But, if you don't pass --with-logchar=wchar_t to configure, you end up with multiple definitions of the function with the same prototype, since LogString is now also essentially std::string. So, perhaps a fix would be to define an operator<<() function for std::string if using wchar, and a function for std::wstring otherwise. I'm attaching a patch, to replace my previous patch, that fixes the one direction (defines operator<<() for std::string).
        Hide
        Curt Arnold added a comment -

        logstream has been rewritten to abandon trying to support both char and wchar_t characters with a single instance. logstream now is char-oriented (assumed to be in the default code page) and wlogchar is wchar_t oriented. I believe the issue you were running into would not occur with the current implementation.

        Show
        Curt Arnold added a comment - logstream has been rewritten to abandon trying to support both char and wchar_t characters with a single instance. logstream now is char-oriented (assumed to be in the default code page) and wlogchar is wchar_t oriented. I believe the issue you were running into would not occur with the current implementation.

          People

          • Assignee:
            Curt Arnold
            Reporter:
            David Steck
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development