fixes to build with gcc 3.2.2 and libstdc++ on Linux

This commit is contained in:
jez_higgins 2003-04-04 09:26:23 +00:00
parent 34c84383a2
commit 4b3a9684aa
6 changed files with 50 additions and 41 deletions

View file

@ -25,24 +25,28 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>,
typedef Unicode<charT> UnicodeT;
private:
typedef basic_LexicalHandler<stringT> LexicalHandlerT;
typedef typename XMLReaderT::InputSourceT InputSourceT;
typedef typename XMLReaderT::PropertyBase PropertyBase;
public:
basic_Writer(ostreamT& stream) :
lexicalHandler_(0),
indent_(2),
stream_(&stream),
inCDATA_(false),
inDTD_(false)
inDTD_(false),
indent_(2),
depth_(0),
stream_(&stream),
lexicalHandler_(0)
{
} // basic_Writer
basic_Writer(ostreamT& stream, XMLReaderT& parent) :
XMLFilterT(parent),
lexicalHandler_(0),
indent_(2),
stream_(&stream),
inCDATA_(false),
inDTD_(false)
inDTD_(false),
indent_(2),
depth_(0),
stream_(&stream),
lexicalHandler_(0)
{
} // basic_Writer
@ -99,45 +103,49 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>,
escaper(ostreamT* stream) : stream_(stream) { }
void operator()(charT ch)
{
switch(ch)
if(ch == UnicodeT::LESS_THAN_SIGN)
{
case UnicodeT::LESS_THAN_SIGN:
*stream_ << UnicodeT::AMPERSAND
<< UnicodeT::LOWERCASE_L
<< UnicodeT::LOWERCASE_T
<< UnicodeT::SEMI_COLON;
break;
case UnicodeT::GREATER_THAN_SIGN:
return;
} // if(ch == UnicodeT::LESS_THAN_SIGN)
if(ch == UnicodeT::GREATER_THAN_SIGN)
{
*stream_ << UnicodeT::AMPERSAND
<< UnicodeT::LOWERCASE_G
<< UnicodeT::LOWERCASE_T
<< UnicodeT::SEMI_COLON;
break;
case UnicodeT::AMPERSAND:
return;
} // if(ch == UnicodeT::GREATER_THAN_SIGN)
if(ch == UnicodeT::AMPERSAND)
{
*stream_ << UnicodeT::AMPERSAND
<< UnicodeT::LOWERCASE_A
<< UnicodeT::LOWERCASE_M
<< UnicodeT::LOWERCASE_P
<< UnicodeT::SEMI_COLON;
break;
case UnicodeT::QUOTATION_MARK:
return;
} // if(ch == case UnicodeT::AMPERSAND)
if(ch == UnicodeT::QUOTATION_MARK)
{
*stream_ << UnicodeT::AMPERSAND
<< UnicodeT::LOWERCASE_Q
<< UnicodeT::LOWERCASE_U
<< UnicodeT::LOWERCASE_O
<< UnicodeT::LOWERCASE_T
<< UnicodeT::SEMI_COLON;
break;
default:
return;
} // if(ch == UnicodeT::QUOTATION_MARK)
*stream_ << ch;
} // switch
} // operator()
private:
ostreamT* stream_;
}; // escaper
typedef typename escaper<charT, traitsT> escaperT;
}; // class basic_Writer
template<class string_type>
@ -195,7 +203,7 @@ void basic_Writer<string_type>::startElement(
<< UnicodeT::EQUALS_SIGN
<< UnicodeT::QUOTATION_MARK;
stringT value = atts.getValue(i);
std::for_each(value.begin(), value.end(), escaperT(stream_));
std::for_each(value.begin(), value.end(), escaper<charT, traitsT>(stream_));
*stream_ << UnicodeT::QUOTATION_MARK;
}
@ -225,7 +233,7 @@ template<class string_type>
void basic_Writer<string_type>::characters(const stringT& ch)
{
if(!inCDATA_)
std::for_each(ch.begin(), ch.end(), escaperT(stream_));
std::for_each(ch.begin(), ch.end(), escaper<charT, traitsT>(stream_));
else
*stream_ << ch;
@ -285,20 +293,20 @@ bool basic_Writer<string_type>::isDtd(const string_type& name)
} // isDtd
template<class string_type>
std::auto_ptr<basic_Writer<string_type>::XMLReaderT::PropertyBase> basic_Writer<string_type>::doGetProperty(const string_type& name)
std::auto_ptr<typename basic_Writer<string_type>::PropertyBase> basic_Writer<string_type>::doGetProperty(const string_type& name)
{
if(name == properties_.lexicalHandler)
{
XMLReaderT::Property<LexicalHandlerT*>* prop =
new XMLReaderT::Property<LexicalHandlerT*>(lexicalHandler_);
return std::auto_ptr<XMLReaderT::PropertyBase>(prop);
return std::auto_ptr<PropertyBase>(prop);
}
return XMLFilterT::doGetProperty(name);
} // doGetProperty
template<class string_type>
void basic_Writer<string_type>::doSetProperty(const string_type& name, std::auto_ptr<basic_Writer<string_type>::XMLReaderT::PropertyBase> value)
void basic_Writer<string_type>::doSetProperty(const string_type& name, std::auto_ptr<typename basic_Writer<string_type>::PropertyBase> value)
{
if(name == properties_.lexicalHandler)
{

View file

@ -47,13 +47,13 @@ LDFLAGS += -O2
# Includes and library directories
INCS_DIRS = -I.. -I/usr/local/include/stlport -I/opt/gnome2/include/libxml2
INCS_DIRS = -I..
#INCS_DIRS = -I..
LIBS_DIRS =
STATIC_LIBS =
DYNAMIC_LIBS = -lstlport_gcc -L/opt/gnome2/lib -lxml2
DYNAMIC_LIBS = -lstdc++
CXXFLAGS += ${INCS_DIRS}
LDFLAGS += ${DYNAMIC_LIBS}

View file

@ -47,13 +47,13 @@ LDFLAGS += -O2
# Includes and library directories
INCS_DIRS = -I.. -I/usr/local/include/stlport -I/opt/gnome2/include/libxml2
INCS_DIRS = -I..
#INCS_DIRS = -I..
LIBS_DIRS =
STATIC_LIBS =
DYNAMIC_LIBS = -lstlport_gcc -L/opt/gnome2/lib -lxml2
DYNAMIC_LIBS = -lstdc++
CXXFLAGS += ${INCS_DIRS}
LDFLAGS += ${DYNAMIC_LIBS}

View file

@ -40,20 +40,20 @@ CCDEPFLAGS = -E -M
# Uncomment for optimisations
CXXFLAGS += -O2
LDFLAGS += -O2 -L../../bin -lstlport_gcc -lSAX -lArabicaUtils -lxml2
LDFLAGS += -O2 -lSAX -lArabicaUtils
# Uncomment for debug version
# CXXFLAGS += -g -D__DEBUG__
# Includes and library directories
INCS_DIRS = -I../.. -I/usr/local/include/stlport -I/opt/gnome2/include/libxml2
INCS_DIRS = -I../..
#INCS_DIRS = -I..
LIBS_DIRS =
STATIC_LIBS =
DYNAMIC_LIBS = -L../../bin -L/opt/gnome2/lib -lstlport_gcc -lSAX -lxml2
DYNAMIC_LIBS = -L../../bin -lSAX -lexpat
CXXFLAGS += ${INCS_DIRS}
LDFLAGS += ${DYNAMIC_LIBS}

View file

@ -9,14 +9,14 @@ using namespace std;
void TextTestResult::addError (Test *test, CppUnitException *e)
{
TestResult::addError (test, e);
cerr << "E\n";
cerr << "E" << endl;
}
void TextTestResult::addFailure (Test *test, CppUnitException *e)
{
TestResult::addFailure (test, e);
cerr << "F\n";
cerr << "F" << endl;
}

View file

@ -40,20 +40,20 @@ CCDEPFLAGS = -E -M
# Uncomment for optimisations
CXXFLAGS += -O2
LDFLAGS += -O2 -L../../bin -lstlport_gcc -lSAX -lArabicaUtils -lxml2
LDFLAGS += -O2 -L../../bin -lSAX -lArabicaUtils
# Uncomment for debug version
# CXXFLAGS += -g -D__DEBUG__
CXXFLAGS += -g -D__DEBUG__
# Includes and library directories
INCS_DIRS = -I../.. -I/usr/local/include/stlport -I/opt/gnome2/include/libxml2
INCS_DIRS = -I../..
#INCS_DIRS = -I..
LIBS_DIRS =
STATIC_LIBS =
DYNAMIC_LIBS = -L../../bin -L/opt/gnome2/lib -lstlport_gcc -lSAX -lxml2
DYNAMIC_LIBS = -L../../bin -lSAX -lexpat
CXXFLAGS += ${INCS_DIRS}
LDFLAGS += ${DYNAMIC_LIBS}
@ -61,6 +61,7 @@ LDFLAGS += ${DYNAMIC_LIBS}
#/////////////////////////////////////////////////////////////////////////
#//////////////////////////////////////////////
# Source files
SAXDOM_SRCS = main.cpp test_Attribute.cpp test_Document.cpp test_DocumentFragment.cpp test_DocumentType.cpp test_DOMImplementation.cpp test_Element.cpp test_ProcessingInstruction.cpp test_Siblings.cpp test_SAX.cpp
SAXDOM_HDRS = $(patsubst %.cpp,%.h,$(SAXDOM_SRCS))
SAXDOM_OBJS = $(patsubst %.cpp,%.o,$(SAXDOM_SRCS))
@ -112,7 +113,7 @@ depend : .depend
# Cleaning up
clean :
$(REMOVE) .depend *.o core sax2dom_test ../../bin/sax2dom_test
$(REMOVE) .depend $(CPPUNITUI_OBJS) $(CPPUNITFW_OBJS) $(SAXDOM_OBJS) core sax2dom_test ../../bin/sax2dom_test
#/////////////////////////////////////////////////////////////////////////