diff options
-rw-r--r-- | l10ntools/source/idxdict/idxdict.cxx | 34 | ||||
-rw-r--r-- | l10ntools/source/localize.cxx | 30 | ||||
-rw-r--r-- | l10ntools/source/xmlparse.cxx | 3 | ||||
-rw-r--r-- | l10ntools/source/xrmmerge.cxx | 8 | ||||
-rw-r--r-- | lingucomponent/source/languageguessing/guess.cxx | 2 | ||||
-rw-r--r-- | lingucomponent/source/languageguessing/simpleguesser.cxx | 28 | ||||
-rw-r--r-- | linguistic/source/convdic.cxx | 5 | ||||
-rw-r--r-- | linguistic/source/convdicxml.cxx | 3 |
8 files changed, 50 insertions, 63 deletions
diff --git a/l10ntools/source/idxdict/idxdict.cxx b/l10ntools/source/idxdict/idxdict.cxx index b931591b600b..6d2a22b3d048 100644 --- a/l10ntools/source/idxdict/idxdict.cxx +++ b/l10ntools/source/idxdict/idxdict.cxx @@ -17,13 +17,11 @@ const int MAXLINE = 1024*64; -using namespace std; - int main(int argc, char *argv[]) { if (argc != 3 || strcmp(argv[1],"-o")) { - cout << "Usage: idxdict -o outputfile < input\n"; + std::cout << "Usage: idxdict -o outputfile < input\n"; ::exit(99); } // This call improves performance by approx 5x @@ -31,27 +29,27 @@ int main(int argc, char *argv[]) const char * outputFile(argv[2]); char inputBuffer[MAXLINE]; - multimap<string, size_t> entries; - multimap<string,size_t>::iterator ret(entries.begin()); + std::multimap<std::string, size_t> entries; + std::multimap<std::string,size_t>::iterator ret(entries.begin()); - cin.getline(inputBuffer, MAXLINE); - const string encoding(inputBuffer); + std::cin.getline(inputBuffer, MAXLINE); + const std::string encoding(inputBuffer); size_t currentOffset(encoding.size()+1); while (true) { // Extract the next word, but not the entry count - cin.getline(inputBuffer, MAXLINE, '|'); + std::cin.getline(inputBuffer, MAXLINE, '|'); - if (cin.eof()) break; + if (std::cin.eof()) break; - string word(inputBuffer); - ret = entries.insert(ret, pair<string, size_t>(word, currentOffset)); + std::string word(inputBuffer); + ret = entries.insert(ret, std::pair<std::string, size_t>(word, currentOffset)); currentOffset += word.size() + 1; // Next is the entry count - cin.getline(inputBuffer, MAXLINE); - if (!cin.good()) + std::cin.getline(inputBuffer, MAXLINE); + if (!std::cin.good()) { - cerr << "Unable to read entry - insufficient buffer?.\n"; + std::cerr << "Unable to read entry - insufficient buffer?.\n"; exit(99); } currentOffset += strlen(inputBuffer)+1; @@ -60,23 +58,23 @@ int main(int argc, char *argv[]) int entryCount(strtol(inputBuffer, &endptr, 10)); if (errno != 0 || endptr == inputBuffer || *endptr != '\0') { - cerr + std::cerr << "Unable to read count from \"" << inputBuffer << "\" input.\n"; exit(99); } for (int i(0); i < entryCount; ++i) { - cin.getline(inputBuffer, MAXLINE); + std::cin.getline(inputBuffer, MAXLINE); currentOffset += strlen(inputBuffer)+1; } } // Use binary mode to prevent any translation of LF to CRLF on Windows - ofstream outputStream(outputFile, ios_base::binary| ios_base::trunc|ios_base::out); + std::ofstream outputStream(outputFile, std::ios_base::binary| std::ios_base::trunc|std::ios_base::out); if (!outputStream.is_open()) { - cerr << "Unable to open output file " << outputFile << endl; + std::cerr << "Unable to open output file " << outputFile << std::endl; ::exit(99); } diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index cede7837bdd3..a5a1b2c3b3ef 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -45,8 +45,6 @@ #include <po.hxx> -using namespace std; - namespace { bool matchList( @@ -113,7 +111,7 @@ void handleCommand( const OString cmd = buf.makeStringAndClear(); if (system(cmd.getStr()) != 0) { - cerr << "Error: Failed to execute " << cmd << '\n'; + std::cerr << "Error: Failed to execute " << cmd << '\n'; throw false; //TODO } } @@ -131,7 +129,7 @@ void InitPoFile( if (osl::FileBase::getFileURLFromSystemPath(outDir, outDirUrl) != osl::FileBase::E_None) { - cerr + std::cerr << ("Error: Cannot convert pathname to URL in " __FILE__ ", in line ") << __LINE__ << "\n outDir: " @@ -147,7 +145,7 @@ void InitPoFile( aPoOutPut.open(rOutPath.getStr()); if (!aPoOutPut.isOpen()) { - cerr + std::cerr << "Error: Cannot open po file " << rOutPath << "\n"; throw false; //TODO @@ -208,7 +206,7 @@ bool handleFile(std::string_view rProject, const OUString& rUrl, const OString& if (osl::FileBase::getSystemPathFromFileURL(rUrl, sInPathTmp) != osl::FileBase::E_None) { - cerr << "osl::FileBase::getSystemPathFromFileURL(" << rUrl << ") failed\n"; + std::cerr << "osl::FileBase::getSystemPathFromFileURL(" << rUrl << ") failed\n"; throw false; //TODO } sInPath = OUStringToOString( sInPathTmp, RTL_TEXTENCODING_UTF8 ); @@ -240,7 +238,7 @@ bool handleFile(std::string_view rProject, const OUString& rUrl, const OString& { if ( system(OString("rm " + sOutPath).getStr()) != 0 ) { - cerr + std::cerr << "Error: Cannot remove entryless pot file: " << sOutPath << "\n"; throw false; //TODO @@ -371,7 +369,7 @@ void handleDirectory( { osl::Directory dir(rUrl); if (dir.open() != osl::FileBase::E_None) { - cerr + std::cerr << "Error: Cannot open directory: " << rUrl << '\n'; throw false; //TODO } @@ -384,14 +382,14 @@ void handleDirectory( break; } if (e != osl::FileBase::E_None) { - cerr << "Error: Cannot read directory\n"; + std::cerr << "Error: Cannot read directory\n"; throw false; //TODO } osl::FileStatus stat( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL); if (item.getFileStatus(stat) != osl::FileBase::E_None) { - cerr << "Error: Cannot get file status\n"; + std::cerr << "Error: Cannot get file status\n"; throw false; //TODO } const OString sDirName = @@ -427,7 +425,7 @@ void handleDirectory( } if (dir.close() != osl::FileBase::E_None) { - cerr << "Error: Cannot close directory\n"; + std::cerr << "Error: Cannot close directory\n"; throw false; //TODO } @@ -443,7 +441,7 @@ void handleDirectory( if (osl::FileBase::getFileURLFromSystemPath(sPoPath, sPoUrl) != osl::FileBase::E_None) { - cerr + std::cerr << ("Error: Cannot convert pathname to URL in " __FILE__ ", in line ") << __LINE__ << "\n" @@ -464,14 +462,14 @@ void handleProjects(char const * sSourceRoot, char const * sDestRoot) | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) { - cerr << "Error: Cannot convert pathname to UTF-16\n"; + std::cerr << "Error: Cannot convert pathname to UTF-16\n"; throw false; //TODO } OUString rootUrl; if (osl::FileBase::getFileURLFromSystemPath(root16, rootUrl) != osl::FileBase::E_None) { - cerr + std::cerr << ("Error: Cannot convert pathname to URL in " __FILE__ ", in line ") << __LINE__ << "\n root16: " @@ -490,7 +488,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { if (argc != 3) { - cerr + std::cerr << ("localize (c)2001 by Sun Microsystems\n\n" "As part of the L10N framework, localize extracts en-US\n" "strings for translation out of the toplevel modules defined\n" @@ -502,7 +500,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } catch (std::exception& e) { - cerr << "exception: " << e.what() << std::endl; + std::cerr << "exception: " << e.what() << std::endl; return EXIT_FAILURE; } catch (bool) //TODO diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index b7bc613613e2..e7c4fad6eb95 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -34,7 +34,6 @@ #include <rtl/strbuf.hxx> #include <unicode/regex.h> -using namespace std; using namespace osl; #define XML_LANG "xml-lang" @@ -160,7 +159,7 @@ void XMLFile::Write( OString const &aFilename ) s.close(); } -void XMLFile::Write( ofstream &rStream , XMLNode *pCur ) +void XMLFile::Write( std::ofstream &rStream , XMLNode *pCur ) { if ( !pCur ) Write( rStream, this ); diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 29efe12099b9..d1dc5bb4dcd2 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -35,8 +35,6 @@ #include <vector> #include <memory> -using namespace std; - // set of global variables static bool bMergeMode; static bool bDisplayName; @@ -303,11 +301,11 @@ void XRMResExport::WorkOnDesc( { const OString sDescFileName{ sInputFileName.replaceAll("description.xml", OString()) + GetAttribute( rOpenTag, "xlink:href" ) }; - ifstream file (sDescFileName.getStr(), ios::in|ios::binary|ios::ate); + std::ifstream file (sDescFileName.getStr(), std::ios::in|std::ios::binary|std::ios::ate); if (file.is_open()) { int size = static_cast<int>(file.tellg()); std::unique_ptr<char[]> memblock(new char [size+1]); - file.seekg (0, ios::beg); + file.seekg (0, std::ios::beg); file.read (memblock.get(), size); file.close(); memblock[size] = '\0'; @@ -421,7 +419,7 @@ void XRMResMerge::WorkOnDesc( } OString sOutputDescFile( sOutputFile.subView(0, i + 1) + sLocDescFilename); - ofstream file(sOutputDescFile.getStr()); + std::ofstream file(sOutputDescFile.getStr()); if (file.is_open()) { file << sText; file.close(); diff --git a/lingucomponent/source/languageguessing/guess.cxx b/lingucomponent/source/languageguessing/guess.cxx index 45700ff7d1ff..e6eb506eb6fe 100644 --- a/lingucomponent/source/languageguessing/guess.cxx +++ b/lingucomponent/source/languageguessing/guess.cxx @@ -40,8 +40,6 @@ #define TEXTCAT_RESULT_SHORT_STR _TEXTCAT_RESULT_SHORT #endif -using namespace std; - Guess::Guess() : language_str(DEFAULT_LANGUAGE) , country_str(DEFAULT_COUNTRY) diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx index 76b3b65c3632..8c370b576315 100644 --- a/lingucomponent/source/languageguessing/simpleguesser.cxx +++ b/lingucomponent/source/languageguessing/simpleguesser.cxx @@ -50,8 +50,6 @@ #include<rtl/character.hxx> #include "simpleguesser.hxx" -using namespace std; - static int startsAsciiCaseInsensitive(const std::string &s1, const std::string &s2){ size_t i; int ret = 0; @@ -110,9 +108,9 @@ SimpleGuesser::~SimpleGuesser() /*! \fn SimpleGuesser::GuessLanguage(char* text) */ -vector<Guess> SimpleGuesser::GuessLanguage(const char* text) +std::vector<Guess> SimpleGuesser::GuessLanguage(const char* text) { - vector<Guess> guesses; + std::vector<Guess> guesses; if (!h) return guesses; @@ -148,7 +146,7 @@ vector<Guess> SimpleGuesser::GuessLanguage(const char* text) Guess SimpleGuesser::GuessPrimaryLanguage(const char* text) { - vector<Guess> ret = GuessLanguage(text); + std::vector<Guess> ret = GuessLanguage(text); return ret.empty() ? Guess() : ret[0]; } /** @@ -157,18 +155,18 @@ Guess SimpleGuesser::GuessPrimaryLanguage(const char* text) * when mask = 0x0F, return only Unavailable * when mask = 0xFF, return both Available and Unavailable */ -vector<Guess> SimpleGuesser::GetManagedLanguages(const char mask) +std::vector<Guess> SimpleGuesser::GetManagedLanguages(const char mask) { textcat_t *tables = static_cast<textcat_t*>(h); - vector<Guess> lang; + std::vector<Guess> lang; if(!h){return lang;} for (size_t i=0; i<tables->size; ++i) { if (tables->fprint_disable[i] & mask) { - string langStr = "["; + std::string langStr = "["; langStr += fp_Name(tables->fprint[i]); Guess g(langStr.c_str()); lang.push_back(g); @@ -178,22 +176,22 @@ vector<Guess> SimpleGuesser::GetManagedLanguages(const char mask) return lang; } -vector<Guess> SimpleGuesser::GetAvailableLanguages() +std::vector<Guess> SimpleGuesser::GetAvailableLanguages() { return GetManagedLanguages( sal::static_int_cast< char >( 0xF0 ) ); } -vector<Guess> SimpleGuesser::GetUnavailableLanguages() +std::vector<Guess> SimpleGuesser::GetUnavailableLanguages() { return GetManagedLanguages( sal::static_int_cast< char >( 0x0F )); } -vector<Guess> SimpleGuesser::GetAllManagedLanguages() +std::vector<Guess> SimpleGuesser::GetAllManagedLanguages() { return GetManagedLanguages( sal::static_int_cast< char >( 0xFF )); } -void SimpleGuesser::XableLanguage(const string& lang, char mask) +void SimpleGuesser::XableLanguage(const std::string& lang, char mask) { textcat_t *tables = static_cast<textcat_t*>(h); @@ -201,18 +199,18 @@ void SimpleGuesser::XableLanguage(const string& lang, char mask) for (size_t i=0; i<tables->size; i++) { - string language(fp_Name(tables->fprint[i])); + std::string language(fp_Name(tables->fprint[i])); if (startsAsciiCaseInsensitive(language,lang) == 0) tables->fprint_disable[i] = mask; } } -void SimpleGuesser::EnableLanguage(const string& lang) +void SimpleGuesser::EnableLanguage(const std::string& lang) { XableLanguage(lang, sal::static_int_cast< char >( 0xF0 )); } -void SimpleGuesser::DisableLanguage(const string& lang) +void SimpleGuesser::DisableLanguage(const std::string& lang) { XableLanguage(lang, sal::static_int_cast< char >( 0x0F )); } diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index 573e2eb04517..8d0f5bf50d26 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -52,7 +52,6 @@ #include "convdicxml.hxx" #include <linguistic/misc.hxx> -using namespace std; using namespace utl; using namespace osl; using namespace com::sun::star; @@ -246,7 +245,7 @@ void ConvDic::Save() ConvMap::iterator ConvDic::GetEntry( ConvMap &rMap, const OUString &rFirstText, std::u16string_view rSecondText ) { - pair< ConvMap::iterator, ConvMap::iterator > aRange = + std::pair< ConvMap::iterator, ConvMap::iterator > aRange = rMap.equal_range( rFirstText ); ConvMap::iterator aPos = rMap.end(); for (ConvMap::iterator aIt = aRange.first; @@ -379,7 +378,7 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversions( OUString aLookUpText( aText.copy(nStartPos, nLength) ); ConvMap &rConvMap = eDirection == ConversionDirection_FROM_LEFT ? aFromLeft : *pFromRight; - pair< ConvMap::iterator, ConvMap::iterator > aRange = + std::pair< ConvMap::iterator, ConvMap::iterator > aRange = rConvMap.equal_range( aLookUpText ); std::vector<OUString> aRes; diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx index e9ac72be3769..8b23e93981af 100644 --- a/linguistic/source/convdicxml.cxx +++ b/linguistic/source/convdicxml.cxx @@ -34,7 +34,6 @@ #include "convdicxml.hxx" #include <linguistic/misc.hxx> -using namespace std; using namespace utl; using namespace com::sun::star; using namespace com::sun::star::lang; @@ -311,7 +310,7 @@ void ConvDicXMLExport::ExportContent_() SvXMLElementExport aEntryMain( *this, XML_NAMESPACE_TCD, "entry" , true, true ); - pair< ConvMap::iterator, ConvMap::iterator > aRange = + std::pair< ConvMap::iterator, ConvMap::iterator > aRange = rDic.aFromLeft.equal_range(aLeftText); for (auto aIt = aRange.first; aIt != aRange.second; ++aIt) { |