summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-10-04 21:21:31 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-10-04 22:30:42 +0200
commit2f54c40fc28294676a129cfa86eed39f974a9e24 (patch)
tree2c9584edf3f1f5a0c8f6b3a65d0f47e92bce92dd /l10ntools
parentbf82274d327146ec0aa2b4f8a0e6d1bf24366cb3 (diff)
drop 'using namespace std' in l*
Change-Id: I88909cf813f39a52c70d3cbcb19ff326d9bb42d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123069 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/idxdict/idxdict.cxx34
-rw-r--r--l10ntools/source/localize.cxx30
-rw-r--r--l10ntools/source/xmlparse.cxx3
-rw-r--r--l10ntools/source/xrmmerge.cxx8
4 files changed, 34 insertions, 41 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();