Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:01

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_STRINGTOKEN_HPP)
0023 #define XERCESC_INCLUDE_GUARD_STRINGTOKEN_HPP
0024 
0025 // ---------------------------------------------------------------------------
0026 //  Includes
0027 // ---------------------------------------------------------------------------
0028 #include <xercesc/util/regx/Token.hpp>
0029 #include <xercesc/util/XMLString.hpp>
0030 
0031 XERCES_CPP_NAMESPACE_BEGIN
0032 
0033 class XMLUTIL_EXPORT StringToken : public Token {
0034 public:
0035     // -----------------------------------------------------------------------
0036     //  Public Constructors and Destructor
0037     // -----------------------------------------------------------------------
0038     StringToken(const tokType tkType,
0039                 const XMLCh* const literal,
0040                 const int refNo,
0041                 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0042     ~StringToken();
0043 
0044     // -----------------------------------------------------------------------
0045     //  Getter methods
0046     // -----------------------------------------------------------------------
0047     int getReferenceNo() const;
0048     const XMLCh* getString() const;
0049 
0050     // -----------------------------------------------------------------------
0051     //  Setter methods
0052     // -----------------------------------------------------------------------
0053     void setString(const XMLCh* const literal);
0054 
0055 private:
0056     // -----------------------------------------------------------------------
0057     //  Unimplemented constructors and operators
0058     // -----------------------------------------------------------------------
0059     StringToken(const StringToken&);
0060     StringToken& operator=(const StringToken&);
0061 
0062     // -----------------------------------------------------------------------
0063     //  Private data members
0064     // -----------------------------------------------------------------------
0065     int    fRefNo;
0066     XMLCh* fString;
0067     MemoryManager* fMemoryManager;
0068 };
0069 
0070 
0071 // ---------------------------------------------------------------------------
0072 //  StringToken: getter methods
0073 // ---------------------------------------------------------------------------
0074 inline int StringToken::getReferenceNo() const {
0075 
0076     return fRefNo;
0077 }
0078 
0079 inline const XMLCh* StringToken::getString() const {
0080 
0081     return fString;
0082 }
0083 
0084 // ---------------------------------------------------------------------------
0085 //  StringToken: Setter methods
0086 // ---------------------------------------------------------------------------
0087 inline void StringToken::setString(const XMLCh* const literal) {
0088 
0089     fMemoryManager->deallocate(fString);//delete [] fString;
0090     fString = 0;
0091     fString = XMLString::replicate(literal, fMemoryManager);
0092 }
0093 
0094 XERCES_CPP_NAMESPACE_END
0095 
0096 #endif
0097 
0098 /**
0099   * End of file StringToken.hpp
0100   */