Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: Source/wtf/text/TextEncoding.h

Issue 27030014: Remove Backslash-as-JPY hack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: TextCodec/Encoding added Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/text/TextCodecICU.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 24 matching lines...) Expand all
35 35
36 class WTF_EXPORT TextEncoding { 36 class WTF_EXPORT TextEncoding {
37 public: 37 public:
38 TextEncoding() : m_name(0) { } 38 TextEncoding() : m_name(0) { }
39 TextEncoding(const char* name); 39 TextEncoding(const char* name);
40 TextEncoding(const String& name); 40 TextEncoding(const String& name);
41 41
42 bool isValid() const { return m_name; } 42 bool isValid() const { return m_name; }
43 const char* name() const { return m_name; } 43 const char* name() const { return m_name; }
44 bool usesVisualOrdering() const; 44 bool usesVisualOrdering() const;
45
46 bool hasTrivialDisplayString() const { return m_backslashAsCurrencySymbol == '\\'; }
47
48 PassRefPtr<StringImpl> displayString(PassRefPtr<StringImpl> str) const
49 {
50 if (hasTrivialDisplayString() || !str)
51 return str;
52 return str->replace('\\', m_backslashAsCurrencySymbol);
53 }
54 template <typename CharacterType>
55 void displayBuffer(CharacterType* characters, unsigned len) const
56 {
57 if (hasTrivialDisplayString())
58 return;
59 for (unsigned i = 0; i < len; ++i) {
60 if (characters[i] == '\\')
61 characters[i] = m_backslashAsCurrencySymbol;
62 }
63 }
64
65 const TextEncoding& closestByteBasedEquivalent() const; 45 const TextEncoding& closestByteBasedEquivalent() const;
66 const TextEncoding& encodingForFormSubmission() const; 46 const TextEncoding& encodingForFormSubmission() const;
67 47
68 String decode(const char* str, size_t length) const 48 String decode(const char* str, size_t length) const
69 { 49 {
70 bool ignored; 50 bool ignored;
71 return decode(str, length, false, ignored); 51 return decode(str, length, false, ignored);
72 } 52 }
73 String decode(const char*, size_t length, bool stopOnError, bool& sawError) const; 53 String decode(const char*, size_t length, bool stopOnError, bool& sawError) const;
74 54
(...skipping 30 matching lines...) Expand all
105 using WTF::ASCIIEncoding; 85 using WTF::ASCIIEncoding;
106 using WTF::Latin1Encoding; 86 using WTF::Latin1Encoding;
107 using WTF::UTF16BigEndianEncoding; 87 using WTF::UTF16BigEndianEncoding;
108 using WTF::UTF16LittleEndianEncoding; 88 using WTF::UTF16LittleEndianEncoding;
109 using WTF::UTF32BigEndianEncoding; 89 using WTF::UTF32BigEndianEncoding;
110 using WTF::UTF32LittleEndianEncoding; 90 using WTF::UTF32LittleEndianEncoding;
111 using WTF::UTF8Encoding; 91 using WTF::UTF8Encoding;
112 using WTF::WindowsLatin1Encoding; 92 using WTF::WindowsLatin1Encoding;
113 93
114 #endif // TextEncoding_h 94 #endif // TextEncoding_h
OLDNEW
« no previous file with comments | « Source/wtf/text/TextCodecICU.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698