-/*
- * Copyright 2001-2009 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
*/
/**
#include <xmltooling/base.h>
+#ifndef HAVE_GOOD_STL
+# include <xmltooling/char_traits.h>
+#endif
+
#include <string>
#include <iostream>
#include <xercesc/util/XMLString.hpp>
namespace xmltooling {
- #ifdef HAVE_GOOD_STL
+#ifdef HAVE_GOOD_STL
/**
* An STL string type that supports 16-bit Unicode.
- * Most compilers support this, but various versions of gcc3 do not.
*/
typedef std::basic_string<XMLCh> xstring;
- #endif
+#else
+ /**
+ * An STL string type that supports 16-bit Unicode.
+ */
+ typedef std::basic_string< XMLCh,char_traits<XMLCh> > xstring;
+#endif
/**
* Transcodes a 16-bit Unicode string into UTF-8.
extern XMLTOOL_API std::ostream& operator<<(std::ostream& ostr, const XMLCh* s);
/**
+ * Writes a Unicode string to an ASCII stream by transcoding to UTF8.
+ *
+ * @param ostr stream to write to
+ * @param s string to write
+ * @return reference to output stream
+ */
+ extern XMLTOOL_API std::ostream& operator<<(std::ostream& ostr, const xstring& s);
+
+ /**
* A minimal auto_ptr-like class that can copy or transcode a buffer into
* the local code page and free the result automatically.
*
/**
* Default constructor.
*/
- auto_ptr_char() : m_buf(NULL) {
+ auto_ptr_char() : m_buf(nullptr) {
}
/**
* @return a null-terminated local code page string
*/
char* release() {
- char* temp=m_buf; m_buf=NULL; return temp;
+ char* temp=m_buf; m_buf=nullptr; return temp;
}
private:
/**
* Default constructor.
*/
- auto_ptr_XMLCh() : m_buf(NULL) {
+ auto_ptr_XMLCh() : m_buf(nullptr) {
}
/**
* @return a null-terminated Unicode string
*/
XMLCh* release() {
- XMLCh* temp=m_buf; m_buf=NULL; return temp;
+ XMLCh* temp=m_buf; m_buf=nullptr; return temp;
}
private:
* @return the wrapped pointer
*/
T* release() {
- T* temp=m_ptr; m_ptr=NULL; return temp;
+ T* temp=m_ptr; m_ptr=nullptr; return temp;
}
};
};