drop 'using namespace std' in s* + toolkit
Change-Id: Ibd0b983d46a5683df64b4de79cd444427705e9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123118 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
parent
3068ab9a2c
commit
1f90b8086f
13 changed files with 75 additions and 95 deletions
|
@ -16,47 +16,45 @@
|
|||
#include <string>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const string optsintro("--");
|
||||
map<string, string> vartofile;
|
||||
const std::string optsintro("--");
|
||||
std::map<std::string, std::string> vartofile;
|
||||
for(int i=1; i < argc; ++i)
|
||||
{
|
||||
const string arg(argv[i]);
|
||||
const std::string arg(argv[i]);
|
||||
if(arg.substr(0,2) != optsintro)
|
||||
{
|
||||
cerr << "Only option args starting with -- allowed." << endl;
|
||||
std::cerr << "Only option args starting with -- allowed." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
const size_t eqpos = arg.find("=", 2);
|
||||
if(eqpos == string::npos)
|
||||
if(eqpos == std::string::npos)
|
||||
{
|
||||
cerr << "Only option args assigning with = allowed." << endl;
|
||||
std::cerr << "Only option args assigning with = allowed." << std::endl;
|
||||
return 2;
|
||||
}
|
||||
const string argname(arg.substr(2, eqpos-2));
|
||||
vartofile[argname] = arg.substr(eqpos+1, string::npos);
|
||||
const std::string argname(arg.substr(2, eqpos-2));
|
||||
vartofile[argname] = arg.substr(eqpos+1, std::string::npos);
|
||||
}
|
||||
cout << "{";
|
||||
std::cout << "{";
|
||||
bool first(true);
|
||||
for(const auto& varandfile : vartofile)
|
||||
{
|
||||
if(first)
|
||||
first =false;
|
||||
else
|
||||
cout << "," << endl;
|
||||
string varupper(varandfile.first);
|
||||
std::cout << "," << std::endl;
|
||||
std::string varupper(varandfile.first);
|
||||
for(auto& c : varupper)
|
||||
if(c != '_')
|
||||
c = c-32;
|
||||
ifstream filestream(varandfile.second.c_str());
|
||||
stringstream contents;
|
||||
std::ifstream filestream(varandfile.second.c_str());
|
||||
std::stringstream contents;
|
||||
contents << filestream.rdbuf();
|
||||
filestream.close();
|
||||
(void)remove(varandfile.second.c_str());
|
||||
string escapedcontents;
|
||||
std::string escapedcontents;
|
||||
for(const auto& c : contents.str())
|
||||
{
|
||||
if(c=='\\')
|
||||
|
@ -68,9 +66,9 @@ int main(int argc, char** argv)
|
|||
else
|
||||
escapedcontents += c;
|
||||
}
|
||||
cout << "\"" << varupper << "\": \"" << escapedcontents << "\"";
|
||||
std::cout << "\"" << varupper << "\": \"" << escapedcontents << "\"";
|
||||
}
|
||||
cout << "}" << endl;
|
||||
std::cout << "}" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -9,19 +9,17 @@
|
|||
|
||||
#include "wrapper.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
vector<string> rawargs(argv + 1, argv + argc);
|
||||
std::vector<std::string> rawargs(argv + 1, argv + argc);
|
||||
|
||||
string env_prefix; // defaults to REAL_
|
||||
std::string env_prefix; // defaults to REAL_
|
||||
bool verbose = false;
|
||||
string args = processccargs(rawargs, env_prefix, verbose);
|
||||
std::string args = processccargs(rawargs, env_prefix, verbose);
|
||||
|
||||
string command = getexe(env_prefix + "CXX");
|
||||
string flags = getexe(env_prefix + "CXX_FLAGS", true);
|
||||
args.insert(0, flags.empty() ? string() : flags + " ");
|
||||
std::string command = getexe(env_prefix + "CXX");
|
||||
std::string flags = getexe(env_prefix + "CXX_FLAGS", true);
|
||||
args.insert(0, flags.empty() ? std::string() : flags + " ");
|
||||
|
||||
setupccenv();
|
||||
|
||||
|
|
|
@ -9,19 +9,17 @@
|
|||
|
||||
#include "wrapper.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
vector<string> rawargs(argv + 1, argv + argc);
|
||||
std::vector<std::string> rawargs(argv + 1, argv + argc);
|
||||
|
||||
string env_prefix; // defaults to REAL_
|
||||
std::string env_prefix; // defaults to REAL_
|
||||
bool verbose = false;
|
||||
string args = processccargs(rawargs, env_prefix, verbose);
|
||||
std::string args = processccargs(rawargs, env_prefix, verbose);
|
||||
|
||||
string command = getexe(env_prefix + "CC");
|
||||
string flags = getexe(env_prefix + "CC_FLAGS", true);
|
||||
args.insert(0, flags.empty() ? string() : flags + " ");
|
||||
std::string command = getexe(env_prefix + "CC");
|
||||
std::string flags = getexe(env_prefix + "CC_FLAGS", true);
|
||||
args.insert(0, flags.empty() ? std::string() : flags + " ");
|
||||
|
||||
setupccenv();
|
||||
|
||||
|
|
|
@ -15,27 +15,25 @@
|
|||
|
||||
#define BUFLEN 2048
|
||||
|
||||
using namespace std;
|
||||
|
||||
string getexe(string exename, bool maybeempty) {
|
||||
std::string getexe(std::string exename, bool maybeempty) {
|
||||
char* cmdbuf;
|
||||
size_t cmdlen;
|
||||
_dupenv_s(&cmdbuf,&cmdlen,exename.c_str());
|
||||
if(!cmdbuf) {
|
||||
if (maybeempty) {
|
||||
return string();
|
||||
return std::string();
|
||||
}
|
||||
cout << "Error " << exename << " not defined. Did you forget to source the environment?" << endl;
|
||||
std::cout << "Error " << exename << " not defined. Did you forget to source the environment?" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
string command(cmdbuf);
|
||||
std::string command(cmdbuf);
|
||||
free(cmdbuf);
|
||||
return command;
|
||||
}
|
||||
|
||||
void setupccenv() {
|
||||
// Set-up library path
|
||||
string libpath="LIB=";
|
||||
std::string libpath="LIB=";
|
||||
char* libbuf;
|
||||
size_t liblen;
|
||||
_dupenv_s(&libbuf,&liblen,"ILIB");
|
||||
|
@ -46,12 +44,12 @@ void setupccenv() {
|
|||
libpath.append(libbuf);
|
||||
free(libbuf);
|
||||
if(_putenv(libpath.c_str())<0) {
|
||||
cerr << "Error: could not export LIB" << endl;
|
||||
std::cerr << "Error: could not export LIB" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Set-up include path
|
||||
string includepath="INCLUDE=.";
|
||||
std::string includepath="INCLUDE=.";
|
||||
char* incbuf;
|
||||
size_t inclen;
|
||||
_dupenv_s(&incbuf,&inclen,"SOLARINC");
|
||||
|
@ -59,13 +57,13 @@ void setupccenv() {
|
|||
std::cerr << "No environment variable SOLARINC" << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
string inctmp(incbuf);
|
||||
std::string inctmp(incbuf);
|
||||
free(incbuf);
|
||||
|
||||
// 3 = strlen(" -I")
|
||||
for(size_t pos=0,len=0;pos<inctmp.length();) {
|
||||
size_t endpos=inctmp.find(" -I",pos+1);
|
||||
if(endpos==string::npos)
|
||||
if(endpos==std::string::npos)
|
||||
endpos=inctmp.length();
|
||||
len=endpos-pos;
|
||||
|
||||
|
@ -79,12 +77,12 @@ void setupccenv() {
|
|||
pos=endpos;
|
||||
}
|
||||
if(_putenv(includepath.c_str())<0) {
|
||||
cerr << "Error: could not export INCLUDE" << endl;
|
||||
std::cerr << "Error: could not export INCLUDE" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
||||
std::string processccargs(std::vector<std::string> rawargs, std::string &env_prefix, bool &verbose)
|
||||
{
|
||||
// default env var prefix
|
||||
env_prefix = "REAL_";
|
||||
|
@ -92,7 +90,7 @@ string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
|||
bool env_prefix_next_arg = false;
|
||||
|
||||
// suppress the msvc banner
|
||||
string args=" -nologo";
|
||||
std::string args=" -nologo";
|
||||
// TODO: should these options be enabled globally?
|
||||
args.append(" -EHsc");
|
||||
const char *const pDebugRuntime(getenv("MSVC_USE_DEBUG_RUNTIME"));
|
||||
|
@ -106,13 +104,13 @@ string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
|||
// apparently these must be at the end
|
||||
// otherwise configure tests may fail
|
||||
// note: always use -debug so a PDB file is created
|
||||
string linkargs(" -link -debug");
|
||||
std::string linkargs(" -link -debug");
|
||||
|
||||
// instead of using synced PDB access (-FS), use individual PDB files based on output
|
||||
const char *const pEnvIndividualPDBs(getenv("MSVC_USE_INDIVIDUAL_PDBS"));
|
||||
const bool bIndividualPDBs = (pEnvIndividualPDBs && !strcmp(pEnvIndividualPDBs, "TRUE"));
|
||||
|
||||
for(vector<string>::iterator i = rawargs.begin(); i != rawargs.end(); ++i) {
|
||||
for(std::vector<std::string>::iterator i = rawargs.begin(); i != rawargs.end(); ++i) {
|
||||
if (env_prefix_next_arg)
|
||||
{
|
||||
env_prefix = *i;
|
||||
|
@ -140,21 +138,21 @@ string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
|||
linkargs.append(" -dll -out:");
|
||||
linkargs.append(*i);
|
||||
}
|
||||
else if (dot == string::npos)
|
||||
else if (dot == std::string::npos)
|
||||
{
|
||||
args.append("-Fe");
|
||||
args.append(*i + ".exe");
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "unknown -o argument - please adapt gcc-wrapper for \""
|
||||
<< (*i) << "\"" << endl;
|
||||
std::cerr << "unknown -o argument - please adapt gcc-wrapper for \""
|
||||
<< (*i) << "\"" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (bIndividualPDBs)
|
||||
{
|
||||
if (dot == string::npos)
|
||||
if (dot == std::string::npos)
|
||||
args.append(" -Fd" + *i + ".pdb");
|
||||
else
|
||||
args.append(" -Fd" + (*i).substr(0, dot) + ".pdb");
|
||||
|
@ -167,7 +165,7 @@ string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
|||
}
|
||||
else if(!(*i).compare(0,2,"-D")) {
|
||||
// need to re-escape strings for preprocessor
|
||||
for(size_t pos=(*i).find("\""); pos!=string::npos; pos=(*i).find("\"",pos)) {
|
||||
for(size_t pos=(*i).find("\""); pos!=std::string::npos; pos=(*i).find("\"",pos)) {
|
||||
(*i).replace(pos,0,"\\");
|
||||
pos+=2;
|
||||
}
|
||||
|
@ -199,7 +197,7 @@ string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
|||
size_t pos = i->find("=");
|
||||
if (0 == i->compare(0, pos, "--wrapper-env-prefix"))
|
||||
{
|
||||
if (pos == string::npos)
|
||||
if (pos == std::string::npos)
|
||||
env_prefix_next_arg = true;
|
||||
else if (pos + 1 == i->length())
|
||||
{
|
||||
|
@ -217,7 +215,7 @@ string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
|||
|
||||
if (env_prefix_next_arg)
|
||||
{
|
||||
cerr << "wrapper-env-prefix needs an argument!" << endl;
|
||||
std::cerr << "wrapper-env-prefix needs an argument!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -225,7 +223,7 @@ string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
|
|||
return args;
|
||||
}
|
||||
|
||||
int startprocess(string command, string args, bool verbose)
|
||||
int startprocess(std::string command, std::string args, bool verbose)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
@ -242,7 +240,7 @@ int startprocess(string command, string args, bool verbose)
|
|||
sa.bInheritHandle=TRUE;
|
||||
|
||||
if(!CreatePipe(&childout_read,&childout_write,&sa,0)) {
|
||||
cerr << "Error: could not create stdout pipe" << endl;
|
||||
std::cerr << "Error: could not create stdout pipe" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -253,7 +251,7 @@ int startprocess(string command, string args, bool verbose)
|
|||
|
||||
// support ccache
|
||||
size_t pos=command.find("ccache ");
|
||||
if(pos != string::npos) {
|
||||
if(pos != std::string::npos) {
|
||||
args.insert(0,"cl.exe");
|
||||
command=command.substr(0,pos+strlen("ccache"))+".exe";
|
||||
}
|
||||
|
@ -261,7 +259,7 @@ int startprocess(string command, string args, bool verbose)
|
|||
auto cmdline = "\"" + command + "\" " + args;
|
||||
|
||||
if (verbose)
|
||||
cerr << "CMD= " << command << " " << args << endl;
|
||||
std::cerr << "CMD= " << command << " " << args << std::endl;
|
||||
|
||||
// Commandline may be modified by CreateProcess
|
||||
char* cmdlineBuf=_strdup(cmdline.c_str());
|
||||
|
@ -278,7 +276,7 @@ int startprocess(string command, string args, bool verbose)
|
|||
&pi) // Process Information
|
||||
) {
|
||||
auto const e = GetLastError();
|
||||
cerr << "Error: could not create process \"" << cmdlineBuf << "\": " << e << endl;
|
||||
std::cerr << "Error: could not create process \"" << cmdlineBuf << "\": " << e << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -295,7 +293,7 @@ int startprocess(string command, string args, bool verbose)
|
|||
if(GetLastError()==ERROR_BROKEN_PIPE)
|
||||
break;
|
||||
if(!success) {
|
||||
cerr << "Error: could not read from subprocess stdout" << endl;
|
||||
std::cerr << "Error: could not read from subprocess stdout" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
if(readlen!=0) {
|
||||
|
|
|
@ -2,22 +2,20 @@
|
|||
#include "collectdircontent.hxx"
|
||||
#include <rtl/character.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
PathFilePair IncludesCollection::split_path(const string& filePath) {
|
||||
string sepU = "/";
|
||||
string sepW = "\\";
|
||||
string::size_type pos = filePath.rfind (sepU);
|
||||
string::size_type posW = filePath.rfind (sepW);
|
||||
if ((posW != string::npos) && ((posW > pos) || (pos == string::npos))) pos = posW;
|
||||
if (pos != string::npos) {
|
||||
string dirName = filePath.substr(0, pos);
|
||||
PathFilePair IncludesCollection::split_path(const std::string& filePath) {
|
||||
std::string sepU = "/";
|
||||
std::string sepW = "\\";
|
||||
std::string::size_type pos = filePath.rfind (sepU);
|
||||
std::string::size_type posW = filePath.rfind (sepW);
|
||||
if ((posW != std::string::npos) && ((posW > pos) || (pos == std::string::npos))) pos = posW;
|
||||
if (pos != std::string::npos) {
|
||||
std::string dirName = filePath.substr(0, pos);
|
||||
return PathFilePair(dirName, filePath.substr(pos + 1, filePath.length()));
|
||||
} else
|
||||
return PathFilePair(".", filePath);
|
||||
}
|
||||
|
||||
void IncludesCollection::add_to_collection(const string& dirPath) {
|
||||
void IncludesCollection::add_to_collection(const std::string& dirPath) {
|
||||
DirContent dirContent;
|
||||
#if defined(_WIN32)
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
|
@ -29,7 +27,7 @@ void IncludesCollection::add_to_collection(const string& dirPath) {
|
|||
return;
|
||||
}
|
||||
do {
|
||||
string winFileName(FindFileData.cFileName);
|
||||
std::string winFileName(FindFileData.cFileName);
|
||||
transform(
|
||||
winFileName.begin(), winFileName.end(), winFileName.begin(),
|
||||
[](char c) {
|
||||
|
@ -54,7 +52,7 @@ void IncludesCollection::add_to_collection(const string& dirPath) {
|
|||
allIncludes.insert(EntriesPair(dirPath, dirContent));
|
||||
}
|
||||
|
||||
bool IncludesCollection::exists(string filePath) {
|
||||
bool IncludesCollection::exists(std::string filePath) {
|
||||
#if defined(_WIN32)
|
||||
transform(
|
||||
filePath.begin(), filePath.end(), filePath.begin(),
|
||||
|
@ -63,8 +61,8 @@ bool IncludesCollection::exists(string filePath) {
|
|||
});
|
||||
#endif // defined( _WIN32 )
|
||||
PathFilePair dirFile = split_path(filePath);
|
||||
string dirPath = dirFile.first;
|
||||
string fileName = dirFile.second;
|
||||
std::string dirPath = dirFile.first;
|
||||
std::string fileName = dirFile.second;
|
||||
DirMap::iterator mapIter = allIncludes.find(dirPath);
|
||||
if (mapIter == allIncludes.end()) {
|
||||
add_to_collection(dirPath);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
using namespace cppu;
|
||||
using namespace osl;
|
||||
using namespace std;
|
||||
|
||||
using namespace css::uno;
|
||||
using namespace css::lang;
|
||||
|
|
|
@ -64,7 +64,6 @@ using namespace css::lang;
|
|||
using namespace css::container;
|
||||
using namespace cppu;
|
||||
using namespace osl;
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -1123,7 +1122,7 @@ void OServiceManager::remove( const Any & Element )
|
|||
const Sequence< OUString > aServiceNames = xSF->getSupportedServiceNames();
|
||||
for( const OUString& rServiceName : aServiceNames )
|
||||
{
|
||||
pair<HashMultimap_OWString_Interface::iterator, HashMultimap_OWString_Interface::iterator> p =
|
||||
std::pair<HashMultimap_OWString_Interface::iterator, HashMultimap_OWString_Interface::iterator> p =
|
||||
m_ServiceMap.equal_range( rServiceName );
|
||||
|
||||
while( p.first != p.second )
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include <cppuhelper/implbase.hxx>
|
||||
#include <uno/current_context.hxx>
|
||||
|
||||
using namespace std;
|
||||
using namespace cppu;
|
||||
using namespace css::uno;
|
||||
using namespace css::lang;
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <com/sun/star/registry/XImplementationRegistration.hpp>
|
||||
#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace cppu;
|
||||
using namespace css::uno;
|
||||
using namespace css::lang;
|
||||
|
|
|
@ -2370,8 +2370,6 @@ OUString SvNumberformat::GetIntegerFractionDelimiterString( sal_uInt16 nNumFor )
|
|||
|
||||
bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, OUString& rOutString) const
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
if (eType != SvNumFormatType::NUMBER)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::lang;
|
||||
|
@ -96,10 +95,10 @@ class ImplRulerData
|
|||
friend class Ruler;
|
||||
|
||||
private:
|
||||
vector<RulerLine> pLines;
|
||||
vector<RulerBorder> pBorders;
|
||||
vector<RulerIndent> pIndents;
|
||||
vector<RulerTab> pTabs;
|
||||
std::vector<RulerLine> pLines;
|
||||
std::vector<RulerBorder> pBorders;
|
||||
std::vector<RulerIndent> pIndents;
|
||||
std::vector<RulerTab> pTabs;
|
||||
|
||||
tools::Long nNullVirOff;
|
||||
tools::Long nRulVirOff;
|
||||
|
@ -2501,7 +2500,7 @@ void Ruler::SetLines( sal_uInt32 aLineArraySize, const RulerLine* pLineArray )
|
|||
if ( mpData->pLines.size() == aLineArraySize )
|
||||
{
|
||||
sal_uInt32 i = aLineArraySize;
|
||||
vector<RulerLine>::const_iterator aItr1 = mpData->pLines.begin();
|
||||
std::vector<RulerLine>::const_iterator aItr1 = mpData->pLines.begin();
|
||||
const RulerLine* pAry2 = pLineArray;
|
||||
while ( i )
|
||||
{
|
||||
|
@ -2644,7 +2643,7 @@ void Ruler::SetTabs( sal_uInt32 aTabArraySize, const RulerTab* pTabArray )
|
|||
else
|
||||
{
|
||||
sal_uInt32 i = aTabArraySize;
|
||||
vector<RulerTab>::iterator aTabIterator = mpData->pTabs.begin();
|
||||
std::vector<RulerTab>::iterator aTabIterator = mpData->pTabs.begin();
|
||||
const RulerTab* pInputArray = pTabArray;
|
||||
while ( i )
|
||||
{
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "ServerDetailsControls.hxx"
|
||||
|
||||
using namespace std;
|
||||
using namespace com::sun::star::sdbc;
|
||||
using namespace com::sun::star::task;
|
||||
using namespace com::sun::star::ucb;
|
||||
|
|
|
@ -29,8 +29,6 @@ using namespace com::sun::star::container;
|
|||
using namespace com::sun::star::registry;
|
||||
using namespace com::sun::star::script;
|
||||
using namespace cppu;
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace toolkit
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue