## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.6

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XalanDOMString.hpp

Go to the documentation of this file.

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

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.6 Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.