00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 */ 00057 #if !defined(XALANDOMSTRING_HEADER_GUARD_1357924680) 00058 #define XALANDOMSTRING_HEADER_GUARD_1357924680 00059 00060 00061 00062 #include <XalanDOM/XalanDOMDefinitions.hpp> 00063 00064 00065 00066 #include <vector> 00067 00068 00069 00070 #include <XalanDOM/XalanDOMException.hpp> 00071 00072 00073 00074 // UTF-16 character... 00075 typedef unsigned short XalanDOMChar; 00076 00077 00078 00079 #include <cassert> 00080 00081 00082 00083 class XALAN_DOM_EXPORT XalanDOMString 00084 { 00085 public: 00086 00087 #if defined(XALAN_NO_NAMESPACES) 00088 typedef vector<XalanDOMChar> XalanDOMCharVectorType; 00089 typedef vector<char> CharVectorType; 00090 typedef vector<wchar_t> WideCharVectorType; 00091 #else 00092 typedef std::vector<XalanDOMChar> XalanDOMCharVectorType; 00093 typedef std::vector<char> CharVectorType; 00094 typedef std::vector<wchar_t> WideCharVectorType; 00095 #endif 00096 00097 typedef XalanDOMChar value_type; 00098 typedef XalanDOMChar& reference; 00099 typedef const XalanDOMChar& const_reference; 00100 00101 typedef XalanDOMCharVectorType::size_type size_type; 00102 00103 typedef XalanDOMCharVectorType::iterator iterator; 00104 typedef XalanDOMCharVectorType::const_iterator const_iterator; 00105 typedef XalanDOMCharVectorType::reverse_iterator reverse_iterator; 00106 typedef XalanDOMCharVectorType::const_reverse_iterator const_reverse_iterator; 00107 00108 #if defined(XALAN_INLINE_INITIALIZATION) 00109 static const size_type npos = ~0u; 00110 #else 00111 enum { npos = -1 }; 00112 #endif 00113 00114 explicit 00115 XalanDOMString(); 00116 00117 explicit 00118 XalanDOMString( 00119 const char* theString, 00120 size_type theCount = size_type(npos)); 00121 00122 XalanDOMString( 00123 const XalanDOMString& theSource, 00124 size_type theStartPosition = 0, 00125 size_type theCount = size_type(npos)); 00126 00127 explicit 00128 XalanDOMString( 00129 const XalanDOMChar* theString, 00130 size_type theCount = size_type(npos)); 00131 00132 XalanDOMString( 00133 size_type theCount, 00134 XalanDOMChar theChar); 00135 00136 ~XalanDOMString() 00137 { 00138 } 00139 00140 XalanDOMString& 00141 operator=(const XalanDOMString& theRHS) 00142 { 00143 return assign(theRHS); 00144 } 00145 00146 XalanDOMString& 00147 operator=(const XalanDOMChar* theRHS) 00148 { 00149 return assign(theRHS); 00150 } 00151 00152 XalanDOMString& 00153 operator=(const char* theRHS) 00154 { 00155 return assign(theRHS); 00156 } 00157 00158 XalanDOMString& 00159 operator=(XalanDOMChar theRHS) 00160 { 00161 return assign(1, theRHS); 00162 } 00163 00164 iterator 00165 begin() 00166 { 00167 invariants(); 00168 00169 return m_data.begin(); 00170 } 00171 00172 const_iterator 00173 begin() const 00174 { 00175 invariants(); 00176 00177 return m_data.begin(); 00178 } 00179 00180 reverse_iterator 00181 rbegin() 00182 { 00183 invariants(); 00184 00185 return m_data.rbegin(); 00186 } 00187 00188 const_reverse_iterator 00189 rbegin() const 00190 { 00191 invariants(); 00192 00193 return m_data.rbegin(); 00194 } 00195 00196 size_type 00197 size() const 00198 { 00199 invariants(); 00200 00201 return m_size; 00202 } 00203 00204 size_type 00205 length() const 00206 { 00207 invariants(); 00208 00209 return size(); 00210 } 00211 00212 size_type 00213 max_size() const 00214 { 00215 invariants(); 00216 00217 return size_type(~0); 00218 } 00219 00220 void 00221 resize( 00222 size_type theCount, 00223 XalanDOMChar theChar); 00224 00225 void 00226 resize(size_type theCount) 00227 { 00228 invariants(); 00229 00230 resize(theCount, XalanDOMChar(0)); 00231 } 00232 00233 size_type 00234 capacity() const 00235 { 00236 invariants(); 00237 00238 return m_data.capacity() - 1; 00239 } 00240 00241 void 00242 reserve(size_type theCount = 0) 00243 { 00244 invariants(); 00245 00246 m_data.reserve(theCount + 1); 00247 } 00248 00249 void 00250 clear() 00251 { 00252 invariants(); 00253 00254 m_data.erase(m_data.begin(), m_data.end()); 00255 00256 m_size = 0; 00257 00258 invariants(); 00259 } 00260 00261 void 00262 erase( 00263 size_type theStartPosition = 0, 00264 size_type theCount = size_type(npos)); 00265 00266 bool 00267 empty() const 00268 { 00269 invariants(); 00270 00271 return m_size == 0 ? true : false; 00272 } 00273 00274 const_reference 00275 operator[](size_type theIndex) const 00276 { 00277 invariants(); 00278 00279 return m_data[theIndex]; 00280 } 00281 00282 reference 00283 operator[](size_type theIndex) 00284 { 00285 invariants(); 00286 00287 return m_data[theIndex]; 00288 } 00289 00290 #if 0 00291 // $$$ ToDo: at() is not supported in the current version of GCC's vector<> 00292 // implementation. Eventually, it should be. 00293 const_reference 00294 at(size_type theIndex) const 00295 { 00296 invariants(); 00297 00298 return m_data.at(theIndex); 00299 } 00300 00301 reference 00302 at(size_type theIndex) 00303 { 00304 invariants(); 00305 00306 return m_data.at(theIndex); 00307 } 00308 #endif 00309 00310 const XalanDOMChar* 00311 c_str() const 00312 { 00313 invariants(); 00314 00315 // $$$ ToDo: Do we really want to do this? 00316 // for convenience, we will return a pointer to 00317 // a default empty string so that c_str() never 00318 // returns a null pointer... 00319 return m_data.size() == 0 ? &s_empty : &m_data[0]; 00320 } 00321 00322 const XalanDOMChar* 00323 data() const 00324 { 00325 invariants(); 00326 00327 return c_str(); 00328 } 00329 00330 void 00331 swap(XalanDOMString& theOther) 00332 { 00333 invariants(); 00334 00335 m_data.swap(theOther.m_data); 00336 00337 #if defined(XALAN_NO_NAMESPACES) 00338 ::swap(m_size, theOther.m_size); 00339 #else 00340 std::swap(m_size, theOther.m_size); 00341 #endif 00342 } 00343 00344 XalanDOMString& 00345 operator+=(const XalanDOMString& theSource) 00346 { 00347 return append(theSource); 00348 } 00349 00350 XalanDOMString& 00351 operator+=(const XalanDOMChar* theString) 00352 { 00353 return append(theString); 00354 } 00355 00356 XalanDOMString& 00357 operator+=(XalanDOMChar theChar) 00358 { 00359 append(1, theChar); 00360 00361 return *this; 00362 } 00363 00364 XalanDOMString& 00365 assign(const XalanDOMChar* theSource) 00366 { 00367 invariants(); 00368 00369 erase(); 00370 00371 invariants(); 00372 00373 return append(theSource); 00374 } 00375 00376 XalanDOMString& 00377 assign( 00378 const XalanDOMChar* theSource, 00379 size_type theCount) 00380 { 00381 invariants(); 00382 00383 erase(); 00384 00385 invariants(); 00386 00387 return append(theSource, theCount); 00388 } 00389 00390 XalanDOMString& 00391 assign(const char* theSource) 00392 { 00393 invariants(); 00394 00395 erase(); 00396 00397 invariants(); 00398 00399 return append(theSource); 00400 } 00401 00402 XalanDOMString& 00403 assign( 00404 const char* theSource, 00405 size_type theCount) 00406 { 00407 invariants(); 00408 00409 erase(); 00410 00411 invariants(); 00412 00413 return append(theSource, theCount); 00414 } 00415 00416 XalanDOMString& 00417 assign( 00418 const XalanDOMString& theSource, 00419 size_type thePosition, 00420 size_type theCount) 00421 { 00422 invariants(); 00423 00424 if (&theSource != this) 00425 { 00426 erase(); 00427 00428 append(theSource, thePosition, theCount); 00429 } 00430 00431 invariants(); 00432 00433 return *this; 00434 } 00435 00436 XalanDOMString& 00437 assign(const XalanDOMString& theSource) 00438 { 00439 invariants(); 00440 00441 if (&theSource != this) 00442 { 00443 m_data = theSource.m_data; 00444 00445 m_size = theSource.m_size; 00446 } 00447 00448 invariants(); 00449 00450 return *this; 00451 } 00452 00453 XalanDOMString& 00454 assign( 00455 size_type theCount, 00456 XalanDOMChar theChar) 00457 { 00458 invariants(); 00459 00460 erase(); 00461 00462 invariants(); 00463 00464 return append(theCount, theChar); 00465 } 00466 00467 XalanDOMString& 00468 assign( 00469 const_iterator theFirstPosition, 00470 const_iterator theLastPosition); 00471 00472 XalanDOMString& 00473 append(const XalanDOMString& theSource) 00474 { 00475 return append(theSource.c_str(), theSource.length()); 00476 } 00477 00478 XalanDOMString& 00479 append( 00480 const XalanDOMString& theSource, 00481 size_type thePosition, 00482 size_type theCount) 00483 { 00484 assert(thePosition < theSource.length() && 00485 (theCount == size_type(npos) || thePosition + theCount <= theSource.length())); 00486 00487 return append(theSource.c_str() + thePosition, theCount); 00488 } 00489 00490 XalanDOMString& 00491 append( 00492 const XalanDOMChar* theString, 00493 size_type theCount); 00494 00495 XalanDOMString& 00496 append(const XalanDOMChar* theString) 00497 { 00498 return append(theString, length(theString)); 00499 } 00500 00501 XalanDOMString& 00502 append( 00503 const char* theString, 00504 size_type theCount); 00505 00506 XalanDOMString& 00507 append(const char* theString) 00508 { 00509 return append(theString, length(theString)); 00510 } 00511 00512 XalanDOMString& 00513 append( 00514 size_type theCount, 00515 XalanDOMChar theChar); 00516 00517 void 00518 push_back(XalanDOMChar theChar) 00519 { 00520 invariants(); 00521 00522 append(1, theChar); 00523 00524 invariants(); 00525 } 00526 00527 XalanDOMString& 00528 insert( 00529 size_type thePosition, 00530 const XalanDOMString& theString) 00531 { 00532 return insert(thePosition, theString.c_str(), theString.length()); 00533 } 00534 00535 XalanDOMString& 00536 insert( 00537 size_type thePosition1, 00538 const XalanDOMString& theString, 00539 size_type thePosition2, 00540 size_type theCount) 00541 { 00542 return insert(thePosition1, theString.c_str() + thePosition2, theCount); 00543 } 00544 00545 XalanDOMString& 00546 insert( 00547 size_type thePosition, 00548 const XalanDOMChar* theString, 00549 size_type theCount); 00550 00551 XalanDOMString& 00552 insert( 00553 size_type thePosition, 00554 const XalanDOMChar* theString) 00555 { 00556 return insert(thePosition, theString, length(theString)); 00557 } 00558 00559 XalanDOMString& 00560 insert( 00561 size_type thePosition, 00562 size_type theCount, 00563 XalanDOMChar theChar); 00564 00565 iterator 00566 insert( 00567 iterator thePosition, 00568 XalanDOMChar theChar); 00569 00570 void 00571 insert( 00572 iterator thePosition, 00573 size_type theCount, 00574 XalanDOMChar theChar); 00575 00576 void 00577 insert( 00578 iterator theInsertPosition, 00579 const_iterator theFirstPosition, 00580 const_iterator theLastPosition); 00581 00582 XalanDOMString 00583 substr( 00584 size_type thePosition = 0, 00585 size_type theCount = size_type(npos)) const 00586 { 00587 assert(theCount == size_type(npos) && thePosition < length() || 00588 thePosition + theCount <= length()); 00589 00590 invariants(); 00591 00592 return XalanDOMString(*this, thePosition, theCount); 00593 } 00594 00595 XalanDOMString& 00596 substr( 00597 XalanDOMString& theSubstring, 00598 size_type thePosition = 0, 00599 size_type theCount = size_type(npos)) const 00600 { 00601 assert(theCount == size_type(npos) && thePosition < length() || 00602 thePosition + theCount <= length()); 00603 00604 invariants(); 00605 00606 return theSubstring.assign(*this, thePosition, theCount); 00607 } 00608 00609 int 00610 compare(const XalanDOMString& theString) const 00611 { 00612 invariants(); 00613 00614 return compare(theString.c_str()); 00615 } 00616 00617 int 00618 compare( 00619 size_type thePosition1, 00620 size_type theCount1, 00621 const XalanDOMString& theString) const 00622 { 00623 invariants(); 00624 00625 return compare(thePosition1, theCount1, theString.c_str(), theString.length()); 00626 } 00627 00628 int 00629 compare( 00630 size_type thePosition1, 00631 size_type theCount1, 00632 const XalanDOMString& theString, 00633 size_type thePosition2, 00634 size_type theCount2) const 00635 { 00636 invariants(); 00637 00638 return compare(thePosition1, theCount1, theString.c_str() + thePosition2, theCount2); 00639 } 00640 00641 int 00642 compare(const XalanDOMChar* theString) const; 00643 00644 int 00645 compare( 00646 size_type thePosition1, 00647 size_type theCount1, 00648 const XalanDOMChar* theString, 00649 size_type theCount2 = size_type(npos)) const; 00650 00651 int 00652 compare(const char* theString) const 00653 { 00654 invariants(); 00655 00656 return compare(XalanDOMString(theString)); 00657 } 00658 00659 int 00660 compare( 00661 size_type thePosition1, 00662 size_type theCount1, 00663 const char* theString, 00664 size_type theCount2 = size_type(npos)) const 00665 { 00666 invariants(); 00667 00668 return compare(thePosition1, theCount1, XalanDOMString(theString, theCount2)); 00669 } 00670 00671 CharVectorType 00672 transcode() const; 00673 00674 static bool 00675 equals( 00676 const XalanDOMChar* theLHS, 00677 size_type theLHSLength, 00678 const XalanDOMChar* theRHS, 00679 size_type theRHSLength); 00680 00681 static bool 00682 equals( 00683 const XalanDOMChar* theLHS, 00684 const XalanDOMChar* theRHS) 00685 { 00686 return equals(theLHS, length(theLHS), theRHS, length(theRHS)); 00687 } 00688 00689 static bool 00690 equals( 00691 const XalanDOMString& theLHS, 00692 const XalanDOMString& theRHS); 00693 00694 static bool 00695 equals( 00696 const XalanDOMString& theLHS, 00697 const XalanDOMChar* theRHS) 00698 { 00699 return equals(theLHS.c_str(), theRHS); 00700 } 00701 00702 static bool 00703 equals( 00704 const XalanDOMChar* theLHS, 00705 const XalanDOMString& theRHS) 00706 { 00707 return equals(theLHS, theRHS.c_str()); 00708 } 00709 00710 /* 00711 * Helper function to determine the length of a null- 00712 * terminated string. 00713 * 00714 * @theString The string 00715 * @return the length 00716 */ 00717 static size_type 00718 length(const XalanDOMChar* theString); 00719 00720 /* 00721 * Helper function to determine the length of a null- 00722 * terminated string. 00723 * 00724 * @theString The string 00725 * @return the length 00726 */ 00727 static size_type 00728 length(const char* theString); 00729 00730 class TranscodingError : public XalanDOMException 00731 { 00732 public: 00733 00734 TranscodingError() : 00735 XalanDOMException(TRANSCODING_ERR) 00736 { 00737 } 00738 00739 virtual 00740 ~TranscodingError() 00741 { 00742 } 00743 }; 00744 00745 protected: 00746 00747 /* 00748 * Function to assert invariant conditions for the class. 00749 * 00750 * @return the iterator 00751 */ 00752 void 00753 invariants() const 00754 { 00755 #if !defined(NDEBUG) 00756 assert((m_data.size() == 0 && m_size == 0) || m_size == m_data.size() - 1); 00757 assert(m_data.size() == 0 || m_data.back() == 0); 00758 #endif 00759 } 00760 00761 /* 00762 * Get an iterator to the position of the terminating null. 00763 * 00764 * @return the iterator 00765 */ 00766 iterator 00767 getBackInsertIterator() 00768 { 00769 invariants(); 00770 00771 return m_data.size() == 0 ? m_data.end() : m_data.end() - 1; 00772 } 00773 00774 const_iterator 00775 getBackInsertIterator() const 00776 { 00777 invariants(); 00778 00779 return m_data.size() == 0 ? m_data.end() : m_data.end() - 1; 00780 } 00781 00782 iterator 00783 getIteratorForPosition(size_type thePosition) 00784 { 00785 invariants(); 00786 00787 return m_data.begin() + thePosition; 00788 } 00789 00790 const_iterator 00791 getIteratorForPosition(size_type thePosition) const 00792 { 00793 invariants(); 00794 00795 return m_data.begin() + thePosition; 00796 } 00797 00798 private: 00799 00800 XalanDOMCharVectorType m_data; 00801 00802 size_type m_size; 00803 00804 static const XalanDOMChar s_empty; 00805 }; 00806 00807 00808 00809 inline bool 00810 operator==( 00811 const XalanDOMString& theLHS, 00812 const XalanDOMString& theRHS) 00813 { 00814 return XalanDOMString::equals(theLHS, theRHS); 00815 } 00816 00817 00818 00819 inline bool 00820 operator==( 00821 const XalanDOMString& theLHS, 00822 const XalanDOMChar* theRHS) 00823 { 00824 return XalanDOMString::equals(theLHS, theRHS); 00825 } 00826 00827 00828 00829 inline bool 00830 operator==( 00831 const XalanDOMChar* theLHS, 00832 const XalanDOMString& theRHS) 00833 { 00834 // Note reversing of operands... 00835 return XalanDOMString::equals(theLHS, theRHS); 00836 } 00837 00838 00839 00840 inline bool 00841 operator!=( 00842 const XalanDOMString& theLHS, 00843 const XalanDOMString& theRHS) 00844 { 00845 return !(theLHS == theRHS); 00846 } 00847 00848 00849 00850 inline bool 00851 operator!=( 00852 const XalanDOMChar* theLHS, 00853 const XalanDOMString& theRHS) 00854 { 00855 return !(theLHS == theRHS); 00856 } 00857 00858 00859 00860 inline bool 00861 operator!=( 00862 const XalanDOMString& theLHS, 00863 const XalanDOMChar* theRHS) 00864 { 00865 return !(theRHS == theLHS); 00866 } 00867 00868 00869 00870 inline XalanDOMString 00871 operator+( 00872 const XalanDOMString& theLHS, 00873 const XalanDOMString& theRHS) 00874 { 00875 XalanDOMString theTemp(theLHS); 00876 00877 return theTemp += theRHS; 00878 } 00879 00880 00881 00882 inline XalanDOMString 00883 operator+( 00884 const XalanDOMString& theLHS, 00885 const XalanDOMChar* theRHS) 00886 { 00887 XalanDOMString theTemp(theLHS); 00888 00889 return theTemp += theRHS; 00890 } 00891 00892 00893 00894 inline XalanDOMString 00895 operator+( 00896 const XalanDOMChar* theLHS, 00897 const XalanDOMString& theRHS) 00898 { 00899 XalanDOMString theTemp(theLHS); 00900 00901 return theTemp += theRHS; 00902 } 00903 00904 00905 00906 inline const XalanDOMString 00907 operator+( 00908 const char* theLHS, 00909 const XalanDOMString& theRHS) 00910 { 00911 return XalanDOMString(theLHS) + theRHS; 00912 } 00913 00914 00915 00916 inline const XalanDOMString 00917 operator+( 00918 const XalanDOMString& theLHS, 00919 const char* theRHS) 00920 { 00921 return theLHS + XalanDOMString(theRHS); 00922 } 00923 00924 00925 00926 // Standard vector of XalanDOMChars and chars 00927 #if defined(XALAN_NO_NAMESPACES) 00928 typedef vector<XalanDOMChar> XalanDOMCharVectorType; 00929 00930 typedef vector<char> CharVectorType; 00931 #else 00932 typedef std::vector<XalanDOMChar> XalanDOMCharVectorType; 00933 00934 typedef std::vector<char> CharVectorType; 00935 #endif 00936 00937 00938 00950 XALAN_DOM_EXPORT_FUNCTION(bool) 00951 TranscodeToLocalCodePage( 00952 const XalanDOMChar* theSourceString, 00953 XalanDOMString::size_type theSourceStringLength, 00954 CharVectorType& targetVector, 00955 bool terminate = false); 00956 00957 00958 00969 XALAN_DOM_EXPORT_FUNCTION(bool) 00970 TranscodeToLocalCodePage( 00971 const XalanDOMChar* theSourceString, 00972 CharVectorType& targetVector, 00973 bool terminate = false); 00974 00975 00976 00985 inline const CharVectorType 00986 TranscodeToLocalCodePage(const XalanDOMChar* theSourceString) 00987 { 00988 CharVectorType theResult; 00989 00990 TranscodeToLocalCodePage(theSourceString, theResult, true); 00991 00992 return theResult; 00993 } 00994 00995 00996 01006 inline bool 01007 TranscodeToLocalCodePage( 01008 const XalanDOMString& theSourceString, 01009 CharVectorType& targetVector, 01010 bool terminate = false) 01011 { 01012 return TranscodeToLocalCodePage(theSourceString.c_str(), targetVector, terminate); 01013 } 01014 01015 01016 01025 inline const CharVectorType 01026 TranscodeToLocalCodePage(const XalanDOMString& theSourceString) 01027 { 01028 CharVectorType theResult; 01029 01030 TranscodeToLocalCodePage(theSourceString, theResult, true); 01031 01032 return theResult; 01033 } 01034 01035 01036 01045 inline const XalanDOMString 01046 TranscodeFromLocalCodePage( 01047 const char* theSourceString, 01048 XalanDOMString::size_type theSourceStringLength = XalanDOMString::npos) 01049 { 01050 return XalanDOMString(theSourceString, theSourceStringLength); 01051 } 01052 01053 01054 01066 XALAN_DOM_EXPORT_FUNCTION(bool) 01067 TranscodeFromLocalCodePage( 01068 const char* theSourceString, 01069 XalanDOMString::size_type theSourceStringLength, 01070 XalanDOMCharVectorType& theTargetVector, 01071 bool terminate = false); 01072 01073 01074 01085 XALAN_DOM_EXPORT_FUNCTION(bool) 01086 TranscodeFromLocalCodePage( 01087 const char* theSourceString, 01088 XalanDOMCharVectorType& theTargetVector, 01089 bool terminate = false); 01090 01091 01092 01100 inline const XalanDOMString 01101 TranscodeFromLocalCodePage(const CharVectorType& theSourceString) 01102 { 01103 typedef XalanDOMString::size_type size_type; 01104 01105 const CharVectorType::size_type theSize = theSourceString.size(); 01106 01107 if (theSourceString[theSize - 1] == CharVectorType::value_type(0)) 01108 { 01109 return TranscodeFromLocalCodePage(&*theSourceString.begin(), size_type(theSize) - 1); 01110 } 01111 else 01112 { 01113 return TranscodeFromLocalCodePage(&*theSourceString.begin(), size_type(theSize)); 01114 } 01115 } 01116 01117 01118 01119 #endif // !defined(XALANDOMSTRING_HEADER_GUARD_1357924680)
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSLT Processor Version 1.3 |
|