diff options
author | Release Engineers <releng@openoffice.org> | 2009-05-07 06:54:56 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2009-05-07 06:54:56 +0000 |
commit | a9b42eca2761225f18aa887bda26326965fe8c60 (patch) | |
tree | 60115b758981b91fa4cabe03d53f92fb74376af5 /xml2cmp/source | |
parent | 4758f1c28393e096a9347931910d52f7bea5082c (diff) |
CWS-TOOLING: integrate CWS cmcfixes58
2009-05-04 13:51:10 +0200 cmc r271450 : #i101533# latest sw warnings
2009-05-04 00:02:46 +0200 cmc r271436 : #i101517# silence new warnings
2009-05-03 23:13:53 +0200 cmc r271435 : #i101305# add that one back in
2009-05-02 16:30:42 +0200 cmc r271431 : #i101493# get it to build, and remove some warnings
2009-05-02 16:12:37 +0200 cmc r271430 : CWS-TOOLING: rebase CWS cmcfixes58 to trunk@271427 (milestone: DEV300:m47)
2009-04-23 13:19:33 +0200 cmc r271163 : #i101305# remove annoying import foo is unused warnings
2009-04-21 17:10:34 +0200 cmc r271048 : #i101246# remove AVMEDIA_MANAGER_SERVICE_NAME defines again
2009-04-21 17:07:41 +0200 cmc r271047 : #i86323# remove xml2cmp unused methods
Diffstat (limited to 'xml2cmp/source')
-rw-r--r-- | xml2cmp/source/support/sistr.cxx | 422 | ||||
-rw-r--r-- | xml2cmp/source/support/sistr.hxx | 62 | ||||
-rw-r--r-- | xml2cmp/source/xcd/cr_html.cxx | 10 | ||||
-rw-r--r-- | xml2cmp/source/xcd/cr_html.hxx | 2 |
4 files changed, 0 insertions, 496 deletions
diff --git a/xml2cmp/source/support/sistr.cxx b/xml2cmp/source/support/sistr.cxx index c8277f7b8d5f..db14ef57bce0 100644 --- a/xml2cmp/source/support/sistr.cxx +++ b/xml2cmp/source/support/sistr.cxx @@ -63,42 +63,6 @@ Simstr::Simstr(const char * str_) } } -Simstr::Simstr(const char * txt, int anzahl) -{ - int txtlen = txt != 0 ? strlen(txt) : 0; - if (txt == 0 || anzahl < 1 || long(anzahl) * txtlen > INT_MAX) - { - len = 0; - sz = new char[1]; - *sz = 0; - } - else - { - len = anzahl * txtlen; - sz = new char[len+1]; - for (int i = 0; i < anzahl; i++) - memcpy(sz + (i*txtlen), txt, txtlen); - sz[len] = 0; - } -} - -Simstr::Simstr(char c, int anzahl) -{ - if (anzahl < 1) - { - len = 0; - sz = new char[1]; - *sz = 0; - } - else - { - len = anzahl; - sz = new char[len+1]; - memset(sz,c,anzahl); - sz[len] = 0; - } -} - Simstr::Simstr( const char * anybytes, int firstBytesPos, int nrOfBytes) @@ -149,18 +113,6 @@ Simstr::~Simstr() delete [] sz; } -char & -Simstr::ch(int n) -{ - static char nullCh = NULCH; - nullCh = NULCH; - if (n >= long(len) || n < 0) - return nullCh; - else - return sz[unsigned(n)]; -} - - Simstr Simstr::operator+(const Simstr & S) const { @@ -208,98 +160,9 @@ Simstr::operator>=(const Simstr & S) const // ************** LIST - Funktionen ***************** - -// Einzelzugriff - -char -Simstr::get(int n) const { return (n >= len || n < 0) ? 0 : sz[n]; } - -char -Simstr::get_front() const { return sz[0]; } - -char -Simstr::get_back() const { return len ? sz[len-1] : 0; } - -Simstr -Simstr::get(int startPos, int anzahl) const -{ - if (startPos >= len || startPos < 0 || anzahl < 1) - return ""; - - int anz = len - startPos < anzahl ? len - startPos : anzahl; - - Simstr ret(' ',anz); - memcpy(ret.sz, sz+startPos, anz); - return ret; -} - -Simstr -Simstr::get_front(int anzahl) const -{ - int anz = len < anzahl ? len : anzahl; - if (anz < 1) - return ""; - - Simstr ret(' ',anz); - memcpy(ret.sz, sz, anz); - return ret; -} - -Simstr -Simstr::get_back(int anzahl) const -{ - int anz = len < anzahl ? len : anzahl; - if (anz < 1) - return ""; - int start = len-anz; - - Simstr ret(' ',anz); - memcpy(ret.sz, sz+start, anz); - return ret; -} - -Simstr -Simstr::get_first_token(char c) const -{ - int posc = pos_first(c); - if (posc != NO_POS) - return get_front(posc); - else - return sz; -} - -Simstr -Simstr::get_last_token(char c) const -{ - int posc = pos_last(c); - if (posc != NO_POS) - return get_back(len-posc-1); - else - return sz; -} - - - // Insert void -Simstr::insert(int pos, char c) -{ - if (pos < 0 || pos > len) - return; - - char * result = new char[len+2]; - - memcpy(result,sz,pos); - result[pos] = c; - memcpy(result+pos+1,sz+pos,len-pos+1); - - delete [] sz; - sz = result; - len++; -} - -void Simstr::push_front(char c) { char * result = new char[len+2]; @@ -327,23 +190,6 @@ Simstr::push_back(char c) } void -Simstr::insert(int pos, const Simstr & S) -{ - if (pos < 0 || pos > len) - return; - - char * result = new char[len+1+S.len]; - - memcpy(result,sz,pos); - memcpy(result+pos,S.sz,S.len); - memcpy(result+pos+S.len,sz+pos,len-pos+1); - - delete [] sz; - sz = result; - len += S.len; -} - -void Simstr::push_front(const Simstr & S) { char * result = new char[len+1+S.len]; @@ -400,167 +246,6 @@ Simstr::remove_trailing_blanks() remove ( newlen+1, len-newlen); } -void -Simstr::pop_front(int anzahl) -{ - if (anzahl < 1) - return; - int anz = len < anzahl ? len : anzahl; - - char * result = new char[len-anz+1]; - - memcpy(result,sz+anz,len-anz+1); - - delete [] sz; - sz = result; - len -= anz; -} - -void -Simstr::pop_back(int anzahl) -{ - if (anzahl < 1) - return; - - int anz = len < anzahl ? len : anzahl; - - char * result = new char[len-anz+1]; - - memcpy(result,sz,len-anz); - result[len-anz] = 0; - - delete [] sz; - sz = result; - len -= anz; -} - -void -Simstr::rem_back_from(int removeStartPos) -{ - if (removeStartPos != NO_POS) - pop_back(len-removeStartPos); -} - -void -Simstr::remove_all(char c) -{ - if (!len) - return; - char * result = new char[len]; - int i,j=0; - for (i = 0; i < len; i++) - if (sz[i] != c) - result[j++] = sz[i]; - - delete [] sz; - sz = new char[j+1]; - memcpy(sz,result,j); - sz[j] = 0; - len = j; - delete [] result; -} - -void -Simstr::remove_all(const Simstr & S) -{ - int pos; - while ( (pos=pos_first(S)) != NO_POS ) - remove(pos,S.len); -} - -void -Simstr::strip(char c) -{ - int start = 0; - if (c == ' ') - { // Sonderbehandlung: SPC entfernt auch TABs: - while ( start < len - ? sz[start] == ' ' - || sz[start] == '\t' - : false ) - start++; - } - else - { - while (start < len && sz[start] == c) - start++; - } - - int ende = len-1; - if (c == ' ') - { // Sonderbehandlung: SPC entfernt auch TABs: - while ( ende >= start - ? sz[ende] == ' ' - || sz[ende] == '\t' - : false ) - ende--; - } - else - { - while (ende >= start && sz[ende] == c) - ende--; - } - *this = get(start,ende-start+1); -} - -void -Simstr::empty() -{ - if (len > 0) - { - delete [] sz; - sz = new char[1]; - *sz = 0; - len = 0; - } -} - -Simstr -Simstr::take_first_token(char c) -{ - Simstr ret; - int pos = pos_first(c); - if (pos != NO_POS) - { - ret = get_front(pos); - pop_front(pos+1); - } - else - { - ret = sz; - delete [] sz; - sz = new char[1]; - *sz = NULCH; - len = 0; - } - - return ret; -} - -Simstr -Simstr::take_last_token(char c) -{ - Simstr ret; - int pos = pos_last(c); - if (pos != NO_POS) - { - ret = get_back(len-pos-1); - pop_back(len-pos); - } - else - { - ret = sz; - delete [] sz; - sz = new char[1]; - *sz = NULCH; - len = 0; - } - - return ret; -} - - - // Find int @@ -575,21 +260,6 @@ Simstr::pos_first(char c) const } int -Simstr::pos_first_after( char c, - int startSearchPos) const -{ - int i = 0; - if (startSearchPos >= i) - i = startSearchPos+1; - for (; i < len ? sz[i] != c : false; i++) ; - if (i >= len) - return NO_POS; - else - return i; -} - - -int Simstr::pos_last(char c) const { int i = 0; @@ -600,43 +270,6 @@ Simstr::pos_last(char c) const return i; } -int -Simstr::pos_first(const Simstr & S) const -{ - char * ptr = strstr(sz,S.sz); - if (ptr) - return int(ptr-sz); - else - return NO_POS; -} - -int -Simstr::pos_last(const Simstr & S) const -{ - Simstr vgl; - int i; - for (i = len-S.len; i >= 0 ; i--) - { - vgl = get(i,S.len); - if (vgl == S) - break; - } - if (i >= 0) - return i; - else - return NO_POS; -} - -int -Simstr::count(char c) const -{ - int ret = 0; - for (int i =0; i < len; i++) - if (sz[i] == c) - ret++; - return ret; -} - bool Simstr::is_no_text() const { @@ -653,34 +286,6 @@ Simstr::is_no_text() const // Change void -Simstr::replace(int pos, char c) -{ - if (pos < 0 || pos >= len) - return; - else - sz[unsigned(pos)] = c; -} - -void -Simstr::replace(int startPos, int anzahl, const Simstr & S) -{ - if (startPos >= len || startPos < 0 || anzahl < 1) - return; - - int anz = len - startPos < anzahl ? len - startPos : anzahl; - - char * result = new char[len-anz+S.len+1]; - - memcpy(result,sz,startPos); - memcpy(result+startPos, S.sz, S.len); - memcpy(result+startPos+S.len, sz+startPos+anz, len-startPos-anz+1); - - delete [] sz; - sz = result; - len = len-anz+S.len; -} - -void Simstr::replace_all(char oldCh, char newCh) { for (int i=0; i < len; i++) @@ -688,33 +293,6 @@ Simstr::replace_all(char oldCh, char newCh) sz[i] = newCh; } -void -Simstr::replace_all(const Simstr & oldS, const Simstr & newS) -{ - Simstr vgl; - int i = 0; - while (i <= len-oldS.len) - { - vgl = get(i,oldS.len); - if (strcmp(vgl.sz,oldS.sz) == 0) - { - replace(i,oldS.len,newS); - i += newS.len; - } - else - i++; - } -} - -void -Simstr::to_lower() -{ - for (int i = 0; i < len; i++) - sz[i] = (char) tolower(sz[i]); -} - - - // Simstr addition Simstr operator+(const char * str, const Simstr & S) diff --git a/xml2cmp/source/support/sistr.hxx b/xml2cmp/source/support/sistr.hxx index f48d2e63f9e9..ab5abdac9608 100644 --- a/xml2cmp/source/support/sistr.hxx +++ b/xml2cmp/source/support/sistr.hxx @@ -39,12 +39,6 @@ class Simstr // Constructors, destructor, '=' and typecasts Simstr( const char * str = 0); - Simstr( // Creates Simstr of 'anzahl' times 'txt'. - const char * txt, - int anzahl); - Simstr( - char c, // Creates Simstr of 'anzahl' times 'c'. - int anzahl); Simstr( // Creates Simstr out of a copy of the described bytes within 'anyBytes'. // Adds a '\0' at the end. const char * anybytes, @@ -63,8 +57,6 @@ class Simstr // nevertheless THAT WILL BE NOT CHANGED! // Typecasts to 'const char*' are performed automatically. int l() const; // Length of string without '\0' at end. - char & ch( int n); // Reference to sz[n]. Allows change of this char. - // !!! No safety, if n is out of the allowed range! Simstr operator+( const Simstr & S) const; Simstr & operator+=( @@ -86,25 +78,11 @@ class Simstr // 'List of characters' - functions - // get - functions - char get( int n) const; - char get_front() const; - char get_back() const; - Simstr get( int startPos, - int anzahl) const; - Simstr get_front( - int anzahl) const; - Simstr get_back( - int anzahl) const; // insert - functions - void insert( int pos, - char c); void push_front( char c); void push_back( char c); - void insert( int pos, - const Simstr & S); void push_front( const Simstr & S); void push_back( @@ -114,64 +92,24 @@ class Simstr int pos, int anzahl = 1); void remove_trailing_blanks(); - void pop_front( - int anzahl = 1); - void pop_back( - int anzahl = 1); - void rem_back_from( - int removeStartPos); - void remove_all( - char c); - void remove_all( // Starts search left. - const Simstr & S); - void strip(char c); // Removes all characters == c from front and back. - // c == ' ' removes also TABs !!! - void empty(); // Changes object to the value "". // search functions int pos_first( char c) const; - int pos_first_after( // Sucht ab erstem char nach startSearchPos - char c, - int startSearchPos) const; int pos_last( char c) const; - int pos_first( - const Simstr & S) const; - int pos_last( - const Simstr & S) const; - int count( - char c) const; bool is_empty() const; // Only true if object == "". bool is_no_text() const; // String may contain spaces or tabs. // substitution functions - void replace( - int pos, - char c); - void replace( - int startPos, - int anzahl, - const Simstr & S); void replace_all( char oldCh, char newCh); - void replace_all( - const Simstr & oldS, - const Simstr & newS); - void to_lower(); - // token functions // get...-functions return the token, separated by char 'c' and leave the object unchanged. // take...-functions return the same, but remove the token and the corresponding separator from the object. - Simstr get_first_token( - char c) const; Simstr get_last_token( char c) const; - Simstr take_first_token( - char c); - Simstr take_last_token( - char c); private: char * sz; diff --git a/xml2cmp/source/xcd/cr_html.cxx b/xml2cmp/source/xcd/cr_html.cxx index 56d7abd89fd0..1b28c6facb82 100644 --- a/xml2cmp/source/xcd/cr_html.cxx +++ b/xml2cmp/source/xcd/cr_html.cxx @@ -229,16 +229,6 @@ HtmlCreator::Write_ReferenceDocu( const Simstr & i_sName, void -HtmlCreator::PrintH1( const char * i_pText) -{ - static const char sH1a[] = "<H1 ALIGN=CENTER>"; - static const char sH1e[] = "</H1>"; - WriteStr(sH1a); - WriteStr(i_pText); - WriteStr(sH1e); -} - -void HtmlCreator::StartRow() { WriteStr( " <TR VALIGN=TOP>\n" ); diff --git a/xml2cmp/source/xcd/cr_html.hxx b/xml2cmp/source/xcd/cr_html.hxx index c4a98514e89a..0b0d07ff48f1 100644 --- a/xml2cmp/source/xcd/cr_html.hxx +++ b/xml2cmp/source/xcd/cr_html.hxx @@ -76,8 +76,6 @@ class HtmlCreator const Simstr & i_sRole, const Simstr & i_sTitle ); private: - void PrintH1( - const char * i_pText ); void StartRow(); void FinishRow(); void StartCell( |