Somewhat in line with the Google style guide, the overloaded CreateStringValue/GetString do accomplish the same thing (variant string type), just with different encodings. I did some partial implementations of #3 and as Peter highlighted, writing GetWideString everywhere started looking really silly.
In terms of enums and implementation, would TYPE_STRING and TYPE_WSTRING suffice with documentation and DCHECKs for UTF-8 std::strings? On Mon, Dec 8, 2008 at 8:09 PM, Brett Wilson <[EMAIL PROTECTED]> wrote: > > On Mon, Dec 8, 2008 at 7:50 PM, Peter Kasting <[EMAIL PROTECTED]> wrote: > > On Mon, Dec 8, 2008 at 6:41 PM, Andrew Scherkus <[EMAIL PROTECTED]> > > wrote: > >> > >> Darin touched upon this, who said to document that std::string should > >> refer to UTF-8 strings. > >> How about: > >> - CreateStringValue creates a StringValue object that returns > >> TYPE_UTF8_STRING and has a DCHECK(IsStringUTF8(foo)) in the constructor > >> - CreateWideStringValue creates a WideStringValue object that returns > >> TYPE_UTF16_STRING > > > > To be honest, I probably lean more toward a single overloaded > > CreateStringValue(). I think having different function names decreases > > clarity and increases verbosity. But it's not a big deal. > > However, if you go with two names, make the names match the TYPE_ > returns: > > CreateUTF8StringValue() and CreateUTF16StringValue(), or something. > > Be careful because wstring != UTF16String. > > In other places of the code, we use GetWString, which if you're > returning a wstring, I think is the best naming convention (since > wstring changes type depending on the platform). > > Brett > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Chromium-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/chromium-dev?hl=en -~----------~----~----~----~------~----~------~--~---
