convert IDL module from String to OUString

Change-Id: Idf8e0e02ee2fde23959a281cc6ffa1a43ee7f239
This commit is contained in:
Noel Grandin
2013-09-16 07:56:50 +02:00
parent ed53efd9db
commit 73c560a63e
9 changed files with 57 additions and 63 deletions

View File

@@ -24,7 +24,7 @@
#include <rtl/ustring.hxx>
#include <vector>
typedef ::std::vector< String* > StringList;
typedef ::std::vector< OUString > StringList;
typedef ::std::vector< OString* > ByteStringList;
class SvCommand
@@ -35,8 +35,8 @@ public:
OUString aListFile;
OUString aSlotMapFile;
OUString aSfxItemFile;
String aPath;
String aTargetFile;
OUString aPath;
OUString aTargetFile;
OUString aHelpIdFile;
OUString aCSVFile;
OUString aExportFile;

View File

@@ -56,10 +56,10 @@ public:
class SvIdlDataBase
{
sal_Bool bExport;
String aExportFile;
OUString aExportFile;
sal_uInt32 nUniqueId;
sal_uInt32 nVerbosity;
String aDataBaseFile;
OUString aDataBaseFile;
SvPersistStream aPersStream;
StringList aIdFileList;
SvStringHashTable * pIdTable;
@@ -73,7 +73,7 @@ class SvIdlDataBase
protected:
::std::set< OUString > m_DepFiles;
SvMetaObjectMemberStack aContextStack;
String aPath;
OUString aPath;
SvIdlError aError;
void WriteReset()
{
@@ -100,15 +100,15 @@ public:
OString aIFaceName;
SvNumberIdentifier aStructSlotId;
void StartNewFile( const String& rName );
void SetExportFile( const String& rName )
void StartNewFile( const OUString& rName );
void SetExportFile( const OUString& rName )
{ aExportFile = rName; }
void AppendAttr( SvMetaAttribute *pSlot );
const SvIdlError & GetError() const { return aError; }
void SetError( const SvIdlError & r )
{ aError = r; }
const String & GetPath() const { return aPath; }
const OUString & GetPath() const { return aPath; }
SvMetaObjectMemberStack & GetStack() { return aContextStack; }
void Write(const OString& rText);
@@ -131,7 +131,7 @@ public:
sal_uInt32 GetUniqueId() { return ++nUniqueId; }
sal_Bool FindId( const OString& rIdName, sal_uLong * pVal );
sal_Bool InsertId( const OString& rIdName, sal_uLong nVal );
sal_Bool ReadIdFile( const String & rFileName );
sal_Bool ReadIdFile( const OUString & rFileName );
SvMetaType * FindType( const OString& rName );
static SvMetaType * FindType( const SvMetaType *, SvMetaTypeMemberList & );
@@ -141,7 +141,7 @@ public:
SvMetaType * pType = NULL );
SvMetaAttribute * SearchKnownAttr( const SvNumberIdentifier& );
SvMetaClass * ReadKnownClass( SvTokenStream & rInStm );
void AddDepFile(String const& rFileName);
void AddDepFile(OUString const& rFileName);
bool WriteDepFile(SvFileStream & rStream, OUString const& rTarget);
};
@@ -150,7 +150,7 @@ class SvIdlWorkingBase : public SvIdlDataBase
public:
explicit SvIdlWorkingBase( const SvCommand& rCmd );
sal_Bool ReadSvIdl( SvTokenStream &, sal_Bool bImported, const String & rPath );
sal_Bool ReadSvIdl( SvTokenStream &, sal_Bool bImported, const OUString & rPath );
sal_Bool WriteSvIdl( SvStream & );
sal_Bool WriteSfx( SvStream & );

View File

@@ -130,7 +130,7 @@ class SvTokenStream
SvFileStream * pInStream;
SvStream & rInStream;
String aFileName;
OUString aFileName;
boost::ptr_vector<SvToken> aTokList;
boost::ptr_vector<SvToken>::iterator pCurToken;
@@ -165,12 +165,12 @@ class SvTokenStream
}
}
public:
SvTokenStream( const String & rFileName );
SvTokenStream( SvStream & rInStream, const String & rFileName );
SvTokenStream( const OUString & rFileName );
SvTokenStream( SvStream & rInStream, const OUString & rFileName );
~SvTokenStream();
const String & GetFileName() const { return aFileName; }
SvStream & GetStream() { return rInStream; }
const OUString & GetFileName() const { return aFileName; }
SvStream & GetStream() { return rInStream; }
void SetTabSize( sal_uInt16 nTabSizeP )
{ nTabSize = nTabSizeP; }

View File

@@ -38,7 +38,7 @@ class SvMetaModule : public SvMetaExtern
SvMetaTypeMemberList aTypeList;
SvMetaAttributeMemberList aAttrList;
// browser
String aIdlFileName;
OUString aIdlFileName;
SvString aHelpFileName;
SvString aSlotIdFile;
SvString aTypeLibFile;
@@ -58,7 +58,7 @@ public:
SV_DECL_META_FACTORY1( SvMetaModule, SvMetaExtern, 13 )
SvMetaModule();
const String & GetIdlFileName() const { return aIdlFileName; }
const OUString & GetIdlFileName() const { return aIdlFileName; }
const OString& GetModulePrefix() const { return aModulePrefix.getString(); }
virtual sal_Bool SetName( const OString& rName, SvIdlDataBase * = NULL );
@@ -70,7 +70,7 @@ public:
const SvMetaTypeMemberList & GetTypeList() const { return aTypeList; }
const SvMetaClassMemberList & GetClassList() const { return aClassList; }
SvMetaModule( const String & rIdlFileName,
SvMetaModule( const OUString & rIdlFileName,
sal_Bool bImported );
sal_Bool FillNextName( SvGlobalName * );

View File

@@ -95,7 +95,7 @@ void SvTokenStream::InitCtor()
FillTokenList();
}
SvTokenStream::SvTokenStream( const String & rFileName )
SvTokenStream::SvTokenStream( const OUString & rFileName )
: pInStream( new SvFileStream( rFileName, STREAM_STD_READ | STREAM_NOCREATE ) )
, rInStream( *pInStream )
, aFileName( rFileName )
@@ -103,7 +103,7 @@ SvTokenStream::SvTokenStream( const String & rFileName )
InitCtor();
}
SvTokenStream::SvTokenStream( SvStream & rStream, const String & rFileName )
SvTokenStream::SvTokenStream( SvStream & rStream, const OUString & rFileName )
: pInStream( NULL )
, rInStream( rStream )
, aFileName( rFileName )

View File

@@ -35,7 +35,7 @@ SvMetaModule::SvMetaModule()
{
}
SvMetaModule::SvMetaModule( const String & rIdlFileName, sal_Bool bImp )
SvMetaModule::SvMetaModule( const OUString & rIdlFileName, sal_Bool bImp )
: aIdlFileName( rIdlFileName )
, bImported( bImp ), bIsModified( sal_False )
{

View File

@@ -134,7 +134,7 @@ sal_Bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand )
{
for( size_t n = 0; n < rCommand.aInFileList.size(); ++n )
{
String aFileName ( *rCommand.aInFileList[ n ] );
OUString aFileName ( rCommand.aInFileList[ n ] );
pDataBase->AddDepFile(aFileName);
SvFileStream aStm( aFileName, STREAM_STD_READ | STREAM_NOCREATE );
if( aStm.GetError() == SVSTREAM_OK )
@@ -178,7 +178,7 @@ sal_Bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand )
static sal_Bool ResponseFile( StringList * pList, int argc, char ** argv )
{
// program name
pList->push_back( new String(OUString::createFromAscii(*argv) ) );
pList->push_back( OUString::createFromAscii(*argv) );
for( int i = 1; i < argc; i++ )
{
if( '@' == **(argv +i) )
@@ -200,12 +200,12 @@ static sal_Bool ResponseFile( StringList * pList, int argc, char ** argv )
while( aStr[n] && !isspace( aStr[n] ) )
n++;
if( n != nPos )
pList->push_back( new String( OStringToOUString(aStr.copy(nPos, n - nPos), RTL_TEXTENCODING_ASCII_US) ) );
pList->push_back( OStringToOUString(aStr.copy(nPos, n - nPos), RTL_TEXTENCODING_ASCII_US) );
}
}
}
else if( argv[ i ] )
pList->push_back( new String( OUString::createFromAscii( argv[ i ] ) ) );
pList->push_back( OUString::createFromAscii( argv[ i ] ) );
}
return sal_True;
}
@@ -219,17 +219,17 @@ SvCommand::SvCommand( int argc, char ** argv )
{
for( size_t i = 1; i < aList.size(); i++ )
{
String aParam( *aList[ i ] );
sal_Unicode aFirstChar( aParam.GetChar(0) );
OUString aParam( aList[ i ] );
sal_Unicode aFirstChar( aParam[0] );
if( '-' == aFirstChar )
{
aParam.Erase( 0, 1 );
aFirstChar = aParam.GetChar(0);
aParam = aParam.copy( 1 );
aFirstChar = aParam[0];
if( aFirstChar == 'F' || aFirstChar == 'f' )
{
aParam.Erase( 0, 1 );
aFirstChar = aParam.GetChar(0);
String aName( aParam.Copy( 1 ) );
aParam = aParam.copy( 1 );
aFirstChar = aParam[0];
OUString aName( aParam.copy( 1 ) );
if( 's' == aFirstChar )
{ // name of slot output
aSlotMapFile = aName;
@@ -298,35 +298,35 @@ SvCommand::SvCommand( int argc, char ** argv )
exit( -1 );
}
}
else if( aParam.EqualsIgnoreCaseAscii( "help" ) || aParam.EqualsIgnoreCaseAscii( "?" ) )
else if( aParam.equalsIgnoreAsciiCase( "help" ) || aParam.equalsIgnoreAsciiCase( "?" ) )
{ // help
printf( "%s", CommandLineSyntax );
}
else if( aParam.EqualsIgnoreCaseAscii( "quiet" ) )
else if( aParam.equalsIgnoreAsciiCase( "quiet" ) )
{
nVerbosity = 0;
}
else if( aParam.EqualsIgnoreCaseAscii( "verbose" ) )
else if( aParam.equalsIgnoreAsciiCase( "verbose" ) )
{
nVerbosity = 2;
}
else if( aParam.EqualsIgnoreCaseAscii( "syntax" ) )
else if( aParam.equalsIgnoreAsciiCase( "syntax" ) )
{ // help
int j = 0;
while(SyntaxStrings[j])
printf("%s\n",SyntaxStrings[j++]);
}
else if( aParam.EqualsIgnoreCaseAscii( "i", 0, 1 ) )
else if( aParam.startsWithIgnoreAsciiCase( "i" ) )
{ // define include paths
String aName( aParam.Copy( 1 ) );
if( aPath.Len() )
OUString aName( aParam.copy( 1 ) );
if( !aPath.isEmpty() )
aPath += OUString( SAL_PATHSEPARATOR );
aPath += aName;
}
else if( aParam.EqualsIgnoreCaseAscii( "rsc", 0, 3 ) )
else if( aParam.startsWithIgnoreAsciiCase( "rsc" ) )
{ // first line in *.srs file
OSL_ENSURE(false, "does anything use this option, doesn't look like it belong here");
if( aList[ i + 1 ] )
if( !aList[ i + 1 ].isEmpty() )
{
i++;
}
@@ -343,7 +343,7 @@ SvCommand::SvCommand( int argc, char ** argv )
}
else
{
aInFileList.push_back( new String( aParam ) );
aInFileList.push_back( aParam );
}
}
}
@@ -352,15 +352,13 @@ SvCommand::SvCommand( int argc, char ** argv )
printf( "%s", CommandLineSyntax );
}
for ( size_t i = 0, n = aList.size(); i < n; ++i )
delete aList[ i ];
aList.clear();
OString aInc(getenv("INCLUDE"));
// append include environment variable
if( aInc.getLength() )
{
if( aPath.Len() )
if( !aPath.isEmpty() )
aPath += OUString( SAL_PATHSEPARATOR );
aPath += OStringToOUString(aInc, RTL_TEXTENCODING_ASCII_US);
}
@@ -369,8 +367,6 @@ SvCommand::SvCommand( int argc, char ** argv )
SvCommand::~SvCommand()
{
// release String list
for ( size_t i = 0, n = aInFileList.size(); i < n; ++i )
delete aInFileList[ i ];
aInFileList.clear();
}

View File

@@ -38,8 +38,6 @@ SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd )
SvIdlDataBase::~SvIdlDataBase()
{
for ( size_t i = 0, n = aIdFileList.size(); i < n; ++i )
delete aIdFileList[ i ];
aIdFileList.clear();
delete pIdTable;
@@ -203,17 +201,17 @@ sal_Bool SvIdlDataBase::InsertId( const OString& rIdName, sal_uLong nVal )
return sal_False;
}
sal_Bool SvIdlDataBase::ReadIdFile( const String & rFileName )
sal_Bool SvIdlDataBase::ReadIdFile( const OUString & rFileName )
{
OUString aFullName;
osl::File::searchFileURL( rFileName, GetPath(), aFullName);
osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName );
for ( size_t i = 0, n = aIdFileList.size(); i < n; ++i )
if ( *aIdFileList[ i ] == rFileName )
if ( aIdFileList[ i ] == rFileName )
return sal_True;
aIdFileList.push_back( new String( rFileName ) );
aIdFileList.push_back( rFileName );
this->AddDepFile( aFullName );
SvTokenStream aTokStm( aFullName );
if( aTokStm.GetStream().GetError() == SVSTREAM_OK )
@@ -554,7 +552,7 @@ void SvIdlDataBase::WriteError( const OString& rErrWrn,
void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
{
// error treatment
String aFileName( rInStm.GetFileName() );
OUString aFileName( rInStm.GetFileName() );
OStringBuffer aErrorText;
sal_uLong nRow = 0, nColumn = 0;
@@ -620,7 +618,7 @@ SvIdlWorkingBase::SvIdlWorkingBase(const SvCommand& rCmd) : SvIdlDataBase(rCmd)
{
}
sal_Bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, sal_Bool bImported, const String & rPath )
sal_Bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, sal_Bool bImported, const OUString & rPath )
{
aPath = rPath; // only valid for this iteration
SvToken * pTok;
@@ -783,9 +781,9 @@ sal_Bool SvIdlWorkingBase::WriteSfxItem( SvStream & )
return sal_False;
}
void SvIdlDataBase::StartNewFile( const String& rName )
void SvIdlDataBase::StartNewFile( const OUString& rName )
{
bExport = ( aExportFile.EqualsIgnoreCaseAscii( rName ) );
bExport = ( aExportFile.equalsIgnoreAsciiCase( rName ) );
}
void SvIdlDataBase::AppendAttr( SvMetaAttribute *pAttr )
@@ -827,7 +825,7 @@ sal_Bool SvIdlWorkingBase::WriteDocumentation( SvStream & rOutStm )
return sal_True;
}
void SvIdlDataBase::AddDepFile(String const& rFileName)
void SvIdlDataBase::AddDepFile(OUString const& rFileName)
{
m_DepFiles.insert(rFileName);
}

View File

@@ -27,7 +27,7 @@
#include <osl/file.hxx>
#define BR 0x8000
sal_Bool FileMove_Impl( const String & rFile1, const String & rFile2, sal_Bool bImmerVerschieben )
sal_Bool FileMove_Impl( const OUString & rFile1, const OUString & rFile2, sal_Bool bImmerVerschieben )
{
//printf( "Move from %s to %s\n", rFile2.GetStr(), rFile1.GetStr() );
sal_uLong nC1 = 0;
@@ -245,8 +245,8 @@ int cdecl main ( int argc, char ** argv)
if( nExit == 0 )
{
sal_Bool bErr = sal_False;
sal_Bool bDoMove = aCommand.aTargetFile.Len() == 0;
String aErrFile, aErrFile2;
sal_Bool bDoMove = aCommand.aTargetFile.isEmpty();
OUString aErrFile, aErrFile2;
if( !bErr && !aCommand.aListFile.isEmpty() )
{
bErr |= !FileMove_Impl( aCommand.aListFile, aTmpListFile, bDoMove );
@@ -325,7 +325,7 @@ int cdecl main ( int argc, char ** argv)
}
else
{
if( aCommand.aTargetFile.Len() )
if( !aCommand.aTargetFile.isEmpty() )
{
#ifdef ICC
DirEntry aT(aCommand.aTargetFile);