Anonymous avatar Anonymous committed 837cd61

toolsfixes: #115441# introtuced separate header for std::string util helper functions

Comments (0)

Files changed (3)

l10ntools/inc/export.hxx

 #include <sstream>  /* std::stringstream */
 #include <iostream>
 #include <fstream>
-#include <cctype>   /* toupper() */
 
 #include <unistd.h>
 
 #include <direct.h>
 #endif
 
+#include "strutils.hxx"
+
 #define NO_TRANSLATE_ISO "x-no-translate"
 #define JAPANESE_ISO "ja"
 
-/** Iterates over a std::string and removes all characters c returning
- * the cleaned up version.
- *
- * @param str the string to be processed
- * @param c the character that shall be removed
- * @returns the string with the specified character removed
- */
-std::string eraseAllChars( std::string str, char c )
-{
-	std::string::iterator i = str.begin();
-	std::stringstream buffer;
-	while ( i != str.end() ) {
-		if ( *i != c ) buffer << *i;
-		i++;
-	}
-	return buffer.str();
-}
-
-/** Converts a std::string to uppercase
- *
- * @param str the source string to process
- * @returns the uppercase string
- */
-std::string toUpperAscii( std::string str )
-{
-	std::string::iterator i = str.begin();
-	std::stringstream buffer;
-	while ( i != str.end() ) {
-		char c = *i;
-		if ( isascii( c ) && isalpha( c ) && islower( c ) )
-			buffer << (char)toupper(c);
-		else
-			buffer << c;
-		i++;
-	}
-	return buffer.str();
-}
-
-/** Converts a std::string to lowercase
- *
- * @param str the source string to process
- * @returns the lowercase string
- */
-std::string toLowerAscii( std::string str )
-{
-	std::string::iterator i = str.begin();
-	std::stringstream buffer;
-	while ( i != str.end() ) {
-		char c = *i;
-		if ( isascii( c ) && isalpha( c ) && isupper( c ) )
-			buffer << (char)tolower(c);
-		else
-			buffer << c;
-		i++;
-	}
-	return buffer.str();
-}
-
-/** @brief Strip off Whitespaces
- *
- * This function strips the leading and trailing whitespaces off a
- * string supplied as the only argument.
- *
- * @param str The string to process
- *
- * @returns The string with all whitespaces stripped doff
- */
-std::string strip( std::string str ) {
-
-	if ( str.empty() ) return str;
-
-	// return str if there are no trailing or leading whitespaces at all
-	if ( isalnum(str.at(0)) ) {
-		if ( isalnum(str.at(str.length()-1)) ) {
-			return str;
-		}
-	}
-
-	// iterate from start over the string and find the first position
-	// with a non-whitespace
-	int leadingPos = 0;
-	std::string::iterator iterLeading = str.begin();
-	while ( iterLeading != str.end() ) {
-		if ( isalnum(*iterLeading) ) {
-			break;
-		}
-
-		iterLeading++;
-		leadingPos++;
-	}
-
-	// iterate from end over the string to the beginning and find the
-	// first position with a non-whitespace
-	int trailingPos = str.length();
-	std::string::iterator iterTrailing = str.end();
-	while ( iterTrailing != str.begin() ) {
-		if ( isalnum(*iterTrailing) ) {
-			break;
-		}
-
-		iterTrailing--;
-		trailingPos--;
-	}
-
-	// return the substring from leadingPos to trailingPos
-	return str.substr( leadingPos, trailingPos+1-leadingPos );
-}
-
-std::string stripLeading( std::string str ) {
-	if ( str.empty() ) return str;
-
-	// return str if there are no trailing or leading whitespaces at all
-	if ( isalnum(str.at(0)) ) {
-		return str;
-	}
-
-	// iterate from start over the string and find the first position
-	// with a non-whitespace
-	int leadingPos = 0;
-	std::string::iterator iterLeading = str.begin();
-	while ( iterLeading != str.end() ) {
-		if ( isalnum(*iterLeading) ) {
-			break;
-		}
-
-		iterLeading++;
-		leadingPos++;
-	}
-
-	return str.substr( leadingPos );
-}
-
-std::string stripTrailing( std::string str ) {
-	if ( str.empty() ) return str;
-
-	// return str if there are no trailing or leading whitespaces at all
-	if ( isalnum(str.at(0)) ) {
-		return str;
-	}
-
-	// iterate from end over the string to the beginning and find the
-	// first position with a non-whitespace
-	int trailingPos = str.length();
-	std::string::iterator iterTrailing = str.end();
-	while ( iterTrailing != str.begin() ) {
-		if ( isalnum(*iterTrailing) ) {
-			break;
-		}
-
-		iterTrailing--;
-		trailingPos--;
-	}
-
-	// return the substring from leadingPos to trailingPos
-	return str.substr( 0, trailingPos+1 );
-}
-
-
-/** @brief Replace a String with another
- *
- * This function replaces string A with string B in string str. All
- * occurances are replaced.
- *
- * @param str The string to search
- * @param A The string that is to be replaced
- * @param B The string to be inserted
- *
- * @returns The result string with all occurances replaced
- */
-std::string replace( std::string str, std::string A, std::string B ) {
-
-	// return the source string if either the source string was empty or
-	// the string to search for was empty
-	if ( str.empty() || A.empty() ) {
-		return str;
-	}
-
-	int n;
-	std::string tmp = str;
-
-	std::stringstream buffer;
-
-	// iterate over all occurances of A in str
-	while ( (n=tmp.find( A )) != std::string::npos ) {
-		// append the subtring of tmp from zero to the occurance
-		// followed by B
-		buffer << tmp.substr(0,n) << B;
-
-		// set tmp to the remainder that is still needed to be processed
-		tmp = tmp.substr(n+A.length());
-	}
-
-	// append the remainder
-	buffer << tmp;
-
-	return buffer.str();
-}
-
 struct eqstr
 {
 	bool operator()( const char* s1, const char* s2 ) const

l10ntools/inc/strutils.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ 
+#ifndef __strutils_hxx
+#define __strutils_hxx
+
+#include <cctype>
+#include <fstream>
+#include <iostream>
+#include <cstdio>
+#include <string>
+#include <vector>
+#include <map>
+
+/** Iterates over a std::std::string and removes all characters c returning
+ * the cleaned up version.
+ *
+ * @param str the std::string to be processed
+ * @param c the character that shall be removed
+ * @returns the std::string with the specified character removed
+ */
+std::string eraseAllChars( std::string str, char c ) {
+	std::string::iterator i = str.begin();
+	std::stringstream buffer;
+	while ( i != str.end() ) {
+		if ( *i != c ) buffer << *i;
+		i++;
+	}
+
+	return buffer.str();
+}
+
+/** Converts a std::std::string to uppercase
+ *
+ * @param str the source std::string to process
+ * @returns the uppercase std::string
+ */
+std::string toUpperAscii( std::string str ) {
+	std::string::iterator i = str.begin();
+	std::stringstream buffer;
+	while ( i != str.end() ) {
+		char c = *i;
+		if ( isascii( c ) && isalpha( c ) && islower( c ) )
+			buffer << (char)toupper(c);
+		else
+			buffer << c;
+		i++;
+	}
+	return buffer.str();
+}
+
+/** Converts a std::std::string to lowercase
+ *
+ * @param str the source std::string to process
+ * @returns the lowercase std::string
+ */
+std::string toLowerAscii( std::string str ) {
+	std::string::iterator i = str.begin();
+	std::stringstream buffer;
+	while ( i != str.end() ) {
+		char c = *i;
+		if ( isascii( c ) && isalpha( c ) && isupper( c ) )
+			buffer << (char)tolower(c);
+		else
+			buffer << c;
+		i++;
+	}
+	return buffer.str();
+}
+
+/** Strip leading whitespaces off a std::string given by str
+ *
+ * @param str The std::string
+ * @return The stripped std::string
+ */
+std::string stripLeading( std::string str ) {
+	if ( str.empty() ) return str;
+
+	// return str if there are no trailing or leading whitespaces at all
+	if ( isalnum(str.at(0)) ) {
+		return str;
+	}
+
+	// iterate from start over the std::string and find the first position
+	// with a non-whitespace
+	int leadingPos = 0;
+    std::string::iterator iterLeading = str.begin();
+	while ( iterLeading != str.end() ) {
+		if ( isalnum(*iterLeading) ) {
+			break;
+		}
+
+		iterLeading++;
+		leadingPos++;
+	}
+
+	return str.substr( leadingPos );
+}
+
+/** Strip trailing whitespaces off a std::string given by str
+ *
+ * @param str The std::string
+ * @return the stripped std::string
+ */
+std::string stripTrailing( std::string str ) {
+	if ( str.empty() ) return str;
+
+	// return str if there are no trailing or leading whitespaces at all
+	if ( isalnum(str.at(0)) ) {
+		return str;
+	}
+
+	// iterate from end over the std::string to the beginning and find the
+	// first position with a non-whitespace
+	int trailingPos = str.length();
+	std::string::iterator iterTrailing = str.end();
+	while ( iterTrailing != str.begin() ) {
+		if ( isalnum(*iterTrailing) ) {
+			break;
+		}
+
+		iterTrailing--;
+		trailingPos--;
+	}
+
+	// return the substd::string from leadingPos to trailingPos
+	return str.substr( 0, trailingPos+1 );
+}
+
+/** @brief Strip off Whitespaces
+ *
+ * This function strips the leading and trailing whitespaces off a
+ * std::string supplied as the only argument.
+ *
+ * @param str The std::string to process
+ *
+ * @returns The std::string with all whitespaces stripped doff
+ */
+std::string strip( std::string str ) {
+
+	if ( str.empty() ) return str;
+
+	// return str if there are no trailing or leading whitespaces at all
+	if ( isalnum(str.at(0)) ) {
+		if ( isalnum(str.at(str.length()-1)) ) {
+			return str;
+		}
+	}
+
+	// iterate from start over the std::string and find the first position
+	// with a non-whitespace
+	int leadingPos = 0;
+	std::string::iterator iterLeading = str.begin();
+	while ( iterLeading != str.end() ) {
+		if ( isalnum(*iterLeading) ) {
+			break;
+		}
+
+		iterLeading++;
+		leadingPos++;
+	}
+
+	// iterate from end over the std::string to the beginning and find the
+	// first position with a non-whitespace
+	int trailingPos = str.length();
+	std::string::iterator iterTrailing = str.end();
+	while ( iterTrailing != str.begin() ) {
+		if ( isalnum(*iterTrailing) ) {
+			break;
+		}
+
+		iterTrailing--;
+		trailingPos--;
+	}
+
+	// return the substd::string from leadingPos to trailingPos
+	return str.substr( leadingPos, trailingPos+1-leadingPos );
+}
+
+/** @brief Replace a String with another
+ *
+ * This function replaces std::string A with std::string B in std::string str. All
+ * occurances are replaced.
+ *
+ * @param str The std::string to search
+ * @param A The std::string that is to be replaced
+ * @param B The std::string to be inserted
+ *
+ * @returns The result std::string with all occurances replaced
+ */
+std::string replace( std::string str, std::string A, std::string B ) {
+
+	// return the source std::string if either the source std::string was empty or
+	// the std::string to search for was empty
+	if ( str.empty() || A.empty() ) {
+		return str;
+	}
+
+	int n;
+	std::string tmp = str;
+
+	std::stringstream buffer;
+
+	// iterate over all occurances of A in str
+	while ( (n=tmp.find( A )) != std::string::npos ) {
+		// append the subtring of tmp from zero to the occurance
+		// followed by B
+		buffer << tmp.substr(0,n) << B;
+
+		// set tmp to the remainder that is still needed to be processed
+		tmp = tmp.substr(n+A.length());
+	}
+
+	// append the remainder
+	buffer << tmp;
+
+	return buffer.str();
+}
+
+/** @brief Dump Vector of Strings
+ *
+ * Dump a std::vector of std::strings to the output stream specified by out
+ * seperated by newlines. The boolean parameter numerate specifies if
+ * each line should be preceeded by the line number or not.
+ *
+ * @param out reference to the ostream the lines shall go to
+ * @param v the std::vector of std::strings
+ * @param numerate print line numbers if true otherwise not
+ */
+/*
+void dumpVector( ostream& out, std::vector<std::string> v, bool numerate ) {
+	std::vector<std::string>::iterator i = v.begin();
+	unsigned int lineNumber = 0;
+	while ( i != v.end() ) {
+		if ( numerate ) {
+			out << setw(5) << (++lineNumber) << ": ";
+		}
+		out << *i << endl;
+		i++;
+	}
+}
+*/
+
+/** @brief Concatenate std::strings in std::vector
+ *
+ * Concatenate std::string elements in std::vector to one std::string separated by a
+ * separator std::string supplied by separator
+ *
+ * @param v The std::vector containing std::strings
+ * @param separator The separator std::string (defaults to "")
+ *
+ * @return The result std::string of the concatenated std::vector
+ */
+std::string concat( std::vector<std::string> v, std::string separator ) {
+	std::stringstream stream;
+	std::vector<std::string>::iterator i = v.begin();
+	unsigned int length = v.size();
+	unsigned int ii=0;
+	while ( i != v.end() ) {
+		stream << *i;
+		i++;
+		if ( ++ii < length ) stream << separator;
+
+	}
+
+	return stream.str();
+}
+
+/** @brief Split std::strings delimited by a given separator
+ *
+ * Split std::string str by separator and return a std::vector of substd::strings
+ *
+ * @param str The std::string to be split
+ * @param separator The separator std::string
+ *
+ * @returns A std::vector of substd::strings
+ */
+std::vector<std::string> split( std::string str, std::string separator ) {
+
+	std::vector<std::string> v;
+
+	if ( str.empty() ) {
+		return v;
+	}
+
+	// temporary source std::string
+	std::string tmp = str;
+
+	// separator length (or delimiter length)
+	int slen = separator.size();
+
+	// delimiter position
+	int n = 0;
+
+	// loop while there are still delimiters in the source std::string
+	while ( (n = tmp.find( separator )) != std::string::npos ) {
+
+		// extract token via substd::string from 0 to n (delimiter position)
+		v.push_back( tmp.substr( 0, n ) );
+
+		// set tmp to the remainder
+		tmp = tmp.substr( n+slen );
+	}
+
+	// push the raminder
+	v.push_back( tmp );
+
+	return v;
+
+}
+
+/** Return Token at given index
+ *
+ * @param str The std::string to be tokenized
+ * @param separator The token delimiter (defaults to a single space)
+ * @param idxToken The token index to be returned
+ *
+ * @return The token
+ */
+std::string getTokenAt( std::string str, std::string separator, int idxToken, unsigned int offset=0 ) {
+
+	if ( str.empty() ) {
+		return std::string();
+	}
+
+    if ( offset >= str.size() ) {
+        return std::string();
+    }
+
+	// temporary source std::string
+	std::string tmp = str.substr( offset );
+
+	// separator length (or delimiter length)
+	int slen = separator.size();
+
+	// delimiter position
+	int n = 0;
+
+	// loop while there are still delimiters in the source std::string
+	int nToken = 0;
+	std::string token;
+	while ( (n = tmp.find( separator )) != std::string::npos ) {
+
+		// extract token via substd::string from 0 to n (delimiter position)
+		token = tmp.substr( 0, n );
+
+		// set tmp to the remainder
+		tmp = tmp.substr( n+slen );
+
+		if ( nToken++ == idxToken ) {
+			return token;
+		}
+	}
+
+	// tokens exhausted, return remainder left in tmp that happens to be
+	// the last token
+	return tmp;
+}
+
+unsigned int getTokenCount( std::string str, const char delim=' ' ) {
+
+    if ( str.empty() ) {
+        return 0;
+    }
+
+    unsigned int count = 0;
+    std::string::iterator i = str.begin();
+    while ( i < str.end() )  {
+        if ( *i == delim ) count++;
+        i++;
+    }
+
+    return count+1;
+}
+
+/** @brief Return the date
+ *
+ * Return the date in a formatted manner
+ *
+ * @param format the strftime format
+ * @param *t The time_t of a specific time (defaults to a NULL pointer)
+ *
+ * @returns the formatted date
+ */
+std::string date( std::string format, time_t *t ) {
+
+	time_t *now;
+
+	if ( t == 0 ) {
+		time_t temp = time( 0 );
+		now = &temp;
+	} else {
+		now = t;
+	}
+
+	struct tm *timeInfo = localtime( now );
+
+	unsigned int bufferSize = 1024;
+	char buffer[bufferSize];
+	strftime( buffer, bufferSize, format.c_str(), timeInfo );
+
+	return std::string( buffer );
+}
+
+/** Return a C++ std::string from a integer
+ *
+ * @param arg Integer Number
+ *
+ * @returns The std::string
+ */
+std::string num( int arg ) {
+	char buffer[256];
+	snprintf( buffer, 256, "%d", arg );
+	return std::string(buffer);
+}
+
+/** Returns a substring delimited by delim
+ */
+std::string extractStringDelimitedBy( const std::string& str, const std::string delim="\"" ) {
+    unsigned int p1 = str.find( delim );
+    unsigned int p2 = str.find_last_of( delim );
+
+    return str.substr( p1+1, p2-p1-1 );
+}
+
+#endif

l10ntools/source/export.cxx

 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_l10ntools.hxx"
-#include <stdio.h>
-#include <stdlib.h>
 #include <tools/fsys.hxx>
 #include "l10ntools/directory.hxx"
 #include "export.hxx"
 #include "tokens.h"
 #include "utf8conv.hxx"
-#include <iostream>
-#include <string>
 
 using namespace std;
 
 #define STATE_LANGUAGES	0X000B
 
 // set of global variables
-DECLARE_LIST( FileList, string* )
-FileList aInputFileList;
+vector<string*> aInputFileList;
 bool bEnableExport;
 bool bMergeMode;
 bool bErrorLog;
 extern char *GetOutputFile( int argc, char* argv[])
 /*****************************************************************************/
 {
-	bEnableExport = FALSE;
-	bMergeMode = FALSE;
-	bErrorLog = TRUE;
-	bBreakWhenHelpText = FALSE;
-	bUnmerge = FALSE;
-	bUTF8 = TRUE;
+	bEnableExport = false;
+	bMergeMode = false;
+	bErrorLog = true;
+	bBreakWhenHelpText = false;
+	bUnmerge = false;
+	bUTF8 = true;
 	sPrj = "";
 	sPrjRoot = "";
 	sActFileName = "";
 	sTempFile = "";
 	pTempFile = NULL;
 	USHORT nState = STATE_NON;
-	bool bInput = FALSE;
+	bool bInput = false;
 
 	// parse command line
 	for( int i = 1; i < argc; i++ ) {
 					return NULL;	// no valid command line
 				}
 				case STATE_INPUT: {
-					aInputFileList.Insert( new string( argv[ i ]), LIST_APPEND );
+					aInputFileList.push_back( new string( argv[ i ]) );
 					bInput = TRUE; // min. one source file found
 				}
 				break;
     if( bUnmerge ) sMergeSrc = string();
 	if ( bInput ) {
 		// command line is valid
-		bEnableExport = TRUE;
+		bEnableExport = true;
 
 		char *pReturn = new char[ sOutputFile.size() + 1 ];
 		strcpy( pReturn, sOutputFile.c_str());  // #100211# - checked
 
 extern const char* getFilename()
 {
-	return (*(aInputFileList.GetObject( 0 ))).c_str();
+	return (*(aInputFileList.at( 0 ))).c_str();
 }
 /*****************************************************************************/
 extern FILE *GetNextFile()
         remove( sTempFile.c_str() );
 	}
 
-	while ( aInputFileList.Count()) {
-		string sFileName( *(aInputFileList.GetObject( 0 )));
+	while ( aInputFileList.size()) {
+		string sFileName( *(aInputFileList.at( 0 )));
 
 		string sOrigFile( sFileName );
 
 		sFileName = Export::GetNativeFile( sFileName );
-		delete aInputFileList.GetObject(( ULONG ) 0 );
-		aInputFileList.Remove(( ULONG ) 0 );
+		delete aInputFileList.at( 0 );
+		aInputFileList.erase(aInputFileList.begin());
 
 		if ( sFileName == "" ) {
 			fprintf( stderr, "ERROR: Could not precompile File %s\n",
 			sToken = eraseAllChars( sToken, '\r' );
 			sToken = eraseAllChars( sToken, '}' );
 			/*
-			sToken.EraseAllChars( '\n' );
-			sToken.EraseAllChars( '\r' );
-			sToken.EraseAllChars( '{' );
+			sToken.eraseAllChars( '\n' );
+			sToken.eraseAllChars( '\r' );
+			sToken.eraseAllChars( '{' );
 			*/
 			//while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
 			sToken = replace( sToken, "\t", " " );
-			sToken.EraseTrailingChars( ' ' );
-			string sT =  sToken.GetToken( 0, ' ' );
-            pResData->sResTyp = sT.ToLowerAscii();
-			string sId( sToken.Copy( pResData->sResTyp.Len() + 1 ));
+			sToken = stripTrailing( sToken );
+
+			vector<string> vecTokens = split( sToken, " " );
+			string sT =  vecTokens.at(0); //sToken.GetToken( 0, ' ' );
+            pResData->sResTyp = toLowerAscii(sT); //sT.toLowerAscii();
+			//string sId( sToken.Copy( pResData->sResTyp.Len() + 1 ));
+            string sID = sToken.substr( pResData->sResTyp.size() + 1 );
 			string sCondition;
-			if ( sId.Search( "#" ) != STRING_NOTFOUND ) {
+			if ( sID.find( "#" ) != string::npos ) {
 				// between ResTyp, Id and paranthes is a precomp. condition
 				sCondition = "#";
-				sCondition += sId.GetToken( 1, '#' );
-				sId = sId.GetToken( 0, '#' );
+				//sCondition += sId.GetToken( 1, '#' );
+                sCondition += getTokenAt( sID, "#", 1 );
+                sID = getTokenAt( sID, "#", 0 );
 			}
-			sId = sId.GetToken( 0, '/' );
-			CleanValue( sId );
-			sId = sId.EraseAllChars( '\t' );
-			pResData->SetId( sId, ID_LEVEL_IDENTIFIER );
-			if ( sCondition.Len()) {
+			sID = getTokenAt( sID, "/", 0 );
+			CleanValue( sID );
+			sID = eraseAllChars( sID, '\t' );
+			pResData->SetId( sID, ID_LEVEL_IDENTIFIER );
+			if ( sCondition.size()) {
 				string sEmpty( "" );
-				Execute( CONDITION, sEmpty.GetBufferAccess()); 	// execute the
+				Execute( CONDITION, sEmpty.c_str()); 	// execute the
 														  		// precomp.
 																// condition
-				sEmpty.ReleaseBufferAccess();
+				//sEmpty.ReleaseBufferAccess();
 			}
 		}
 		break;
 			bNextMustBeDefineEOL = FALSE;
 			nLevel++;
 			if ( nLevel > 1 ) {
-				aResStack.GetObject( nLevel - 2 )->bChild = TRUE;
+				aResStack.at( nLevel - 2 )->bChild = TRUE;
 			}
 
 			// create new instance for this res. and fill mandatory fields
 
 			pResData = new ResData( sActPForm, FullId() , sFilename );
-			aResStack.Insert( pResData, LIST_APPEND );
-			sToken.EraseAllChars( '\n' );
-			sToken.EraseAllChars( '\r' );
-			sToken.EraseAllChars( '{' );
-			sToken.EraseAllChars( '\t' );
-			sToken.EraseAllChars( ' ' );
-			sToken.EraseAllChars( '\\' );
-			pResData->sResTyp = sToken.ToLowerAscii();
+			aResStack.push_back( pResData );
+			sToken = eraseAllChars( sToken, '\n' );
+			sToken = eraseAllChars( sToken, '\r' );
+			sToken = eraseAllChars( sToken, '{' );
+			sToken = eraseAllChars( sToken, '\t' );
+			sToken = eraseAllChars( sToken, ' ' );
+			sToken = eraseAllChars( sToken, '\\' );
+			pResData->sResTyp = toLowerAscii(sToken);
 		}
 		break;
 		case LEVELUP: {
 				sLowerTyp = "unknown";
 			nLevel++;
 			if ( nLevel > 1 ) {
-				aResStack.GetObject( nLevel - 2 )->bChild = TRUE;
+				aResStack.at( nLevel - 2 )->bChild = TRUE;
 			}
 
 			ResData *pNewData = new ResData( sActPForm, FullId() , sFilename );
 			pNewData->sResTyp = sLowerTyp;
-			aResStack.Insert( pNewData, LIST_APPEND );
+			aResStack.push_back( pNewData );
 		}
 		break;
 		case LEVELDOWN: {
 						bNextMustBeDefineEOL = FALSE;
 					}
 					WriteData( pResData );
-					delete aResStack.GetObject( nLevel - 1 );
-					aResStack.Remove( nLevel - 1 );
+					delete aResStack.at( nLevel - 1 );
+					aResStack.erase( aResStack.begin() + (nLevel - 1) );
 					nLevel--;
 				}
 			}
 		} 
 		break;
         case ASSIGNMENT: {
-			bDontWriteOutput = FALSE;
+			bDontWriteOutput = false;
 			// interpret different types of assignement
- 			string sKey = sToken.GetToken( 0, '=' );
-			sKey.EraseAllChars( ' ' );
-			sKey.EraseAllChars( '\t' );
-			string sValue = sToken.GetToken( 1, '=' );
+ 			string sKey = getTokenAt( sToken, "=", 0 ); //sToken.GetToken( 0, '=' );
+			sKey = eraseAllChars( sKey, ' ' );
+			sKey = eraseAllChars( sKey, '\t' );
+			string sValue = getTokenAt( sToken, "=", 1 ); //sToken.GetToken( 1, '=' );
 			CleanValue( sValue );
-			if ( ToUpperAscii( sKey ) == "IDENTIFIER" ) {
-				string sId( sValue.EraseAllChars( '\t' ));
-				pResData->SetId( sId.EraseAllChars( ' ' ), ID_LEVEL_IDENTIFIER );
+			if ( toUpperAscii( sKey ) == "IDENTIFIER" ) {
+				string sId( eraseAllChars( sValue, '\t' ));
+				pResData->SetId( eraseAllChars( sId, ' ' ), ID_LEVEL_IDENTIFIER );
 			}
 			else if ( sKey == "HELPID" ) {
 				pResData->sHelpId = sValue;
 				//	( sOrig.SearchAndReplace( "=", "[ de ] =" ));
 				//}
 
-				pResData->bList = TRUE;
+				pResData->bList = true;
 				nList = LIST_STRING;
                 //string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
                 nListLang = SOURCE_LANGUAGE;
 				//if ( bUnmerge ){
 				//	( sOrig.SearchAndReplace( "=", "[ de ] =" ));
 				//}
-				pResData->bList = TRUE;
+				pResData->bList = true;
 				nList = LIST_FILTER;
                 //string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
 				nListLang = SOURCE_LANGUAGE;
 			else if ( sKey == "UIENTRIES" ) {
 				//if ( bUnmerge ){
 				//	( sOrig.SearchAndReplace( "=", "[ de ] =" ));}
-				pResData->bList = TRUE;
+				pResData->bList = true;
 				nList = LIST_UIENTRIES;
 				//string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
 				nListLang = SOURCE_LANGUAGE;
 				nListIndex = 0;
 				nListLevel = 0;
 			}
-			if (( sToken.Search( "{" ) != STRING_NOTFOUND ) &&
-				( sToken.GetTokenCount( '{' ) > sToken.GetTokenCount( '}' )))
+			if (( sToken.find( "{" ) != string::npos ) &&
+				( getTokenCount(sToken,'{') > getTokenCount(sToken,'}') ))
 			{
 				//WorkOnTokenSet( LEVELUP, pTkn );
                 Parse( LEVELUP, "" );
 		case LISTASSIGNMENT: {
 			bDontWriteOutput = FALSE;
             string sTmpToken( sToken);
-            sTmpToken.EraseAllChars(' ');
-            USHORT nPos = 0;
-            //nPos = sTmpToken.ToLowerAscii().Search("[de]=");
-			nPos = sTmpToken.ToLowerAscii().Search("[en-us]=");
-            if( nPos != STRING_NOTFOUND ) {
+            sTmpToken = eraseAllChars( sTmpToken, ' ' );
+			int nPos = toLowerAscii(sTmpToken).find("[en-us]=");
+            if( nPos != -1 ) {
 				//if ( bUnmerge ){
 				//	( sOrig.SearchAndReplace( "=", "[ de ] =" ));
 				//}
-                string sKey = sTmpToken.Copy( 0 , nPos );
-				sKey.EraseAllChars( ' ' );
-				sKey.EraseAllChars( '\t' );
-				string sValue = sToken.GetToken( 1, '=' );
+                string sKey = sTmpToken.substr( 0 , nPos );
+				sKey = eraseAllChars( sKey, ' ' );
+				sKey = eraseAllChars( sKey, '\t' );
+				string sValue = getTokenAt( sToken, "=", 1 );
 				CleanValue( sValue );
-				if ( ToUpperAscii( sKey ) ==  "STRINGLIST" ) {
-					pResData->bList = TRUE;
+				if ( toUpperAscii( sKey ) ==  "STRINGLIST" ) {
+					pResData->bList = true;
 					nList = LIST_STRING;
 					//string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
 					nListLang = SOURCE_LANGUAGE;
 					nListLevel = 0;
 				}
 				else if ( sKey == "FILTERLIST" ) {
-					pResData->bList = TRUE;
+					pResData->bList = true;
 					nList = LIST_FILTER;
 					//string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
 					nListLang = SOURCE_LANGUAGE;
 				}
 				// PairedList
                 else if ( sKey ==  "PAIREDLIST" ) {
-					pResData->bList = TRUE;
+					pResData->bList = true;
 					nList = LIST_PAIRED;
 					//string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
 					nListLang = SOURCE_LANGUAGE;
 				}
 
                 else if ( sKey ==  "ITEMLIST" ) {
-					pResData->bList = TRUE;
+					pResData->bList = true;
 					nList = LIST_ITEM;
 					//string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
 					nListLang = SOURCE_LANGUAGE;
 					nListLevel = 0;
 				}
 				else if ( sKey ==  "UIENTRIES" ) {
-					pResData->bList = TRUE;
+					pResData->bList = true;
 					nList = LIST_UIENTRIES;
 					//string sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
 					nListLang = SOURCE_LANGUAGE;
 			}
 			else {
 				// new res. is a String- or FilterList
-				string sKey = sToken.GetToken( 0, '[' );
-				sKey.EraseAllChars( ' ' );
-				sKey.EraseAllChars( '\t' );
-				if ( ToUpperAscii( sKey ) == "STRINGLIST" )
+				string sKey = getTokenAt( sKey, "[" ,0 );
+				sKey = eraseAllChars( sKey, ' ' );
+				sKey = eraseAllChars( sKey, '\t' );
+				if ( toUpperAscii( sKey ) == "STRINGLIST" )
 					nList = LIST_STRING;
 				else if ( sKey == "FILTERLIST" )
 					nList = LIST_FILTER;
 				else if ( sKey == "UIENTRIES" )
 					nList = LIST_UIENTRIES;
 				if ( nList ) {
-					string sLang=sToken.GetToken( 1, '[' ).GetToken( 0, ']' );
+					//string sLang = sToken.GetToken( 1, '[' ).GetToken( 0, ']' );
+                    string sLang = getTokenAt( getTokenAt( sToken, "[", 1 ), "]", 0 );
 					CleanValue( sLang );
                     nListLang = sLang;
                     /*if (( bUnmerge ) && ( !nListLang.EqualsIgnoreCaseAscii("de")) && ( !nListLang.EqualsIgnoreCaseAscii("en-US")))
 			// this is an entry for a String- or FilterList
 			if ( nList ) {
 				SetChildWithText();
-				string sEntry( sToken.GetToken( 1, '\"' ));
-				if ( sToken.GetTokenCount( '\"' ) > 3 )
+				string sEntry = getTokenAt( sToken, "\"", 1 ); // ( sToken.GetToken( 1, '\"' ));
+				//if ( sToken.GetTokenCount( '\"' ) > 3 )
+				if ( getTokenCount( sToken, '\"' ) > 3 )
 					sEntry += "\"";
 				if ( sEntry == "\\\"" )
 					sEntry = "\"";
 				CutComment( sToken );
 
 				// this is a text line!!!
-				string sKey = sToken.GetToken( 0, '=' ).GetToken( 0, '[' );
-				sKey.EraseAllChars( ' ' );
-				sKey.EraseAllChars( '\t' );
+				//string sKey = sToken.GetToken( 0, '=' ).GetToken( 0, '[' );
+                string sKey = getTokenAt( getTokenAt( sToken, "=", 0 ), "]", 0 );
+				sKey = eraseAllChars( sKey, ' ' );
+				sKey = eraseAllChars( sKey, '\t' );
 				string sText( GetText( sToken, nToken ));
-				if ( !bMergeMode )
-					sText = sText.Convert( aCharSet, RTL_TEXTENCODING_MS_1252 );
-				string sLang;
-				if ( sToken.GetToken( 0, '=' ).Search( "[" ) != STRING_NOTFOUND ) {
- 					sLang = sToken.GetToken( 0, '=' ).GetToken( 1, '[' ).GetToken( 0, ']' );
+
+                // TODO: OMG, is text encoding conversion really
+                // necessary? std::string doesn't have this...
+                // SimonAW - 2010-12-01
+				//if ( !bMergeMode )
+				//	sText = sText.Convert( aCharSet, RTL_TEXTENCODING_MS_1252 );
+				
+                string sLang;
+
+				//if ( sToken.GetToken( 0, '=' ).Search( "[" ) != STRING_NOTFOUND ) {
+                if ( getTokenAt(sToken, "=", 0).find("[") != string::npos ) {
+ 					//sLang = sToken.GetToken( 0, '=' ).GetToken( 1, '[' ).GetToken( 0, ']' );
+                    sLang = getTokenAt(getTokenAt(getTokenAt(sToken,"=",0),"[",1),"]",0);
 					CleanValue( sLang );
 				}
 				string nLangIndex = sLang;
                 string sOrigKey = sKey;
-				if ( sText.Len() && sLang.Len() ) {
-					if (( ToUpperAscii( sKey ) == "TEXT" ) ||
+                sKey = toUpperAscii( sKey );
+				if ( sText.size() && sLang.size() ) {
+					if (( sKey == "TEXT" ) ||
 						( sKey == "MESSAGE" ) ||
 						( sKey == "CUSTOMUNITTEXT" ) ||
 						( sKey == "SLOTNAME" ) ||
 						
 						SetChildWithText();
                         //if ( nLangIndex.EqualsIgnoreCaseAscii("en-US") )
-						if ( Export::isSourceLanguage( nLangIndex ) )						
+						if ( Export::isSourceLanguage( nLangIndex ) )				
 							pResData->SetId( sText, ID_LEVEL_TEXT );
 
-						pResData->bText = TRUE;
+						pResData->bText = true;
 						pResData->sTextTyp = sOrigKey;
 						if ( bMergeMode ) {
 							PrepareTextToMerge( sOrig, STRING_TYP_TEXT, nLangIndex, pResData );
 							//	pResData->sText[ nLangIndex ] = sText;
 						}
 						else {
-							if ( pResData->sText[ nLangIndex ].Len()) {
+							if ( pResData->sText[ nLangIndex ].size()) {
 								string sError( "Language " );
                                 sError += nLangIndex;
 								sError += " defined twice";
 						//	( sOrig.SearchAndReplace( "=", "[ de ] =" ));
 						//	}
 						SetChildWithText();
-						pResData->bHelpText = TRUE;
+						pResData->bHelpText = true;
 						if ( bBreakWhenHelpText ) {
-							string sError( "\"HelpText\" found in source\n" );
-							YYWarning( sError.GetBufferAccess());
-							sError.ReleaseBufferAccess();
+							YYWarning( (char*)"\"HelpText\" found in source\n" );
 							SetError();
 						}
 						if ( bMergeMode )
 							//if ( bUnmerge )
 							//	pResData->sHelpText[ nLangIndex ] = sText;
 						else {
-							if ( pResData->sHelpText[ nLangIndex ].Len()) {
+							if ( pResData->sHelpText[ nLangIndex ].size()) {
 								string sError( "Language " );
                                 sError += nLangIndex;
 								sError += " defined twice";
 						//	( sOrig.SearchAndReplace( "=", "[ de ] =" ));
 						//	}
 						SetChildWithText();
-						pResData->bQuickHelpText = TRUE;
+						pResData->bQuickHelpText = true;
 						if ( bMergeMode )
 							PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, nLangIndex, pResData );
 							//if ( bUnmerge )
 							//	pResData->sQuickHelpText[ nLangIndex ] = sText;
 						else {
-							if ( pResData->sQuickHelpText[ nLangIndex ].Len()) {
+							if ( pResData->sQuickHelpText[ nLangIndex ].size()) {
 								string sError( "Language " );
                                 sError += nLangIndex;
 								sError += " defined twice";
 						//	( sOrig.SearchAndReplace( "=", "[ de ] =" ));
 						//	}
 						SetChildWithText();
-						pResData->bTitle = TRUE;
+						pResData->bTitle = true;
 						if ( bMergeMode )
 							PrepareTextToMerge( sOrig, STRING_TYP_TITLE, nLangIndex, pResData );
 							//if ( bUnmerge )
 							//	pResData->sTitle[ nLangIndex ] = sText;
 						else {
-							if ( pResData->sTitle[ nLangIndex ].Len()) {
+							if ( pResData->sTitle[ nLangIndex ].size()) {
 								string sError( "Language " );
                                 sError += nLangIndex;
 								sError += " defined twice";
 			}
 		break;
 		case NEWTEXTINRES: {
-			bDontWriteOutput = TRUE;
+			bDontWriteOutput = true;
 			// this means something like // ### Achtung : Neuer Text ...
 			/*string sLang( "GERMAN" );
 			string sText = sToken.GetToken( 2, ':' ).GetToken( 0, '*' );
 		}
 		break;
 		case APPFONTMAPPING: {
-			bDontWriteOutput = FALSE;
+			bDontWriteOutput = false;
 			// this is a AppfontMapping, so look if its a definition
 			// of field size
-			string sKey = sToken.GetToken( 0, '=' );
-			sKey.EraseAllChars( ' ' );
-			sKey.EraseAllChars( '\t' );
-			string sMapping = sToken.GetToken( 1, '=' );
-			sMapping = sMapping.GetToken( 1, '(' );
-			sMapping = sMapping.GetToken( 0, ')' );
-			sMapping.EraseAllChars( ' ' );
-			sMapping.EraseAllChars( '\t' );
-			if ( ToUpperAscii( sKey ) == "SIZE" ) {
-				pResData->nWidth = ( USHORT ) sMapping.GetToken( 0, ',' ).ToInt64();
+			string sKey = getTokenAt( sToken, "=", 0 ); //sToken.GetToken( 0, '=' );
+			sKey = eraseAllChars( sKey, ' ' );
+			sKey = eraseAllChars( sKey, '\t' );
+			string sMapping = getTokenAt( sToken, "=", 1 ); // sToken.GetToken( 1, '=' );
+			sMapping = getTokenAt( sMapping, "(", 1 ); //sMapping.GetToken( 1, '(' );
+			sMapping = getTokenAt( sMapping, ")", 0 );
+			sMapping = eraseAllChars( sMapping, ' ' );
+			sMapping = eraseAllChars( sMapping, '\t' );
+			if ( toUpperAscii( sKey ) == "SIZE" ) {
+				pResData->nWidth = atoi( getTokenAt(sMapping,",",0).c_str() );
+                //( USHORT ) sMapping.GetToken( 0, ',' ).ToInt64();
 			}
 			else if ( sKey == "POSSIZE" ) {
-				pResData->nWidth = ( USHORT ) sMapping.GetToken( 2, ',' ).ToInt64();
+				//pResData->nWidth = ( USHORT ) sMapping.GetToken( 2, ',' ).ToInt64();
+				pResData->nWidth = atoi( getTokenAt(sMapping,",",2).c_str() );
 			}
 		}
 		break;
 		case RSCDEFINELEND:
-			bDontWriteOutput = FALSE;
+			bDontWriteOutput = false;
 		break;
 		case CONDITION: {
-			bDontWriteOutput = FALSE;
-			while( sToken.SearchAndReplace( "\r", " " ) != STRING_NOTFOUND ) {};
-			while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
-			while( sToken.SearchAndReplace( "  ", " " ) != STRING_NOTFOUND ) {};
-			string sCondition = sToken.GetToken( 0, ' ' );
+			bDontWriteOutput = false;
+
+            sToken = replace(sToken, "\r", " " );
+            sToken = replace(sToken, "\t", " " );
+            sToken = replace(sToken, "  ", " " );
+
+			//while( sToken.SearchAndReplace( "\r", " " ) != STRING_NOTFOUND ) {};
+			//while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
+			//while( sToken.SearchAndReplace( "  ", " " ) != STRING_NOTFOUND ) {};
+			string sCondition = getTokenAt(sToken, " ", 0 );
 			if ( sCondition == "#ifndef" ) {
 				sActPForm = "!defined ";
-				sActPForm += sToken.GetToken( 1, ' ' );
+				sActPForm += getTokenAt( sToken, " ", 1 );
 			}
 			else if ( sCondition == "#ifdef" ) {
 				sActPForm = "defined ";
-				sActPForm += sToken.GetToken( 1, ' ' );
+				sActPForm += getTokenAt( sToken, " ", 1 );
 			}
 			else if ( sCondition == "#if" ) {
-				sActPForm = sToken.Copy( 4 );
-				while ( sActPForm.SearchAndReplace( "||", "\\or" ) != STRING_NOTFOUND ) {};
+				sActPForm = sToken.substr(4); //Copy( 4 );
+				//while ( sActPForm.SearchAndReplace( "||", "\\or" ) != STRING_NOTFOUND ) {};
+                sActPForm = replace( sActPForm, "||", "\\or" );
 			}
 			else if ( sCondition == "#elif" ) {
-				sActPForm = sToken.Copy( 6 );
-				while ( sActPForm.SearchAndReplace( "||", "\\or" ) != STRING_NOTFOUND ) {};
+				sActPForm = sToken.substr(6); //Copy( 6 );
+				//while ( sActPForm.SearchAndReplace( "||", "\\or" ) != STRING_NOTFOUND ) {};
+                sActPForm = replace( sActPForm, "||", "\\or" );
 			}
 			else if ( sCondition == "#else" ) {
 				sActPForm = sCondition;
 		}
 		break;
 		case EMPTYLINE : {
-			bDontWriteOutput = FALSE;
+			bDontWriteOutput = false;
 			if ( bDefine ) {
-				bNextMustBeDefineEOL = FALSE;
-                bDefine = FALSE;
+				bNextMustBeDefineEOL = false;
+                bDefine = false;
 				while ( nLevel )
 					Parse( LEVELDOWN, "" );
                     //WorkOnTokenSet( LEVELDOWN, pTkn );
 		}
 		break;
 		case PRAGMA : {
-			bDontWriteOutput = FALSE;
-			while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
-			while( sToken.SearchAndReplace( "  ", " " ) != STRING_NOTFOUND ) {};
-			sToken.EraseLeadingChars( ' ' );
-			sToken.EraseTrailingChars( ' ' );
+			bDontWriteOutput = false;
+			//while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
+			//while( sToken.SearchAndReplace( "  ", " " ) != STRING_NOTFOUND ) {};
 
-			string sCharset = sToken.GetToken( 1, ' ' );
-			string sSet = sToken.GetToken( 2, ' ' );
-			if (( ToUpperAscii( sCharset ) == "CHARSET_IBMPC" ) ||
+            sToken = replace(sToken,"\t", " " );
+            sToken = replace(sToken,"  ", " " );
+
+			sToken = strip( sToken ); // EraseLeadingChars( ' ' );
+			//sToken.EraseTrailingChars( ' ' );
+
+			string sCharset = getTokenAt(sToken, " ", 1 ); //sToken.GetToken( 1, ' ' );
+			string sSet = getTokenAt(sToken, " ", 2 ); //sToken.GetToken( 2, ' ' );
+			if (( toUpperAscii( sCharset ) == "CHARSET_IBMPC" ) ||
 				( sCharset == "RTL_TEXTENCODING_IBM_850" ) ||
-				(( sCharset == "CHARSET" ) && ( ToUpperAscii(sSet) == "IBMPC" )))
+				(( sCharset == "CHARSET" ) && ( toUpperAscii(sSet) == "IBMPC" )))
 			{
 				aCharSet = RTL_TEXTENCODING_IBM_850;
 			}
 			else if (( sCharset == "CHARSET_ANSI" ) ||
 				( sCharset == "RTL_TEXTENCODING_MS_1252" ) ||
-				(( sCharset == "CHARSET" ) && ( ToUpperAscii(sSet) == "ANSI" )))
+				(( sCharset == "CHARSET" ) && ( toUpperAscii(sSet) == "ANSI" )))
 			{
 				aCharSet = RTL_TEXTENCODING_MS_1252;
 			}
 		}
 		break;
 		case TEXTREFID : {
-			bDontWriteOutput = TRUE;
+			bDontWriteOutput = true;
  			/*string sK = sToken.GetToken( 0, '=' );
-            string sKey = sK.EraseAllChars( '\t' ).EraseAllChars( ' ' );
+            string sKey = sK.eraseAllChars( '\t' ).eraseAllChars( ' ' );
 			string sT = sToken.GetToken( 1, '=' ).GetToken( 0, ';' );
-            USHORT nRefId = ( USHORT ) sT.EraseAllChars( '\t' ).EraseAllChars( ' ' ).ToInt32();
-			if (( sKey.ToUpperAscii() == "TEXT" ) ||
+            USHORT nRefId = ( USHORT ) sT.eraseAllChars( '\t' ).eraseAllChars( ' ' ).ToInt32();
+			if (( sKey.toUpperAscii() == "TEXT" ) ||
 				( sKey == "MESSAGE" ) ||
 				( sKey == "CUSTOMUNITTEXT" ) ||
 				( sKey == "SLOTNAME" ) ||
 	if ( bWriteToMerged ) {
 		// the current token must be written to dest. without merging
 		
-        if( bDefine && sOrig.Len() > 2 ){
-            for( USHORT n = 0 ; n < sOrig.Len() ; n++ ){
-                if( sOrig.GetChar( n ) == '\n' && sOrig.GetChar( n-1 ) != '\\'){    
-                    sOrig.Insert('\\' , n++ );
+        if( bDefine && sOrig.size() > 2 ){
+            for( unsigned int n = 0; n < sOrig.size(); n++ ){
+                if( sOrig.at( n ) == '\n' && sOrig.at( n-1 ) != '\\'){    
+                    sOrig.insert( n++, "\\" );
                 }
             }
         }
 void Export::CutComment( string &rText )
 /*****************************************************************************/
 {
-	if ( rText.Search( "//" ) != STRING_NOTFOUND ) {
+	if ( rText.find( "//" ) != string::npos ) {
 		string sWork( rText );
-		sWork.SearchAndReplaceAll( "\\\"", "XX" );
-		USHORT i = 0;
-		bool bInner = FALSE;
+        sWork = replace( sWork, "\\\"", "XX" );
+		//sWork.SearchAndReplaceAll( "\\\"", "XX" );
+		unsigned int i = 0;
+		bool bInner = false;
 
-		while ( i < sWork.Len() - 1 ) {
-			if ( sWork.GetChar( i ) == '\"' )
+		while ( i < sWork.size() - 1 ) {
+			if ( sWork.at( i ) == '\"' )
 				bInner = !bInner;
 			else if
-				(( sWork.GetChar( i ) == '/' ) &&
+				(( sWork.at( i ) == '/' ) &&
 				( !bInner ) &&
-				( sWork.GetChar( i + 1 ) == '/' ))
+				( sWork.at( i + 1 ) == '/' ))
 			{
-				rText.Erase( i );
+				rText.erase( i, 1 );
 				return;
 			}
 			i++;
 	}
 }
 
+    /*
 void Export::UnmergeUTF8( string& sOrig ){
-	USHORT nPos1 = sOrig.Search('\"');
-	USHORT nPos2 = sOrig.SearchBackward('\"');
+    //TODO: UTF8 conversion still necessary? It is not called anywhere
+    //...
+	unsigned int nPos1 = sOrig.find('\"');
+	unsigned int nPos2 = sOrig.find_last_of('\"');
 	if( nPos1 > 0 && nPos2 > 0 && nPos1 < nPos2){
-		string sPart = sOrig.Copy(nPos1+1 , nPos2-1);
+		string sPart = sOrig.substr(nPos1+1 , nPos2-nPos1-1);
 		string sPartUTF8 = sPart;
 		sPartUTF8.Convert( RTL_TEXTENCODING_MS_1252 , RTL_TEXTENCODING_UTF8 );
 		sOrig.SearchAndReplace( sPart , sPartUTF8 );
 	}
+
 }
+    */
+
 
 /*****************************************************************************/
 bool Export::ListExists( ResData *pResData, USHORT nLst )
    	// mandatory to export: en-US 
 	
      if (( //pResData->sText[ string("de") ].Len() &&
-        ( pResData->sText[ SOURCE_LANGUAGE ].Len()))
+        ( pResData->sText[ SOURCE_LANGUAGE ].size()))
         ||
         ( //pResData->sHelpText[ string("de") ].Len() &&
-        (  pResData->sHelpText[ SOURCE_LANGUAGE ].Len()))                                                                                                             
+        (  pResData->sHelpText[ SOURCE_LANGUAGE ].size()))                                                                                                             
         ||
         ( //pResData->sQuickHelpText[ string("de") ].Len() &&
-        (  pResData->sQuickHelpText[ SOURCE_LANGUAGE ].Len()))
+        (  pResData->sQuickHelpText[ SOURCE_LANGUAGE ].size()))
          ||
         ( //pResData->sTitle[ string("de") ].Len() &&
-        (  pResData->sTitle[ SOURCE_LANGUAGE ].Len())))
+        (  pResData->sTitle[ SOURCE_LANGUAGE ].size())))
            
    	{
 		FillInFallbacks( pResData );
 
 		string sGID = pResData->sGId;
 		string sLID;
-		if ( !sGID.Len())
+		if ( !sGID.size())
 			sGID = pResData->sId;
 		else
 			sLID = pResData->sId;
 
         for( unsigned int n = 0; n < aLanguages.size(); n++ ){
             sCur = aLanguages[ n ];
-                if ( !sCur.EqualsIgnoreCaseAscii("x-comment") ){
-                    if ( pResData->sText[ sCur ].Len())
+                if ( sCur != toLowerAscii( "x-comment" ) ) { //.EqualsIgnoreCaseAscii("x-comment") ){
+                    if ( pResData->sText[ sCur ].size())
                         sXText = pResData->sText[ sCur ];
 					else {
 						sXText = pResData->sText[ SOURCE_LANGUAGE ];
 							sXText = pResData->sText[ string("de") ];*/
 					}
 
-                    if ( pResData->sHelpText[ sCur ].Len())
+                    if ( pResData->sHelpText[ sCur ].size())
                         sXHText = pResData->sHelpText[ sCur ];
 					else {
 						sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ];
 							sXHText = pResData->sHelpText[ string("de") ];*/
 					}
 
-                    if ( pResData->sQuickHelpText[ sCur ].Len())
+                    if ( pResData->sQuickHelpText[ sCur ].size())
                         sXQHText = pResData->sQuickHelpText[ sCur ];
 					else {
 						sXQHText = pResData->sQuickHelpText[ SOURCE_LANGUAGE ];
 							sXQHText = pResData->sQuickHelpText[ string("de") ];*/
 					}
 
-                    if ( pResData->sTitle[ sCur ].Len())
+                    if ( pResData->sTitle[ sCur ].size())
                         sXTitle = pResData->sTitle[ sCur ];
 					else {
 						sXTitle = pResData->sTitle[ SOURCE_LANGUAGE ];
 							sXTitle = pResData->sTitle[ string("de") ];*/
 					}
 
-					if ( !sXText.Len())
+					if ( !sXText.size())
 						sXText = "-";
 
-					if ( !sXHText.Len()) {
+					if ( !sXHText.size()) {
 						/*if ( pResData->sHelpText[ string("de") ].Len())
 							sXHText = pResData->sHelpText[ string("de") ];*/
-						if ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len())
+						if ( pResData->sHelpText[ SOURCE_LANGUAGE ].size())
 							sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ];
 						/*else if ( pResData->sHelpText[ string("en") ].Len())
 							sXHText = pResData->sHelpText[ string("en") ];*/
 
 				if ( bEnableExport ) {
 					string sOutput( sProject ); sOutput += "\t";
-					if ( sRoot.Len())
+					if ( sRoot.size())
 						sOutput += sActFileName;
 					sOutput += "\t0\t";
 					sOutput += pResData->sResTyp; sOutput += "\t";
 					sOutput += sLID; sOutput += "\t";
 					sOutput += pResData->sHelpId; sOutput	+= "\t";
 					sOutput += pResData->sPForm; sOutput	+= "\t";
-					sOutput += string::CreateFromInt64( pResData->nWidth ); sOutput += "\t";
+					//sOutput += string::CreateFromInt64( pResData->nWidth ); sOutput += "\t";
+					sOutput += num( pResData->nWidth ); sOutput += "\t";
                     sOutput += sCur; sOutput += "\t";
-                    
 
 					sOutput += sXText; sOutput	+= "\t";
 					sOutput += sXHText; sOutput += "\t";
 					sOutput += sTimeStamp;
                   	
                  // if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sProject ) ) ) 
-				    aOutput.WriteLine( sOutput );
+				    aOutput << sOutput;
 				}
 
 				if ( bCreateNew ) {
 	}
 	return TRUE;
 }
+
 string Export::GetPairedListID( const string& sText ){
 // < "STRING" ; IDENTIFIER ; > ;
-    string sIdent = sText.GetToken( 1, ';' );
-    sIdent = ToUpperAscii( sIdent );
-    while( sIdent.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
-    sIdent.EraseTrailingChars( ' ' );
-	sIdent.EraseLeadingChars( ' ' );
+    string sIdent = getTokenAt(sText,";",1); //sText.GetToken( 1, ';' );
+    sIdent = toUpperAscii( sIdent );
+    //while( sIdent.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
+    sIdent = replace(sIdent, "\t", " " );
+    sIdent = strip(sIdent);
     return sIdent;
 }
+
 string Export::GetPairedListString( const string& sText ){
 // < "STRING" ; IDENTIFIER ; > ;
-	string sString = sText.GetToken( 0, ';' );
-    while( sString.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
-    sString.EraseTrailingChars( ' ' );
-	string s1 = sString.Copy( sString.Search( '\"' )+1 );
-	sString = s1.Copy( 0 , s1.SearchBackward( '\"' ) );
-	sString.EraseTrailingChars( ' ' );
-	sString.EraseLeadingChars( ' ' );
+	//string sString = sText.GetToken( 0, ';' );
+    string sString = getTokenAt(sText,";",0);
+    //while( sString.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
+    sString = replace(sString,"\t"," ");
+    //sString = stripTrailing( sString );
+    //sString.EraseTrailingChars( ' ' );
+	//string s1 = sString.Copy( sString.Search( '\"' )+1 );
+	//sString.Copy( sString.Search( '\"' )+1 );
+	//sString = s1.Copy( 0 , s1.SearchBackward( '\"' ) );
+    sString = extractStringDelimitedBy( sString );
+	sString = strip( sString ); //EraseTrailingChars( ' ' );
+	//sString.EraseLeadingChars( ' ' );
     return sString;
 }
-string Export::StripList( const string& sText ){
+
+string Export::StripList( const string& sText ) {
+    return extractStringDelimitedBy( sText );
+    /*
 	string s1 = sText.Copy( sText.Search( '\"' ) + 1 );
 	return s1.Copy( 0 , s1.SearchBackward( '\"' ) );
+    */
 }
 
 /*****************************************************************************/
 						sOutput += sTimeStamp;
 						
                         //if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sProject ) ) )
-                        aOutput.WriteLine( sOutput );
+                        aOutput << sOutput;
 
 					}
 				}
 		case LONGTEXTLINE: {
 			string sTmp( rSource.Copy( rSource.Search( "=" )));
 			CleanValue( sTmp );
-			sTmp.EraseAllChars( '\n' );
-			sTmp.EraseAllChars( '\r' );
+			sTmp = eraseAllChars( sTmp, '\n' );
+			sTmp = eraseAllChars( sTmp, '\r' );
 
 			while ( sTmp.SearchAndReplace( "\\\\\"", "-=<[BSlashBSlashHKom]>=-\"" )
 				!= STRING_NOTFOUND ) {};
         
         // Init Languages
         string sTmp = Export::sLanguages;
-        if( ToUpperAscii(sTmp) = "ALL" )
+        if( toUpperAscii(sTmp) = "ALL" )
             SetLanguages( pMergeDataFile->GetLanguages() );
         else if( !isInitialized )InitLanguages();
 
   
         // Init Languages
         string sTmp = Export::sLanguages;
-        if( ToUpperAscii(sTmp) == "ALL" )
+        if( toUpperAscii(sTmp) == "ALL" )
             SetLanguages( pMergeDataFile->GetLanguages() );
         else if( !isInitialized )InitLanguages();
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.