Source: libfolia Source-Version: 1.6-2 Severity: important Tags: patch Usertags: icu63
Dear Maintainer, ICU 63.1 recently released, packaged and uploaded to experimental. Its transition is going to start soon. However your package fails to build with this version. I attach a patch which fixes the problem. Please check if it works with the version in Sid and upload the package when it's feasible for you. Thanks, Laszlo/GCS
Description: fix FTBFS with ICU 63.1 Add icu namespace. Author: Laszlo Boszormenyi (GCS) <g...@debian.org> Last-Update: 2018-11-07 --- --- libfolia-1.6.orig/include/libfolia/folia_document.h +++ libfolia-1.6/include/libfolia/folia_document.h @@ -56,7 +56,7 @@ namespace folia { Pattern( const std::vector<std::string>&, const std::string& ); ~Pattern(); - bool match( const UnicodeString& , size_t&, int&, bool&, bool& ) const; + bool match( const icu::UnicodeString& , size_t&, int&, bool&, bool& ) const; size_t size() const { return sequence.size(); }; void unsetwild(); bool variablesize() const; @@ -66,8 +66,8 @@ namespace folia { private: bool case_sensitive; int maxgapsize; - std::vector<UnicodeString> sequence; - std::vector<RegexMatcher*> matchers; + std::vector<icu::UnicodeString> sequence; + std::vector<icu::RegexMatcher*> matchers; std::string matchannotationset; }; @@ -105,7 +105,7 @@ namespace folia { void set_foreign_metadata( xmlNode * ); void addStyle( const std::string&, const std::string& ); void replaceStyle( const std::string&, const std::string& ); - UnicodeString text( const std::string& = "current", + icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const; std::vector<Paragraph*> paragraphs() const; --- libfolia-1.6.orig/include/libfolia/folia_impl.h +++ libfolia-1.6/include/libfolia/folia_impl.h @@ -272,12 +272,12 @@ namespace folia { bool hastext( const std::string& = "current" ) const; virtual const std::string str( const std::string& = "current" ) const = 0; - const UnicodeString unicode( const std::string& cls = "current" ) const { return text( cls ); }; - virtual const UnicodeString text( const std::string& = "current", + const icu::UnicodeString unicode( const std::string& cls = "current" ) const { return text( cls ); }; + virtual const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const = 0; - const UnicodeString stricttext( const std::string& = "current" ) const; - const UnicodeString toktext( const std::string& = "current" ) const; - virtual const UnicodeString phon( const std::string& = "current", + const icu::UnicodeString stricttext( const std::string& = "current" ) const; + const icu::UnicodeString toktext( const std::string& = "current" ) const; + virtual const icu::UnicodeString phon( const std::string& = "current", bool = false ) const = 0; virtual bool printable() const = 0; virtual bool speakable() const = 0; @@ -337,8 +337,8 @@ namespace folia { virtual TextContent *textcontent( const std::string& = "current" ) const = 0; TextContent *settext( const std::string&, const std::string& = "current" ); TextContent *settext( const std::string&, int , const std::string& = "current" ); - TextContent *setutext( const UnicodeString&, const std::string& = "current" ); - TextContent *setutext( const UnicodeString&, int , const std::string& = "current" ); + TextContent *setutext( const icu::UnicodeString&, const std::string& = "current" ); + TextContent *setutext( const icu::UnicodeString&, int , const std::string& = "current" ); virtual int offset() const NOT_IMPLEMENTED; // PhonContent @@ -410,7 +410,7 @@ namespace folia { virtual const std::string content() const NOT_IMPLEMENTED; virtual const std::string src() const NOT_IMPLEMENTED; - virtual const UnicodeString caption() const NOT_IMPLEMENTED; + virtual const icu::UnicodeString caption() const NOT_IMPLEMENTED; virtual std::vector<FoliaElement *> resolve() const NOT_IMPLEMENTED; virtual const FoliaElement* resolveid() const NOT_IMPLEMENTED; virtual bool checkAtts() = 0; @@ -563,14 +563,14 @@ namespace folia { // text/string content const std::string str( const std::string& = "current" ) const; - const UnicodeString text( const std::string& = "current", + const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const; - const UnicodeString phon( const std::string& = "current", + const icu::UnicodeString phon( const std::string& = "current", bool = false ) const; - const UnicodeString deeptext( const std::string& = "current", + const icu::UnicodeString deeptext( const std::string& = "current", bool = false ) const; - const UnicodeString deepphon( const std::string& = "current" ) const; + const icu::UnicodeString deepphon( const std::string& = "current" ) const; // Word const Word* resolveword( const std::string& ) const { return 0; }; @@ -693,7 +693,7 @@ namespace folia { const std::string& cls = "current" ) { return e->str( cls ); } - inline const UnicodeString text( const FoliaElement *e, + inline const icu::UnicodeString text( const FoliaElement *e, const std::string& cls = "current" ) { if ( e ) return e->text( cls ); @@ -701,7 +701,7 @@ namespace folia { throw ValueError( "text() for empty element" ); } - inline const UnicodeString unicode( const FoliaElement *e ) { + inline const icu::UnicodeString unicode( const FoliaElement *e ) { return e->unicode(); } inline bool isinstance( const FoliaElement *e, ElementType t ) { @@ -917,7 +917,7 @@ namespace folia { void setAttributes( const KWargs& ); KWargs collectAttributes() const; - const UnicodeString text( const std::string& = "current", + const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const; private: static properties PROPS; @@ -975,7 +975,7 @@ namespace folia { FoliaImpl(PROPS,d){ classInit( a ); } void setAttributes( const KWargs& ); KWargs collectAttributes() const; - const UnicodeString phon( const std::string& = "current", + const icu::UnicodeString phon( const std::string& = "current", bool = false ) const; int offset() const { return _offset; }; private: @@ -991,7 +991,7 @@ namespace folia { FoliaImpl( PROPS,d) { classInit(); } FoLiA( const KWargs& a, Document *d = 0 ): FoliaImpl( PROPS, d ) { classInit( a ); } - const UnicodeString text( const std::string& = "current", + const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const; private: static properties PROPS; @@ -1127,7 +1127,7 @@ namespace folia { AbstractStructureElement( PROPS, d ){ classInit(); }; Linebreak( const KWargs& a, Document *d = 0 ): AbstractStructureElement( PROPS, d ){ classInit( a ); }; - const UnicodeString text( const std::string& = "current", + const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const { return "\n"; } @@ -1149,7 +1149,7 @@ namespace folia { Whitespace( const KWargs& a, Document *d = 0 ): AbstractStructureElement( PROPS, d ){ classInit( a ); } - const UnicodeString text( const std::string& = "current", + const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const { return "\n\n"; } @@ -1366,7 +1366,7 @@ namespace folia { AbstractStructureElement( PROPS, d ){ classInit( a ); } const std::string src() const { return _src; }; - const UnicodeString caption() const; + const icu::UnicodeString caption() const; private: static properties PROPS; }; @@ -2120,7 +2120,7 @@ namespace folia { xmlNode *xml( bool, bool=false ) const; bool setvalue( const std::string& s ) { _value = s; return true; }; const std::string& getTextDelimiter( bool ) const { return EMPTY_STRING; }; - const UnicodeString text( const std::string& = "current", + const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const; private: static properties PROPS; @@ -2246,7 +2246,7 @@ namespace folia { FoliaElement *getCurrent( size_t ) const; std::vector<Suggestion*> suggestions() const; Suggestion *suggestions( size_t ) const; - const UnicodeString text( const std::string& = "current", + const icu::UnicodeString text( const std::string& = "current", bool = false, bool = false ) const; TextContent *textcontent( const std::string& = "current" ) const; PhonContent *phoncontent( const std::string& = "current" ) const; --- libfolia-1.6.orig/include/libfolia/folia_utils.h +++ libfolia-1.6/include/libfolia/folia_utils.h @@ -104,8 +104,8 @@ namespace folia { NoDefaultError( const std::string& s ): std::runtime_error( "No Default found: " + s ){}; }; - UnicodeString UTF8ToUnicode( const std::string& ); - std::string UnicodeToUTF8( const UnicodeString& ); + icu::UnicodeString UTF8ToUnicode( const std::string& ); + std::string UnicodeToUTF8( const icu::UnicodeString& ); std::string toString( const AnnotationType::AnnotationType& ); AnnotationType::AnnotationType stringToAT( const std::string& ); --- libfolia-1.6.orig/src/folia_document.cxx +++ libfolia-1.6/src/folia_document.cxx @@ -403,7 +403,7 @@ namespace folia { throw range_error( "Document index out of range" ); } - UnicodeString Document::text( const std::string& cls, + icu::UnicodeString Document::text( const std::string& cls, bool retaintok, bool strict ) const { return foliadoc->text( cls, retaintok, strict ); @@ -1304,7 +1304,7 @@ namespace folia { bool goon = true; for ( size_t i = startpos; i < mywords.size() && goon ; ++i ){ // cerr << "inner LOOP I = " << i << " myword=" << mywords[i] << endl; - UnicodeString value; + icu::UnicodeString value; if ( pat.matchannotation == BASE ) value = mywords[i]->text(); else { @@ -1432,9 +1432,9 @@ namespace folia { if ( pat.find( "regexp('" ) == 0 && pat.rfind( "')" ) == pat.length()-2 ){ string tmp = pat.substr( 8, pat.length() - 10 ); - UnicodeString us = UTF8ToUnicode( tmp ); + icu::UnicodeString us = UTF8ToUnicode( tmp ); UErrorCode u_stat = U_ZERO_ERROR; - RegexMatcher *matcher = new RegexMatcher(us, 0, u_stat); + icu::RegexMatcher *matcher = new icu::RegexMatcher(us, 0, u_stat); if ( U_FAILURE(u_stat) ){ throw runtime_error( "failed to create a regexp matcher with '" + tmp + "'" ); } @@ -1469,9 +1469,9 @@ namespace folia { if ( pat.find( "regexp('" ) == 0 && pat.rfind( "')" ) == pat.length()-2 ){ string tmp = pat.substr( 8, pat.length() - 10 ); - UnicodeString us = UTF8ToUnicode( tmp ); + icu::UnicodeString us = UTF8ToUnicode( tmp ); UErrorCode u_stat = U_ZERO_ERROR; - RegexMatcher *matcher = new RegexMatcher(us, 0, u_stat); + icu::RegexMatcher *matcher = new icu::RegexMatcher(us, 0, u_stat); if ( U_FAILURE(u_stat) ){ throw runtime_error( "failed to create a regexp matcher with '" + tmp + "'" ); } @@ -1500,9 +1500,9 @@ namespace folia { return os; } - bool Pattern::match( const UnicodeString& us, size_t& pos, int& gap, + bool Pattern::match( const icu::UnicodeString& us, size_t& pos, int& gap, bool& done, bool& flag ) const { - UnicodeString s = us; + icu::UnicodeString s = us; // cerr << "gap = " << gap << "cursor=" << pos << " vergelijk '" << sequence[pos] << "' met '" << us << "'" << endl; if ( matchers[pos] ){ matchers[pos]->reset( s ); --- libfolia-1.6.orig/src/folia_impl.cxx +++ libfolia-1.6/src/folia_impl.cxx @@ -773,7 +773,7 @@ namespace folia { // if this is a PhonContent or it may contain PhonContent // then return the associated phon() // otherwise fallback to the tagname. - UnicodeString us; + icu::UnicodeString us; try { us = text(cls); } @@ -859,10 +859,10 @@ namespace folia { return _props.TEXTDELIMITER; } - const UnicodeString FoliaImpl::text( const string& cls, + const icu::UnicodeString FoliaImpl::text( const string& cls, bool retaintok, bool strict ) const { - // get the UnicodeString value of underlying elements + // get the icu::UnicodeString value of underlying elements // default cls="current" #ifdef DEBUG_TEXT cerr << "TEXT(" << cls << ") op node : " << xmltag() << " id ( " << id() << ")" << endl; @@ -872,7 +872,7 @@ namespace folia { } else if ( element_id() == TextContent_t || element_id() == AbstractTextMarkup_t ){ // TEXTCONTAINER property - UnicodeString result; + icu::UnicodeString result; for ( const auto& d : data ){ if ( !result.isEmpty() ){ const string& delim = d->getTextDelimiter( retaintok ); @@ -889,7 +889,7 @@ namespace folia { throw NoSuchText( "NON printable element: " + xmltag() ); } else { - UnicodeString result = deeptext( cls, retaintok ); + icu::UnicodeString result = deeptext( cls, retaintok ); if ( result.isEmpty() ) { result = stricttext( cls ); } @@ -900,13 +900,13 @@ namespace folia { } } - const UnicodeString FoLiA::text( const string& cls, + const icu::UnicodeString FoLiA::text( const string& cls, bool retaintok, bool strict ) const { #ifdef DEBUG_TEXT cerr << "FoLiA::TEXT(" << cls << ")" << endl; #endif - UnicodeString result; + icu::UnicodeString result; for ( const auto& d : data ){ if ( !result.isEmpty() ){ const string& delim = d->getTextDelimiter( retaintok ); @@ -920,20 +920,20 @@ namespace folia { return result; } - UnicodeString trim_space( const UnicodeString& in ){ - UnicodeString cmp = " "; + icu::UnicodeString trim_space( const icu::UnicodeString& in ){ + icu::UnicodeString cmp = " "; // cerr << "in = '" << in << "'" << endl; - UnicodeString out; + icu::UnicodeString out; int i = 0; for( ; i < in.length(); ++i ){ - // cerr << "start: bekijk:" << UnicodeString(in[i]) << endl; + // cerr << "start: bekijk:" << icu::UnicodeString(in[i]) << endl; if ( in[i] != cmp[0] ){ break; } } int j = in.length()-1; for( ; j >= 0; --j ){ - // cerr << "end: bekijk:" << UnicodeString(in[j]) << endl; + // cerr << "end: bekijk:" << icu::UnicodeString(in[j]) << endl; if ( in[j] != cmp[0] ){ break; } @@ -944,12 +944,12 @@ namespace folia { // cerr << "out = LEEG" << endl; return out; } - out = UnicodeString( in, i, j-i+1 ); + out = icu::UnicodeString( in, i, j-i+1 ); // cerr << "out = '" << out << "'" << endl; return out; } - bool check_end( const UnicodeString& us, bool& only ){ + bool check_end( const icu::UnicodeString& us, bool& only ){ only = false; string tmp = UnicodeToUTF8( us ); int j = tmp.length()-1; @@ -966,9 +966,9 @@ namespace folia { return found_nl > 0; } - const UnicodeString FoliaImpl::deeptext( const string& cls, + const icu::UnicodeString FoliaImpl::deeptext( const string& cls, bool retaintok ) const { - // get the UnicodeString value of underlying elements + // get the icu::UnicodeString value of underlying elements // default cls="current" #ifdef DEBUG_TEXT cerr << "deepTEXT(" << cls << ") op node : " << xmltag() << " id(" << id() << ")" << endl; @@ -976,8 +976,8 @@ namespace folia { #ifdef DEBUG_TEXT cerr << "deeptext: node has " << data.size() << " children." << endl; #endif - vector<UnicodeString> parts; - vector<UnicodeString> seps; + vector<icu::UnicodeString> parts; + vector<icu::UnicodeString> seps; for ( const auto& child : data ) { // try to get text dynamically from children // skip TextContent elements @@ -991,7 +991,7 @@ namespace folia { cerr << "deeptext:bekijk node[" << child->xmltag() << "]"<< endl; #endif try { - UnicodeString tmp = child->text( cls, retaintok, false ); + icu::UnicodeString tmp = child->text( cls, retaintok, false ); #ifdef DEBUG_TEXT cerr << "deeptext found '" << tmp << "'" << endl; #endif @@ -1018,7 +1018,7 @@ namespace folia { } // now construct the result; - UnicodeString result; + icu::UnicodeString result; for ( size_t i=0; i < parts.size(); ++i ) { #ifdef DEBUG_TEXT cerr << "part[" << i << "]='" << parts[i] << "'" << endl; @@ -1066,14 +1066,14 @@ namespace folia { return result; } - const UnicodeString FoliaElement::stricttext( const string& cls ) const { - // get UnicodeString content of TextContent children only + const icu::UnicodeString FoliaElement::stricttext( const string& cls ) const { + // get icu::UnicodeString content of TextContent children only // default cls="current" return this->text(cls, false, true ); } - const UnicodeString FoliaElement::toktext( const string& cls ) const { - // get UnicodeString content of TextContent children only + const icu::UnicodeString FoliaElement::toktext( const string& cls ) const { + // get icu::UnicodeString content of TextContent children only // default cls="current" return this->text(cls, true, false ); } @@ -1133,9 +1133,9 @@ namespace folia { //#define DEBUG_PHON - const UnicodeString FoliaImpl::phon( const string& cls, + const icu::UnicodeString FoliaImpl::phon( const string& cls, bool strict ) const { - // get the UnicodeString value of underlying elements + // get the icu::UnicodeString value of underlying elements // default cls="current" #ifdef DEBUG_PHON cerr << "PHON(" << cls << ") op node : " << xmltag() << " id ( " << id() << ")" << endl; @@ -1147,7 +1147,7 @@ namespace folia { throw NoSuchText( "NON speakable element: " + xmltag() ); } else { - UnicodeString result = deepphon( cls ); + icu::UnicodeString result = deepphon( cls ); if ( result.isEmpty() ) { result = phoncontent(cls)->phon(); } @@ -1158,8 +1158,8 @@ namespace folia { } } - const UnicodeString FoliaImpl::deepphon( const string& cls ) const { - // get the UnicodeString value of underlying elements + const icu::UnicodeString FoliaImpl::deepphon( const string& cls ) const { + // get the icu::UnicodeString value of underlying elements // default cls="current" #ifdef DEBUG_PHON cerr << "deepPHON(" << cls << ") op node : " << xmltag() << " id(" << id() << ")" << endl; @@ -1167,8 +1167,8 @@ namespace folia { #ifdef DEBUG_PHON cerr << "deepphon: node has " << data.size() << " children." << endl; #endif - vector<UnicodeString> parts; - vector<UnicodeString> seps; + vector<icu::UnicodeString> parts; + vector<icu::UnicodeString> seps; for ( const auto& child : data ) { // try to get text dynamically from children // skip TextContent elements @@ -1182,7 +1182,7 @@ namespace folia { cerr << "deepphon:bekijk node[" << child->xmltag() << "]" << endl; #endif try { - UnicodeString tmp = child->phon( cls, false ); + icu::UnicodeString tmp = child->phon( cls, false ); #ifdef DEBUG_PHON cerr << "deepphon found '" << tmp << "'" << endl; #endif @@ -1202,7 +1202,7 @@ namespace folia { } // now construct the result; - UnicodeString result; + icu::UnicodeString result; for ( size_t i=0; i < parts.size(); ++i ) { result += parts[i]; if ( i < parts.size()-1 ) { @@ -1276,7 +1276,7 @@ namespace folia { return node; } - TextContent *FoliaElement::setutext( const UnicodeString& txt, + TextContent *FoliaElement::setutext( const icu::UnicodeString& txt, const string& cls ) { // create a TextContent child of class 'cls' // Default cls="current" @@ -1300,7 +1300,7 @@ namespace folia { return node; } - TextContent *FoliaElement::setutext( const UnicodeString& txt, + TextContent *FoliaElement::setutext( const icu::UnicodeString& txt, int offset, const string& cls ) { // create a TextContent child of class 'cls' @@ -2179,14 +2179,14 @@ namespace folia { return result; } - const UnicodeString PhonContent::phon( const string& cls, + const icu::UnicodeString PhonContent::phon( const string& cls, bool ) const { - // get the UnicodeString value of underlying elements + // get the icu::UnicodeString value of underlying elements // default cls="current" #ifdef DEBUG_PHON cerr << "PhonContent::PHON(" << cls << ") " << endl; #endif - UnicodeString result; + icu::UnicodeString result; for ( const auto& el : data ) { // try to get text dynamically from children #ifdef DEBUG_PHON @@ -2196,7 +2196,7 @@ namespace folia { #ifdef DEBUG_PHON cerr << "roep text(" << cls << ") aan op " << el << endl; #endif - UnicodeString tmp = el->text( cls ); + icu::UnicodeString tmp = el->text( cls ); #ifdef DEBUG_PHON cerr << "PhonContent found '" << tmp << "'" << endl; #endif @@ -3193,7 +3193,7 @@ namespace folia { Word::setAttributes( args ); } - const UnicodeString Figure::caption() const { + const icu::UnicodeString Figure::caption() const { vector<FoliaElement *> v = select(Caption_t); if ( v.empty() ) { throw NoSuchText("caption"); @@ -3414,7 +3414,7 @@ namespace folia { return this; } - const UnicodeString Correction::text( const string& cls, + const icu::UnicodeString Correction::text( const string& cls, bool retaintok, bool ) const { #ifdef DEBUG_TEXT @@ -3653,7 +3653,7 @@ namespace folia { return 0; } - const UnicodeString XmlText::text( const string&, bool, bool ) const { + const icu::UnicodeString XmlText::text( const string&, bool, bool ) const { return UTF8ToUnicode(_value); } @@ -3991,7 +3991,7 @@ namespace folia { FoliaImpl::setAttributes( argl ); } - const UnicodeString TextMarkupCorrection::text( const string& cls, + const icu::UnicodeString TextMarkupCorrection::text( const string& cls, bool ret, bool strict ) const{ if ( cls == "original" ) { --- libfolia-1.6.orig/src/folia_utils.cxx +++ libfolia-1.6/src/folia_utils.cxx @@ -44,11 +44,11 @@ using namespace TiCC; namespace folia { - UnicodeString UTF8ToUnicode( const string& s ){ - return UnicodeString::fromUTF8( s ); + icu::UnicodeString UTF8ToUnicode( const string& s ){ + return icu::UnicodeString::fromUTF8( s ); } - string UnicodeToUTF8( const UnicodeString& s ){ + string UnicodeToUTF8( const icu::UnicodeString& s ){ string result; s.toUTF8String(result); return result;