vc6 compatibility fixes

This commit is contained in:
jez_higgins 2006-06-08 09:51:18 +00:00
parent c1a9672d3a
commit 625c7141e1
18 changed files with 74 additions and 125 deletions

View file

@ -25,6 +25,9 @@ class Parser : protected SAX::basic_DefaultHandler2<stringT>
{
typedef SAX::basic_EntityResolver<stringT> EntityResolverT;
typedef SAX::basic_ErrorHandler<stringT> ErrorHandlerT;
typedef SAX::basic_LexicalHandler<stringT> LexicalHandlerT;
typedef SAX::basic_DeclHandler<stringT> DeclHandlerT;
typedef SAX::basic_InputSource<stringT> InputSourceT;
typedef SimpleDOM::EntityImpl<stringT, string_adaptorT> EntityT;
typedef SimpleDOM::NotationImpl<stringT, string_adaptorT> NotationT;
typedef SimpleDOM::ElementImpl<stringT, string_adaptorT> ElementT;
@ -65,11 +68,11 @@ class Parser : protected SAX::basic_DefaultHandler2<stringT>
bool parse(const stringT& systemId)
{
SAX::basic_InputSource<stringT> is(systemId);
InputSourceT is(systemId);
return parse(is);
} // loadDOM
bool parse(SAX::basic_InputSource<stringT>& source)
bool parse(InputSourceT& source)
{
SAX::PropertyNames<stringT, string_adaptorT> pNames;
@ -85,8 +88,8 @@ class Parser : protected SAX::basic_DefaultHandler2<stringT>
if(entityResolver_)
parser.setEntityResolver(*entityResolver_);
setParserProperty<SAX::basic_LexicalHandler<stringT> >(parser, pNames.lexicalHandler);
setParserProperty<SAX::basic_DeclHandler<stringT> >(parser, pNames.declHandler);
setParserProperty<LexicalHandlerT>(parser, pNames.lexicalHandler);
setParserProperty<DeclHandlerT>(parser, pNames.declHandler);
setParserFeatures(parser);

View file

@ -26,7 +26,7 @@ class AttrNSImpl : public AttrImpl<stringT, string_adaptorT>
stringT const* prefix_for_checking = (&ownerDoc->empty_string());
size_type index = string_adaptorT::find(qualifiedName, string_adaptorT::construct_from_utf8(":"));
if(index == string_adaptorT::npos)
if(index == string_adaptorT::npos())
{ //qualifiedName contains no ':'
localName_ = AttrT::ownerDoc_->stringPool(qualifiedName);
if(*localName_ == string_adaptorT::construct_from_utf8("xmlns"))

View file

@ -24,7 +24,7 @@ class ElementNSImpl : public ElementImpl<stringT, string_adaptorT>
bool hasPrefix = false;
size_type index = string_adaptorT::find(qualifiedName, string_adaptorT::construct_from_utf8(":"));
if(index == string_adaptorT::npos)
if(index == string_adaptorT::npos())
{ //qualifiedName contains no ':'
localName_ = ElementImplT::ownerDoc_->stringPool(qualifiedName);
}

View file

@ -22,7 +22,7 @@ std::pair<bool, stringT> checkPrefixAndNamespace(bool hasPrefix,
if(!hasPrefix)
return std::make_pair(hasNamespaceURI, namespaceURI);
if(string_adaptorT::find(prefix, string_adaptorT::construct_from_utf8(":")) != string_adaptorT::npos)
if(string_adaptorT::find(prefix, string_adaptorT::construct_from_utf8(":")) != string_adaptorT::npos())
throw DOM::DOMException(DOM::DOMException::NAMESPACE_ERR);
if(prefix == xml)

View file

@ -488,8 +488,8 @@ BuildCmds= \
InputPath=.\ParserConfig.S
BuildCmds= \
cl /TC /D USE_EXPAT /EP ParserConfig.S > ParserConfig.h \
cl /TC /D USE_EXPAT /EP saxlib.S > saxlib.cpp \
cl /TC /D USE_XERCES /EP ParserConfig.S > ParserConfig.h \
cl /TC /D USE_XERCES /EP saxlib.S > saxlib.cpp \
"ParserConfig.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"

View file

@ -754,8 +754,8 @@
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
CommandLine="cl /TC /D USE_MSXML /EP ParserConfig.S &gt; ParserConfig.h
cl /TC /D USE_MSXML /EP saxlib.S &gt; saxlib.cpp
CommandLine="cl /TC /D USE_XERCES /EP ParserConfig.S &gt; ParserConfig.h
cl /TC /D USE_XERCES /EP saxlib.S &gt; saxlib.cpp
"
Outputs="ParserConfig.h;saxlib.cpp"/>
</FileConfiguration>

View file

@ -222,7 +222,7 @@ class basic_NamespaceSupport
Parts name;
typename string_adaptorT::size_type index = string_adaptorT::find(qName, nsc_.colon);
if(index == string_adaptorT::npos)
if(index == string_adaptorT::npos())
{
// no prefix
name.URI = getURI(stringT());

View file

@ -321,7 +321,7 @@ public:
{
stringT prefix;
int n = attQName.find(NamespaceSupportT::COLON);
if(n != stringT::npos)
if(n != stringT::npos())
prefix = stringT(attQName.begin() + n + 1, attQName.end());
if(!nsSupport_.declarePrefix(prefix, value))
reportError("Illegal Namespace prefix " + makeString(prefix));

View file

@ -90,7 +90,7 @@ private:
static const stringT SCHEME_MARKER = string_adaptorT::construct_from_utf8("://");
static const valueT FORWARD_SLASH = string_adaptorT::convert_from_utf8(Arabica::Unicode<char>::SLASH);
if(location.find(SCHEME_MARKER) != stringT::npos)
if(location.find(SCHEME_MARKER) != stringT::npos())
return location;
std::ostringstream ss;

View file

@ -649,7 +649,7 @@ void expat_wrapper<stringT, T0, T1>::startElement(const char* qName, const char*
{
stringT prefix;
typename SA::size_type n = SA::find(attQName, nsc_.colon);
if(n != SA::npos)
if(n != SA::npos())
prefix = SA::construct(SA::begin(attQName) + n + 1, SA::end(attQName));
if(!nsSupport_.declarePrefix(prefix, value))
reportError(std::string("Illegal Namespace prefix ") + SA::asStdString(prefix));

View file

@ -535,7 +535,7 @@ void libxml2_wrapper<stringT, T0, T1>::SAXstartElement(const xmlChar* qName, con
{
stringT prefix;
typename string_adaptorT::size_type n = string_adaptorT::find(attQName, nsc_.colon);
if(n != string_adaptorT::npos)
if(n != string_adaptorT::npos())
prefix = string_adaptorT::construct(string_adaptorT::begin(attQName) + n + 1, string_adaptorT::end(attQName));
if(!nsSupport_.declarePrefix(prefix, value))
reportError(std::string("Illegal Namespace prefix ") + string_adaptorT::asStdString(prefix));

View file

@ -317,7 +317,7 @@ class xerces_wrapper : public SAX::basic_ProgressiveParser<string_type>
if(!locator_)
return string_type();
return SA::makeStringT(locator_->getPublicId());
return xerces_string_adaptor::makeStringT(locator_->getPublicId());
} // getPublicId
string_type getSystemId() const

View file

@ -26,7 +26,10 @@ public:
typedef typename string_type::value_type value_type;
typedef typename string_type::size_type size_type;
static const typename string_type::size_type npos = static_cast<typename string_type::size_type>(-1);
static size_type npos()
{
return static_cast<size_type>(-1);
}
//todo: is this safe?
template<class InputIterator>
@ -93,6 +96,7 @@ public:
}; // class default_string_adaptor_base
// specialize for std::string and std::wstring
template<>
class default_string_adaptor<std::string> :

View file

@ -126,7 +126,7 @@ public:
std::use_facet<std::codecvt<charT, fromCharT, typename traitsT::state_type> >(this->getloc());
#else
const std::codecvt<charT, fromCharT, traitsT::state_type>& cvt =
std::use_facet(stringbuf_.getloc(), (std::codecvt<charT, fromCharT, traitsT::state_type>*)0, true);
std::use_facet(convertstreambuf_initT::buf()->getloc(), (std::codecvt<charT, fromCharT, traitsT::state_type>*)0, true);
#endif
if(cvt.always_noconv())

View file

@ -294,7 +294,7 @@ public:
const ExecutionContext<string_type, string_adaptor>& executionContext) const
{
return new BoolValue<string_type, string_adaptor>(string_adaptor::find(baseT::argAsString(0, context, executionContext),
baseT::argAsString(1, context, executionContext)) != string_adaptor::npos);
baseT::argAsString(1, context, executionContext)) != string_adaptor::npos());
} // evaluate
}; // class ContainsFn
@ -312,7 +312,7 @@ public:
string_type value = baseT::argAsString(0, context, executionContext);
size_t splitAt = string_adaptor::find(value, baseT::argAsString(1, context, executionContext));
if(splitAt == string_adaptor::npos)
if(splitAt == string_adaptor::npos())
return new StringValue<string_type, string_adaptor>("");
return new StringValue<string_type, string_adaptor>(string_adaptor::substr(value, 0, splitAt));
@ -334,7 +334,7 @@ public:
string_type split = baseT::argAsString(1, context, executionContext);
size_t splitAt = string_adaptor::find(value, split);
if((splitAt == string_adaptor::npos) || ((splitAt + string_adaptor::length(split)) >= string_adaptor::length(value)))
if((splitAt == string_adaptor::npos()) || ((splitAt + string_adaptor::length(split)) >= string_adaptor::length(value)))
return new StringValue<string_type, string_adaptor>("");
return new StringValue<string_type, string_adaptor>(string_adaptor::substr(value, splitAt + string_adaptor::length(split)));
@ -438,7 +438,7 @@ public:
for(typename string_adaptor::mutable_iterator i = string_adaptor::begin(str), ie = string_adaptor::end(str); i != ie; ++i)
{
size_t r = string_adaptor::find(from, *i);
if(r == string_adaptor::npos)
if(r == string_adaptor::npos())
++p;
else if(r < string_adaptor::length(to))
*p++ = *(string_adaptor::begin(to) + r);

View file

@ -93,59 +93,7 @@ SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=.\test_Attribute.cpp
# End Source File
# Begin Source File
SOURCE=.\test_Document.cpp
# End Source File
# Begin Source File
SOURCE=.\test_DocumentFragment.cpp
# End Source File
# Begin Source File
SOURCE=.\test_DocumentType.cpp
# End Source File
# Begin Source File
SOURCE=.\test_DOMImplementation.cpp
# End Source File
# Begin Source File
SOURCE=.\test_Element.cpp
# End Source File
# Begin Source File
SOURCE=.\test_ProcessingInstruction.cpp
# End Source File
# Begin Source File
SOURCE=.\test_SAX.cpp
# End Source File
# Begin Source File
SOURCE=.\test_Siblings.cpp
# End Source File
# Begin Source File
SOURCE=..\CppUnit\framework\TestCase.cpp
# End Source File
# Begin Source File
SOURCE=..\CppUnit\framework\TestFailure.cpp
# End Source File
# Begin Source File
SOURCE=..\CppUnit\framework\TestResult.cpp
# End Source File
# Begin Source File
SOURCE=..\CppUnit\framework\TestSuite.cpp
# End Source File
# Begin Source File
SOURCE=..\CppUnit\textui\TextTestResult.cpp
SOURCE=..\silly_string\silly_string.cpp
# End Source File
# End Group
# Begin Group "Header Files"
@ -153,6 +101,26 @@ SOURCE=..\CppUnit\textui\TextTestResult.cpp
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\silly_string\silly_string.hpp
# End Source File
# Begin Source File
SOURCE=.\test_SAX.h
# End Source File
# End Group
# Begin Group "Libs"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\lib\Arabica.lib
# End Source File
# End Group
# Begin Group "CppUnit"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\CppUnit\framework\CppUnitException.h
# End Source File
# Begin Source File
@ -169,71 +137,43 @@ SOURCE=..\CppUnit\framework\Test.h
# End Source File
# Begin Source File
SOURCE=.\test_Attribute.h
# End Source File
# Begin Source File
SOURCE=.\test_Document.h
# End Source File
# Begin Source File
SOURCE=.\test_DocumentFragment.h
# End Source File
# Begin Source File
SOURCE=.\test_DocumentType.h
# End Source File
# Begin Source File
SOURCE=.\test_DOMImplementation.h
# End Source File
# Begin Source File
SOURCE=.\test_Element.h
# End Source File
# Begin Source File
SOURCE=.\test_Notation.h
# End Source File
# Begin Source File
SOURCE=.\test_ProcessingInstruction.h
# End Source File
# Begin Source File
SOURCE=.\test_SAX.h
# End Source File
# Begin Source File
SOURCE=.\test_Siblings.h
# End Source File
# Begin Source File
SOURCE=.\CppUnit\framework\TestCaller.h
# End Source File
# Begin Source File
SOURCE=..\CppUnit\framework\TestCase.cpp
# End Source File
# Begin Source File
SOURCE=.\CppUnit\framework\TestCase.h
# End Source File
# Begin Source File
SOURCE=..\CppUnit\framework\TestFailure.cpp
# End Source File
# Begin Source File
SOURCE=.\CppUnit\framework\TestFailure.h
# End Source File
# Begin Source File
SOURCE=..\CppUnit\framework\TestResult.cpp
# End Source File
# Begin Source File
SOURCE=.\CppUnit\framework\TestResult.h
# End Source File
# Begin Source File
SOURCE=.\CppUnit\framework\TestSuite.h
SOURCE=..\CppUnit\framework\TestSuite.cpp
# End Source File
# End Group
# Begin Group "Libs"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\lib\Arabica.lib
SOURCE=.\CppUnit\framework\TestSuite.h
# End Source File
# Begin Source File
SOURCE=..\CppUnit\textui\TextTestResult.cpp
# End Source File
# End Group
# End Target

View file

@ -30,8 +30,6 @@ silly_string& silly_string::operator=(const silly_string& rhs)
////////////////////////////////////////
////////////////////////////////////////
const silly_string_adaptor::size_type silly_string_adaptor::npos = std::string::npos;
char silly_string_adaptor::convert_from_utf8(char c)
{
return c;

View file

@ -33,7 +33,11 @@ public:
typedef std::string::iterator mutable_iterator;
typedef char value_type;
typedef std::string::size_type size_type;
static const size_type npos;
static size_type npos()
{
return std::string::npos;
}
template<class InputIterator>
static silly_string construct(InputIterator from, InputIterator to)