• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CW to Xcode: basic_ostream<UniChar...> and << "ascii"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CW to Xcode: basic_ostream<UniChar...> and << "ascii"


  • Subject: CW to Xcode: basic_ostream<UniChar...> and << "ascii"
  • From: Mark Alldritt <email@hidden>
  • Date: Sat, 29 Apr 2006 13:30:49 -0700
  • Thread-topic: CW to Xcode: basic_ostream<UniChar...> and << "ascii"

Hi,

CW's C++ ostream classes allow you to to create a type like this:

typedef std::basic_ostream<UniChar, std::char_traits<UniChar> >
TCLostream;

(UniChar is a 16-bit int) and then to output (char*) string literals through
it like this in code:

{
    TCLostring output(...);

    output << "Hello World" << std::endl;
}

When I run this from Xcode, the GNU C++ library throws a bad cast exception.
What must I do to support this.  I have a mountain of code that uses this
approach, so I'm sort of stuck.

Similarly, I have code that uses MSL's std::__utf8 to output UTF-8 encoded
text from a 16-bit (UniChar) C++ ostream:

typedef std::basic_string<UniChar, std::char_traits<UniChar>,
std::allocator<UniChar> > TCLString;


    std::locale loc(std::locale(), new std::__utf_8<UniChar>);
    TCLofstream o("/Users/mall/Desktop/test.txt");
    o.imbue(loc);

    TCLString utf16Variable(...);
    o << utf16Variable << std::endl;

What's the best solution for this problem?  I'm wondering if I should try
and port MSL's implementation of std::__utf_8 to GNU-C or if there is a
GNU-Cish way to accomplish the same thing.

Thanks
-Mark

------------------------------------------------------------------------
Mark Alldritt                      Late Night Software Ltd.
Phone: 250-380-1725                Script Debugger 4.0 - AppleScript IDE
WEB:  http://www.latenightsw.com/  FaceSpan 4.3 - AppleScript RAD
                                   Affrus 1.0 - Perl Debugging


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: CW vs Xcode C++ question
  • Next by Date: create project from applescript
  • Previous by thread: Re: Single project or two separate projects?
  • Next by thread: create project from applescript
  • Index(es):
    • Date
    • Thread