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

View file

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

View file

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

View file

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

View file

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

View file

@ -40,20 +40,20 @@ CCDEPFLAGS = -E -M
# Uncomment for optimisations # Uncomment for optimisations
CXXFLAGS += -O2 CXXFLAGS += -O2
LDFLAGS += -O2 -L../../bin -lstlport_gcc -lSAX -lArabicaUtils -lxml2 LDFLAGS += -O2 -L../../bin -lSAX -lArabicaUtils
# Uncomment for debug version # Uncomment for debug version
# CXXFLAGS += -g -D__DEBUG__ CXXFLAGS += -g -D__DEBUG__
# Includes and library directories # Includes and library directories
INCS_DIRS = -I../.. -I/usr/local/include/stlport -I/opt/gnome2/include/libxml2 INCS_DIRS = -I../..
#INCS_DIRS = -I.. #INCS_DIRS = -I..
LIBS_DIRS = LIBS_DIRS =
STATIC_LIBS = STATIC_LIBS =
DYNAMIC_LIBS = -L../../bin -L/opt/gnome2/lib -lstlport_gcc -lSAX -lxml2 DYNAMIC_LIBS = -L../../bin -lSAX -lexpat
CXXFLAGS += ${INCS_DIRS} CXXFLAGS += ${INCS_DIRS}
LDFLAGS += ${DYNAMIC_LIBS} 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_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_HDRS = $(patsubst %.cpp,%.h,$(SAXDOM_SRCS))
SAXDOM_OBJS = $(patsubst %.cpp,%.o,$(SAXDOM_SRCS)) SAXDOM_OBJS = $(patsubst %.cpp,%.o,$(SAXDOM_SRCS))
@ -112,7 +113,7 @@ depend : .depend
# Cleaning up # Cleaning up
clean : clean :
$(REMOVE) .depend *.o core sax2dom_test ../../bin/sax2dom_test $(REMOVE) .depend $(CPPUNITUI_OBJS) $(CPPUNITFW_OBJS) $(SAXDOM_OBJS) core sax2dom_test ../../bin/sax2dom_test
#///////////////////////////////////////////////////////////////////////// #/////////////////////////////////////////////////////////////////////////