Board index » cppbuilder » Aggravating CString to Ansi String--help
ActuaryOne
![]() CBuilder Developer |
ActuaryOne
![]() CBuilder Developer |
Aggravating CString to Ansi String--help2007-04-16 02:25:04 AM cppbuilder106 We move a lot of code between VS2005 and BDS2006 and spend hours converting CString stuff to Ansi and back...can we modify Ansi to add .Format(), .Left(),.Right(),.Mid() and [n-1] to its class or is it a namespace, if so can we modify that????THanks in advance. |
Bob Gonder
![]() CBuilder Developer |
2007-04-16 04:25:47 AM
Re:Aggravating CString to Ansi String--help
ActuaryOne wrote:
QuoteWe move a lot of code between VS2005 and BDS2006 and spend hours converting Quotecan we modify Ansi to add .Format(), If it were me, I'd look into creating a BDS version of CString, derived from AnsiString. That way the code remains VC but compiles on BDS. (Or the other-way-round, create a VC AnsiString based on CString) Looks like a pretty good discussion in this thread: groups.google.com/group/borland.public.cppbuilder.language/browse_thread/thread/7702b5a79a13236a tinyurl.com/2e6mez I would also add this admonishment about deriving from AnsiString: tinyurl.com/33mm5l |
Darko Miletic
![]() CBuilder Developer |
2007-04-16 05:33:04 AM
Re:Aggravating CString to Ansi String--help
"ActuaryOne" < XXXX@XXXXX.COM >wrote:
QuoteWe move a lot of code between VS2005 and BDS2006 and spend hours converting www.codeproject.com/string/stdstring.asp {smallsort} |
Chris Uzdavinis
![]() CBuilder Developer |
2007-04-16 08:49:01 PM
Re:Aggravating CString to Ansi String--help
"ActuaryOne" < XXXX@XXXXX.COM >writes:
QuoteWe move a lot of code between VS2005 and BDS2006 and spend hours converting That's a position in which nobody should want to be, and which people should actively strive to avoid. I'm thinking you'd be best off with your own facade class that holds a CString or AnsiString depending on platform, and implements its interface by forwarding all calls into that aggregated string. For features that the string lacks, you can simulate it. That way your class has the same interface on all platforms, and if implemented correctly will have the same behavior. Or you could use an intermediate string class like std::string, and leave the platform-specific strings only in your GUI code, which is already library-specific. (VCL code uses AnsiStrings, the rest of your code uses std::string, etc.) -- Chris (TeamB); |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-04-16 11:41:09 PM
Re:Aggravating CString to Ansi String--help
"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
QuoteIf it were me, I'd look into creating a BDS version of CString, it, as the classes are marked so as to not allow derivitives to ensure compatibility with Delphi. You could encapsulate an AnsiString variable, though. Gambit |
J Connell
![]() CBuilder Developer |
2007-06-06 03:26:40 PM
Re:Aggravating CString to Ansi String--help
Darko Miletic wrote:
Quote
It would solve a bundle of problems, and it works well in VC, I just can't get it to compile. Guess I'm getting senile in my old age ;) |