I think it would be ok to have GetString and GetAsString both be overloaded to work with std::string and std::wstring while we transition the callers. It's the same as having a single CreateStringValue that takes std::string and std::wstring.
Having 2 string types is really confusing and I think it will introduce bugs where people mean to check both but only check one. On Tue, 9 Dec 2008, Andrew Scherkus wrote: > Changing the callers would be a much bigger job. If switching to > std::string is something we're really interested in, then I'd view this > patch as a stepping stone towards reaching that goal. > > I've got a change ready, but it gives you a good idea on who's using > StringValue right now: > http://codereview.chromium.org/13230 > > There's already a few instances where people had to force their input to > std::wstring:http://codereview.chromium.org/13230/diff/25/221?context=10 > > On Tue, Dec 9, 2008 at 12:07 PM, <[EMAIL PROTECTED]> wrote: > > > > > That's fine with me as well. Internally, it's always utf8 but we would > > add helper methods on StringValue so you can CreateStringValue with a > > wstring or call GetWString. > > > > On Tue, 9 Dec 2008, Brett Wilson wrote: > > > > > > > > On Tue, Dec 9, 2008 at 10:38 AM, <[EMAIL PROTECTED]> wrote: > > > > > > > > So there's a single StringValue class, but sometimes its type is > > > > TYPE_UTF8_STRING and sometimes its type is TYPE_UTF16_STRING? So > > calling > > > > Value::IsType would require two checks to see what type of string it > > is? > > > > > > > > I think it would be easier if there was only one string type and > > > > internally it keeps track of whether to use a std::string or > > std::wstring > > > > (depending on which CreateString method was used). If you call > > GetString > > > > or GetWString, it'll do the conversion automatically if you created the > > > > string using the other type. This makes it easier for consumers of the > > > > code and shouldn't require changing any callers. > > > > > > I think value should always be std::string. That's what it reads from > > > disk anyway. And I would advocate changing the callers (but I don't > > > know how big a job that would be). > > > > > > 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 -~----------~----~----~----~------~----~------~--~---
