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

Side by Side Diff: third_party/xulrunner-sdk/win/include/xpcom/nsStringAPI.h

Issue 119243: Adding an ifdef that forces wchar_t into PRUint16 temporarily on a nsAString ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « no previous file | third_party/xulrunner-sdk/win/sdk/include/nsStringAPI.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* vim:set ts=2 sw=2 et cindent: */ 1 /* vim:set ts=2 sw=2 et cindent: */
2 /* ***** BEGIN LICENSE BLOCK ***** 2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * 4 *
5 * The contents of this file are subject to the Mozilla Public License Version 5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with 6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at 7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/ 8 * http://www.mozilla.org/MPL/
9 * 9 *
10 * Software distributed under the License is distributed on an "AS IS" basis, 10 * Software distributed under the License is distributed on an "AS IS" basis,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "prlog.h" 55 #include "prlog.h"
56 56
57 class nsAString 57 class nsAString
58 { 58 {
59 public: 59 public:
60 typedef PRUnichar char_type; 60 typedef PRUnichar char_type;
61 typedef nsAString self_type; 61 typedef nsAString self_type;
62 typedef PRUint32 size_type; 62 typedef PRUint32 size_type;
63 typedef PRUint32 index_type; 63 typedef PRUint32 index_type;
64 64
65 // Force BeginReading into using PRUint16s instead of wchar_t on Windows.
66 // This avoids errors when linking from a project compiled with /Zc:wchar_t.
67 #if defined(WIN32)
68 #define char_type PRUint16
69 #endif
65 /** 70 /**
66 * Returns the length, beginning, and end of a string in one operation. 71 * Returns the length, beginning, and end of a string in one operation.
67 */ 72 */
68 NS_HIDDEN_(PRUint32) BeginReading(const char_type **begin, 73 NS_HIDDEN_(PRUint32) BeginReading(const char_type **begin,
69 const char_type **end = nsnull) const; 74 const char_type **end = nsnull) const;
70 75
71 NS_HIDDEN_(const char_type*) BeginReading() const; 76 NS_HIDDEN_(const char_type*) BeginReading() const;
72 NS_HIDDEN_(const char_type*) EndReading() const; 77 NS_HIDDEN_(const char_type*) EndReading() const;
78 #if defined(WIN32)
79 #undef char_type
80 #endif
73 81
74 NS_HIDDEN_(char_type) CharAt(PRUint32 aPos) const 82 NS_HIDDEN_(char_type) CharAt(PRUint32 aPos) const
75 { 83 {
76 NS_ASSERTION(aPos < Length(), "Out of bounds"); 84 NS_ASSERTION(aPos < Length(), "Out of bounds");
77 return BeginReading()[aPos]; 85 return BeginReading()[aPos];
78 } 86 }
79 NS_HIDDEN_(char_type) operator [](PRUint32 aPos) const 87 NS_HIDDEN_(char_type) operator [](PRUint32 aPos) const
80 { 88 {
81 return CharAt(aPos); 89 return CharAt(aPos);
82 } 90 }
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 NS_StringContainerInit2(*this, aData, aLength, 0); 786 NS_StringContainerInit2(*this, aData, aLength, 0);
779 } 787 }
780 788
781 ~nsString() 789 ~nsString()
782 { 790 {
783 NS_StringContainerFinish(*this); 791 NS_StringContainerFinish(*this);
784 } 792 }
785 793
786 const char_type* get() const 794 const char_type* get() const
787 { 795 {
796 #if defined(WIN32)
797 return reinterpret_cast<const char_type*>(BeginReading());
798 #else
788 return BeginReading(); 799 return BeginReading();
800 #endif
789 } 801 }
790 802
791 self_type& operator=(const self_type& aString) { Assign(aString); return *this; } 803 self_type& operator=(const self_type& aString) { Assign(aString); return *this; }
792 self_type& operator=(const abstract_string_type& aReadable) { Assign(aReadable ); return *this; } 804 self_type& operator=(const abstract_string_type& aReadable) { Assign(aReadable ); return *this; }
793 self_type& operator=(const char_type* aPtr) { Assign(aPtr); return *this; } 805 self_type& operator=(const char_type* aPtr) { Assign(aPtr); return *this; }
794 self_type& operator=(char_type aChar) { Assign(aChar); return *this; } 806 self_type& operator=(char_type aChar) { Assign(aChar); return *this; }
795 807
796 void Adopt(const char_type *aData, size_type aLength = PR_UINT32_MAX) 808 void Adopt(const char_type *aData, size_type aLength = PR_UINT32_MAX)
797 { 809 {
798 NS_StringContainerFinish(*this); 810 NS_StringContainerFinish(*this);
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 return NS_StringCloneData(aStr); 1424 return NS_StringCloneData(aStr);
1413 } 1425 }
1414 1426
1415 typedef nsString PromiseFlatString; 1427 typedef nsString PromiseFlatString;
1416 typedef nsCString PromiseFlatCString; 1428 typedef nsCString PromiseFlatCString;
1417 1429
1418 typedef nsCString nsCAutoString; 1430 typedef nsCString nsCAutoString;
1419 typedef nsString nsAutoString; 1431 typedef nsString nsAutoString;
1420 1432
1421 #endif // nsStringAPI_h__ 1433 #endif // nsStringAPI_h__
OLDNEW
« no previous file with comments | « no previous file | third_party/xulrunner-sdk/win/sdk/include/nsStringAPI.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698