00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2002 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 #if defined(XALAN_USE_NATIVE_WCHAR_T) 00075 typedef wchar_t XalanDOMChar; 00076 #else 00077 // UTF-16 character... 00078 typedef unsigned short XalanDOMChar; 00079 #endif 00080 00081 00082 00083 #include <cassert> 00084 00085 00086 00087 class XALAN_DOM_EXPORT XalanDOMString 00088 { 00089 public: 00090 00091 #if defined(XALAN_NO_NAMESPACES) 00092 typedef vector<XalanDOMChar> XalanDOMCharVectorType; 00093 typedef vector<char> CharVectorType; 00094 typedef vector<wchar_t> WideCharVectorType; 00095 #else 00096 typedef std::vector<XalanDOMChar> XalanDOMCharVectorType; 00097 typedef std::vector<char> CharVectorType; 00098 typedef std::vector<wchar_t> WideCharVectorType; 00099 #endif 00100 00101 typedef XalanDOMChar value_type; 00102 typedef XalanDOMChar& reference; 00103 typedef const XalanDOMChar& const_reference; 00104 00105 typedef XalanDOMCharVectorType::size_type size_type; 00106 00107 typedef XalanDOMCharVectorType::iterator iterator; 00108 typedef XalanDOMCharVectorType::const_iterator const_iterator; 00109 typedef XalanDOMCharVectorType::reverse_iterator reverse_iterator; 00110 typedef XalanDOMCharVectorType::const_reverse_iterator const_reverse_iterator; 00111 00112 #if defined(XALAN_INLINE_INITIALIZATION) 00113 static const size_type npos = ~0u; 00114 #else 00115 enum { npos = -1 }; 00116 #endif 00117 00118 explicit 00119 XalanDOMString(); 00120 00121 explicit 00122 XalanDOMString( 00123 const char* theString, 00124 size_type theCount = size_type(npos)); 00125 00126 XalanDOMString( 00127 const XalanDOMString& theSource, 00128 size_type theStartPosition = 0, 00129 size_type theCount = size_type(npos)); 00130 00131 explicit 00132 XalanDOMString( 00133 const XalanDOMChar* theString, 00134 size_type theCount = size_type(npos)); 00135 00136 XalanDOMString( 00137 size_type theCount, 00138 XalanDOMChar theChar); 00139 00140 ~XalanDOMString() 00141 { 00142 } 00143 00144 XalanDOMString& 00145 operator=(const XalanDOMString& theRHS) 00146 { 00147 return assign(theRHS); 00148 } 00149 00150 XalanDOMString& 00151 operator=(const XalanDOMChar* theRHS) 00152 { 00153 return assign(theRHS); 00154 } 00155 00156 XalanDOMString& 00157 operator=(const char* theRHS) 00158 { 00159 return assign(theRHS); 00160 } 00161 00162 XalanDOMString& 00163 operator=(XalanDOMChar theRHS) 00164 { 00165 return assign(1, theRHS); 00166 } 00167 00168 iterator 00169 begin() 00170 { 00171 invariants(); 00172 00173 return m_data.begin(); 00174 } 00175 00176 const_iterator 00177 begin() const 00178 { 00179 invariants(); 00180 00181 return m_data.begin(); 00182 } 00183 00184 iterator 00185 end() 00186 { 00187 invariants(); 00188 00189 return m_data.end(); 00190 } 00191 00192 const_iterator 00193 end() const 00194 { 00195 invariants(); 00196 00197 return m_data.end(); 00198 } 00199 00200 reverse_iterator 00201 rbegin() 00202 { 00203 invariants(); 00204 00205 return m_data.rbegin(); 00206 } 00207 00208 const_reverse_iterator 00209 rbegin() const 00210 { 00211 invariants(); 00212 00213 return m_data.rbegin(); 00214 } 00215 00216 reverse_iterator 00217 rend() 00218 { 00219 invariants(); 00220 00221 return m_data.rend(); 00222 } 00223 00224 const_reverse_iterator 00225 rend() const 00226 { 00227 invariants(); 00228 00229 return m_data.rend(); 00230 } 00231 00232 size_type 00233 size() const 00234 { 00235 invariants(); 00236 00237 return m_size; 00238 } 00239 00240 size_type 00241 length() const 00242 { 00243 invariants(); 00244 00245 return size(); 00246 } 00247 00248 size_type 00249 max_size() const 00250 { 00251 invariants(); 00252 00253 return size_type(~0); 00254 } 00255 00256 void 00257 resize( 00258 size_type theCount, 00259 XalanDOMChar theChar); 00260 00261 void 00262 resize(size_type theCount) 00263 { 00264 invariants(); 00265 00266 resize(theCount, XalanDOMChar(0)); 00267 } 00268 00269 size_type 00270 capacity() const 00271 { 00272 invariants(); 00273 00274 return m_data.capacity() - 1; 00275 } 00276 00277 void 00278 reserve(size_type theCount = 0) 00279 { 00280 invariants(); 00281 00282 m_data.reserve(theCount + 1); 00283 } 00284 00285 void 00286 clear() 00287 { 00288 invariants(); 00289 00290 m_data.erase(m_data.begin(), m_data.end()); 00291 00292 m_size = 0; 00293 00294 invariants(); 00295 } 00296 00297 void 00298 erase( 00299 size_type theStartPosition = 0, 00300 size_type theCount = size_type(npos)); 00301 00302 bool 00303 empty() const 00304 { 00305 invariants(); 00306 00307 return m_size == 0 ? true : false; 00308 } 00309 00310 const_reference 00311 operator[](size_type theIndex) const 00312 { 00313 invariants(); 00314 00315 return m_data[theIndex]; 00316 } 00317 00318 reference 00319 operator[](size_type theIndex) 00320 { 00321 invariants(); 00322 00323 return m_data[theIndex]; 00324 } 00325 00326 #if 0 00327 // $$$ ToDo: at() is not supported in the current version of GCC's vector<> 00328 // implementation. Eventually, it should be. 00329 const_reference 00330 at(size_type theIndex) const 00331 { 00332 invariants(); 00333 00334 return m_data.at(theIndex); 00335 } 00336 00337 reference 00338 at(size_type theIndex) 00339 { 00340 invariants(); 00341 00342 return m_data.at(theIndex); 00343 } 00344 #endif 00345 00346 const XalanDOMChar* 00347 c_str() const 00348 { 00349 invariants(); 00350 00351 // $$$ ToDo: Do we really want to do this? 00352 // for convenience, we will return a pointer to 00353 // a default empty string so that c_str() never 00354 // returns a null pointer... 00355 return m_data.empty() == true ? &s_empty : &m_data[0]; 00356 } 00357 00358 const XalanDOMChar* 00359 data() const 00360 { 00361 invariants(); 00362 00363 return c_str(); 00364 } 00365 00366 void 00367 swap(XalanDOMString& theOther) 00368 { 00369 invariants(); 00370 00371 m_data.swap(theOther.m_data); 00372 00373 #if defined(XALAN_NO_NAMESPACES) 00374 ::swap(m_size, theOther.m_size); 00375 #else 00376 std::swap(m_size, theOther.m_size); 00377 #endif 00378 } 00379 00380 XalanDOMString& 00381 operator+=(const XalanDOMString& theSource) 00382 { 00383 return append(theSource); 00384 } 00385 00386 XalanDOMString& 00387 operator+=(const XalanDOMChar* theString) 00388 { 00389 return append(theString); 00390 } 00391 00392 XalanDOMString& 00393 operator+=(XalanDOMChar theChar) 00394 { 00395 append(1, theChar); 00396 00397 return *this; 00398 } 00399 00400 XalanDOMString& 00401 assign(const XalanDOMChar* theSource) 00402 { 00403 invariants(); 00404 00405 erase(); 00406 00407 invariants(); 00408 00409 return append(theSource); 00410 } 00411 00412 XalanDOMString& 00413 assign( 00414 const XalanDOMChar* theSource, 00415 size_type theCount) 00416 { 00417 invariants(); 00418 00419 erase(); 00420 00421 invariants(); 00422 00423 return append(theSource, theCount); 00424 } 00425 00426 XalanDOMString& 00427 assign(const char* theSource) 00428 { 00429 invariants(); 00430 00431 erase(); 00432 00433 invariants(); 00434 00435 return append(theSource); 00436 } 00437 00438 XalanDOMString& 00439 assign( 00440 const char* theSource, 00441 size_type theCount) 00442 { 00443 invariants(); 00444 00445 erase(); 00446 00447 invariants(); 00448 00449 return append(theSource, theCount); 00450 } 00451 00452 XalanDOMString& 00453 assign( 00454 const XalanDOMString& theSource, 00455 size_type thePosition, 00456 size_type theCount); 00457 00458 XalanDOMString& 00459 assign(const XalanDOMString& theSource) 00460 { 00461 invariants(); 00462 00463 if (&theSource != this) 00464 { 00465 m_data = theSource.m_data; 00466 00467 m_size = theSource.m_size; 00468 } 00469 00470 invariants(); 00471 00472 return *this; 00473 } 00474 00475 XalanDOMString& 00476 assign( 00477 size_type theCount, 00478 XalanDOMChar theChar) 00479 { 00480 invariants(); 00481 00482 erase(); 00483 00484 invariants(); 00485 00486 return append(theCount, theChar); 00487 } 00488 00489 XalanDOMString& 00490 assign( 00491 const_iterator theFirstPosition, 00492 const_iterator theLastPosition); 00493 00494 XalanDOMString& 00495 append(const XalanDOMString& theSource) 00496 { 00497 return append(theSource.c_str(), theSource.length()); 00498 } 00499 00500 XalanDOMString& 00501 append( 00502 const XalanDOMString& theSource, 00503 size_type thePosition, 00504 size_type theCount) 00505 { 00506 assert(thePosition < theSource.length() && 00507 (theCount == size_type(npos) || thePosition + theCount <= theSource.length())); 00508 00509 return append(theSource.c_str() + thePosition, theCount); 00510 } 00511 00512 XalanDOMString& 00513 append( 00514 const XalanDOMChar* theString, 00515 size_type theCount); 00516 00517 XalanDOMString& 00518 append(const XalanDOMChar* theString) 00519 { 00520 return append(theString, length(theString)); 00521 } 00522 00523 XalanDOMString& 00524 append( 00525 const char* theString, 00526 size_type theCount); 00527 00528 XalanDOMString& 00529 append(const char* theString) 00530 { 00531 return append(theString, length(theString)); 00532 } 00533 00534 XalanDOMString& 00535 append( 00536 size_type theCount, 00537 XalanDOMChar theChar); 00538 00539 void 00540 push_back(XalanDOMChar theChar) 00541 { 00542 invariants(); 00543 00544 append(1, theChar); 00545 00546 invariants(); 00547 } 00548 00549 XalanDOMString& 00550 insert( 00551 size_type thePosition, 00552 const XalanDOMString& theString) 00553 { 00554 return insert(thePosition, theString.c_str(), theString.length()); 00555 } 00556 00557 XalanDOMString& 00558 insert( 00559 size_type thePosition1, 00560 const XalanDOMString& theString, 00561 size_type thePosition2, 00562 size_type theCount) 00563 { 00564 return insert(thePosition1, theString.c_str() + thePosition2, theCount); 00565 } 00566 00567 XalanDOMString& 00568 insert( 00569 size_type thePosition, 00570 const XalanDOMChar* theString, 00571 size_type theCount); 00572 00573 XalanDOMString& 00574 insert( 00575 size_type thePosition, 00576 const XalanDOMChar* theString) 00577 { 00578 return insert(thePosition, theString, length(theString)); 00579 } 00580 00581 XalanDOMString& 00582 insert( 00583 size_type thePosition, 00584 size_type theCount, 00585 XalanDOMChar theChar); 00586 00587 iterator 00588 insert( 00589 iterator thePosition, 00590 XalanDOMChar theChar); 00591 00592 void 00593 insert( 00594 iterator thePosition, 00595 size_type theCount, 00596 XalanDOMChar theChar); 00597 00598 void 00599 insert( 00600 iterator theInsertPosition, 00601 const_iterator theFirstPosition, 00602 const_iterator theLastPosition); 00603 00604 XalanDOMString 00605 substr( 00606 size_type thePosition = 0, 00607 size_type theCount = size_type(npos)) const 00608 { 00609 assert(theCount == size_type(npos) && thePosition < length() || 00610 thePosition + theCount <= length()); 00611 00612 invariants(); 00613 00614 return XalanDOMString(*this, thePosition, theCount); 00615 } 00616 00617 XalanDOMString& 00618 substr( 00619 XalanDOMString& theSubstring, 00620 size_type thePosition = 0, 00621 size_type theCount = size_type(npos)) const 00622 { 00623 assert(theCount == size_type(npos) && thePosition < length() || 00624 thePosition + theCount <= length()); 00625 00626 invariants(); 00627 00628 return theSubstring.assign(*this, thePosition, theCount); 00629 } 00630 00631 int 00632 compare(const XalanDOMString& theString) const 00633 { 00634 invariants(); 00635 00636 return compare(theString.c_str()); 00637 } 00638 00639 int 00640 compare( 00641 size_type thePosition1, 00642 size_type theCount1, 00643 const XalanDOMString& theString) const 00644 { 00645 invariants(); 00646 00647 return compare(thePosition1, theCount1, theString.c_str(), theString.length()); 00648 } 00649 00650 int 00651 compare( 00652 size_type thePosition1, 00653 size_type theCount1, 00654 const XalanDOMString& theString, 00655 size_type thePosition2, 00656 size_type theCount2) const 00657 { 00658 invariants(); 00659 00660 return compare(thePosition1, theCount1, theString.c_str() + thePosition2, theCount2); 00661 } 00662 00663 int 00664 compare(const XalanDOMChar* theString) const; 00665 00666 int 00667 compare( 00668 size_type thePosition1, 00669 size_type theCount1, 00670 const XalanDOMChar* theString, 00671 size_type theCount2 = size_type(npos)) const; 00672 00673 int 00674 compare(const char* theString) const 00675 { 00676 invariants(); 00677 00678 return compare(XalanDOMString(theString)); 00679 } 00680 00681 int 00682 compare( 00683 size_type thePosition1, 00684 size_type theCount1, 00685 const char* theString, 00686 size_type theCount2 = size_type(npos)) const 00687 { 00688 invariants(); 00689 00690 return compare(thePosition1, theCount1, XalanDOMString(theString, theCount2)); 00691 } 00692 00693 CharVectorType 00694 transcode() const; 00695 00696 static bool 00697 equals( 00698 const XalanDOMChar* theLHS, 00699 size_type theLHSLength, 00700 const XalanDOMChar* theRHS, 00701 size_type theRHSLength); 00702 00703 static bool 00704 equals( 00705 const XalanDOMChar* theLHS, 00706 const XalanDOMChar* theRHS) 00707 { 00708 return equals(theLHS, length(theLHS), theRHS, length(theRHS)); 00709 } 00710 00711 static bool 00712 equals( 00713 const XalanDOMString& theLHS, 00714 const XalanDOMString& theRHS); 00715 00716 static bool 00717 equals( 00718 const XalanDOMString& theLHS, 00719 const XalanDOMChar* theRHS) 00720 { 00721 return equals(theLHS.c_str(), theRHS); 00722 } 00723 00724 static bool 00725 equals( 00726 const XalanDOMChar* theLHS, 00727 const XalanDOMString& theRHS) 00728 { 00729 return equals(theLHS, theRHS.c_str()); 00730 } 00731 00732 /* 00733 * Helper function to determine the length of a null- 00734 * terminated string. 00735 * 00736 * @theString The string 00737 * @return the length 00738 */ 00739 static size_type 00740 length(const XalanDOMChar* theString); 00741 00742 /* 00743 * Helper function to determine the length of a null- 00744 * terminated string. 00745 * 00746 * @theString The string 00747 * @return the length 00748 */ 00749 static size_type 00750 length(const char* theString); 00751 00752 class TranscodingError : public XalanDOMException 00753 { 00754 public: 00755 00756 TranscodingError() : 00757 XalanDOMException(TRANSCODING_ERR) 00758 { 00759 } 00760 00761 virtual 00762 ~TranscodingError() 00763 { 00764 } 00765 }; 00766 00767 protected: 00768 00769 /* 00770 * Function to assert invariant conditions for the class. 00771 * 00772 * @return the iterator 00773 */ 00774 void 00775 invariants() const 00776 { 00777 #if !defined(NDEBUG) 00778 assert((m_data.empty() == true && m_size == 0) || m_size == m_data.size() - 1); 00779 assert(m_data.empty() == true || m_data.back() == 0); 00780 #endif 00781 } 00782 00783 /* 00784 * Get an iterator to the position of the terminating null. 00785 * 00786 * @return the iterator 00787 */ 00788 iterator 00789 getBackInsertIterator() 00790 { 00791 invariants(); 00792 00793 return m_data.empty() == true ? m_data.end() : m_data.end() - 1; 00794 } 00795 00796 const_iterator 00797 getBackInsertIterator() const 00798 { 00799 invariants(); 00800 00801 return m_data.empty() == true ? m_data.end() : m_data.end() - 1; 00802 } 00803 00804 iterator 00805 getIteratorForPosition(size_type thePosition) 00806 { 00807 invariants(); 00808 00809 return m_data.begin() + thePosition; 00810 } 00811 00812 const_iterator 00813 getIteratorForPosition(size_type thePosition) const 00814 { 00815 invariants(); 00816 00817 return m_data.begin() + thePosition; 00818 } 00819 00820 private: 00821 00822 XalanDOMCharVectorType m_data; 00823 00824 size_type m_size; 00825 00826 static const XalanDOMChar s_empty; 00827 }; 00828 00829 00830 00831 inline bool 00832 operator==( 00833 const XalanDOMString& theLHS, 00834 const XalanDOMString& theRHS) 00835 { 00836 return XalanDOMString::equals(theLHS, theRHS); 00837 } 00838 00839 00840 00841 inline bool 00842 operator==( 00843 const XalanDOMString& theLHS, 00844 const XalanDOMChar* theRHS) 00845 { 00846 return XalanDOMString::equals(theLHS, theRHS); 00847 } 00848 00849 00850 00851 inline bool 00852 operator==( 00853 const XalanDOMChar* theLHS, 00854 const XalanDOMString& theRHS) 00855 { 00856 // Note reversing of operands... 00857 return XalanDOMString::equals(theLHS, theRHS); 00858 } 00859 00860 00861 00862 inline bool 00863 operator!=( 00864 const XalanDOMString& theLHS, 00865 const XalanDOMString& theRHS) 00866 { 00867 return !(theLHS == theRHS); 00868 } 00869 00870 00871 00872 inline bool 00873 operator!=( 00874 const XalanDOMChar* theLHS, 00875 const XalanDOMString& theRHS) 00876 { 00877 return !(theLHS == theRHS); 00878 } 00879 00880 00881 00882 inline bool 00883 operator!=( 00884 const XalanDOMString& theLHS, 00885 const XalanDOMChar* theRHS) 00886 { 00887 return !(theRHS == theLHS); 00888 } 00889 00890 00891 00892 inline XalanDOMString 00893 operator+( 00894 const XalanDOMString& theLHS, 00895 const XalanDOMString& theRHS) 00896 { 00897 XalanDOMString theTemp(theLHS); 00898 00899 return theTemp += theRHS; 00900 } 00901 00902 00903 00904 inline XalanDOMString 00905 operator+( 00906 const XalanDOMString& theLHS, 00907 const XalanDOMChar* theRHS) 00908 { 00909 XalanDOMString theTemp(theLHS); 00910 00911 return theTemp += theRHS; 00912 } 00913 00914 00915 00916 inline XalanDOMString 00917 operator+( 00918 const XalanDOMChar* theLHS, 00919 const XalanDOMString& theRHS) 00920 { 00921 XalanDOMString theTemp(theLHS); 00922 00923 return theTemp += theRHS; 00924 } 00925 00926 00927 00928 inline const XalanDOMString 00929 operator+( 00930 const char* theLHS, 00931 const XalanDOMString& theRHS) 00932 { 00933 return XalanDOMString(theLHS) + theRHS; 00934 } 00935 00936 00937 00938 inline const XalanDOMString 00939 operator+( 00940 const XalanDOMString& theLHS, 00941 const char* theRHS) 00942 { 00943 return theLHS + XalanDOMString(theRHS); 00944 } 00945 00946 00947 00948 // Standard vector of XalanDOMChars and chars 00949 #if defined(XALAN_NO_NAMESPACES) 00950 typedef vector<XalanDOMChar> XalanDOMCharVectorType; 00951 00952 typedef vector<char> CharVectorType; 00953 #else 00954 typedef std::vector<XalanDOMChar> XalanDOMCharVectorType; 00955 00956 typedef std::vector<char> CharVectorType; 00957 #endif 00958 00959 00960 00972 XALAN_DOM_EXPORT_FUNCTION(bool) 00973 TranscodeToLocalCodePage( 00974 const XalanDOMChar* theSourceString, 00975 XalanDOMString::size_type theSourceStringLength, 00976 CharVectorType& targetVector, 00977 bool terminate = false); 00978 00979 00980 00991 XALAN_DOM_EXPORT_FUNCTION(bool) 00992 TranscodeToLocalCodePage( 00993 const XalanDOMChar* theSourceString, 00994 CharVectorType& targetVector, 00995 bool terminate = false); 00996 00997 00998 01007 inline const CharVectorType 01008 TranscodeToLocalCodePage(const XalanDOMChar* theSourceString) 01009 { 01010 CharVectorType theResult; 01011 01012 TranscodeToLocalCodePage(theSourceString, theResult, true); 01013 01014 return theResult; 01015 } 01016 01017 01018 01028 inline bool 01029 TranscodeToLocalCodePage( 01030 const XalanDOMString& theSourceString, 01031 CharVectorType& targetVector, 01032 bool terminate = false) 01033 { 01034 return TranscodeToLocalCodePage(theSourceString.c_str(), targetVector, terminate); 01035 } 01036 01037 01038 01047 inline const CharVectorType 01048 TranscodeToLocalCodePage(const XalanDOMString& theSourceString) 01049 { 01050 CharVectorType theResult; 01051 01052 TranscodeToLocalCodePage(theSourceString, theResult, true); 01053 01054 return theResult; 01055 } 01056 01057 01058 01067 inline const XalanDOMString 01068 TranscodeFromLocalCodePage( 01069 const char* theSourceString, 01070 XalanDOMString::size_type theSourceStringLength = XalanDOMString::npos) 01071 { 01072 return XalanDOMString(theSourceString, theSourceStringLength); 01073 } 01074 01075 01076 01088 XALAN_DOM_EXPORT_FUNCTION(bool) 01089 TranscodeFromLocalCodePage( 01090 const char* theSourceString, 01091 XalanDOMString::size_type theSourceStringLength, 01092 XalanDOMCharVectorType& theTargetVector, 01093 bool terminate = false); 01094 01095 01096 01107 XALAN_DOM_EXPORT_FUNCTION(bool) 01108 TranscodeFromLocalCodePage( 01109 const char* theSourceString, 01110 XalanDOMCharVectorType& theTargetVector, 01111 bool terminate = false); 01112 01113 01114 01122 inline const XalanDOMString 01123 TranscodeFromLocalCodePage(const CharVectorType& theSourceString) 01124 { 01125 typedef XalanDOMString::size_type size_type; 01126 01127 const CharVectorType::size_type theSize = theSourceString.size(); 01128 01129 if (theSourceString[theSize - 1] == CharVectorType::value_type(0)) 01130 { 01131 return TranscodeFromLocalCodePage(&*theSourceString.begin(), size_type(theSize) - 1); 01132 } 01133 else 01134 { 01135 return TranscodeFromLocalCodePage(&*theSourceString.begin(), size_type(theSize)); 01136 } 01137 } 01138 01139 01140 01141 #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.4 |
|