summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
Diffstat (limited to 'rsc')
-rw-r--r--rsc/inc/rscall.h27
-rw-r--r--rsc/inc/rscdb.hxx8
-rw-r--r--rsc/inc/rscrsc.hxx4
-rw-r--r--rsc/source/parser/rscdb.cxx2
-rw-r--r--rsc/source/rsc/rsc.cxx36
5 files changed, 42 insertions, 35 deletions
diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h
index ba23997c5c08..53cedd650963 100644
--- a/rsc/inc/rscall.h
+++ b/rsc/inc/rscall.h
@@ -24,6 +24,7 @@
#include <rscdef.hxx>
#include <rschash.hxx>
#include <rtl/alloc.h>
+#include <o3tl/typed_flags_set.hxx>
/******************* T y p e s *******************************************/
typedef char * CLASS_DATA; // Zeiger auf die Daten einer Klasse
@@ -45,16 +46,22 @@ extern AtomContainer* pHS;
/******************* D e f i n e s ***************************************/
-#define HELP_FLAG 0x0001 // Hilfe anzeigen
-#define NOPREPRO_FLAG 0x0002 // kein Preprozesor
-#define NOSYNTAX_FLAG 0x0004 // keine Syntaxanalyse
-#define NOLINK_FLAG 0x0008 // nicht linken
-#define NORESFILE_FLAG 0x0010 // keine .res-Datei erzeugen
-#define DEFINE_FLAG 0x0020 // es wurde Definitionen angegeben
-#define INCLUDE_FLAG 0x0040 // der Include-Pfad wurde erweitert
-#define PRELOAD_FLAG 0x0200 // Alle Resourcen Preloaden
-#define SRSDEFAULT_FLAG 0x1000 // immer der Default geschrieben
-#define NOSYSRESTEST_FLAG 0x2000 // ueberprueft nicht die Richtigkeit von (bmp, ico, cur)
+enum class CommandFlags {
+ NONE = 0x0000,
+ Help = 0x0001, // Hilfe anzeigen
+ NoPrePro = 0x0002, // kein Preprozesor
+ NoSyntax = 0x0004, // keine Syntaxanalyse
+ NoLink = 0x0008, // nicht linken
+ NoResFile = 0x0010, // keine .res-Datei erzeugen
+ Define = 0x0020, // es wurde Definitionen angegeben
+ Include = 0x0040, // der Include-Pfad wurde erweitert
+ Preload = 0x0200, // Alle Resourcen Preloaden
+ SrsDefault = 0x1000, // immer der Default geschrieben
+ NoSysResTest = 0x2000 // ueberprueft nicht die Richtigkeit von (bmp, ico, cur)
+};
+namespace o3tl {
+ template<> struct typed_flags<CommandFlags> : is_typed_flags<CommandFlags, 0x327f> {};
+}
/******************* T y p e s *******************************************/
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
index 11e369b65195..70feb5a37a22 100644
--- a/rsc/inc/rscdb.hxx
+++ b/rsc/inc/rscdb.hxx
@@ -113,16 +113,16 @@ public:
RscError* pEH; // error handler
RscNameTable aNmTb; // name table
- RscFileTab aFileTab; // fila name table
- sal_uInt32 nFlags;
+ RscFileTab aFileTab; // file name table
+ CommandFlags nFlags;
std::map<sal_uInt64, sal_uLong> aIdTranslator; // map resources types and ids to an id (under PM9 or to a file position (MTF)
- RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, sal_uInt32 nFlags );
+ RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, CommandFlags nFlags );
~RscTypCont();
Atom AddLanguage( const char* );
bool IsSrsDefault() const
- { return (nFlags & SRSDEFAULT_FLAG) != 0; }
+ { return bool(nFlags & CommandFlags::SrsDefault); }
OString ChangeLanguage(const OString & rNewLang);
const std::vector< sal_uInt32 >& GetFallbacks() const
{ return aLangFallbacks; }
diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx
index 7e8349701fec..8f2bc6c4c7bf 100644
--- a/rsc/inc/rscrsc.hxx
+++ b/rsc/inc/rscrsc.hxx
@@ -35,10 +35,10 @@ class RscCmdLine
public:
- RscStrList aInputList; // source file list
+ RscStrList aInputList; // source file list
OString aPath; // path list
RSCBYTEORDER_TYPE nByteOrder;
- unsigned short nCommands; // command bits
+ CommandFlags nCommands; // command bits
OString aOutputSrs; // Srs output file name
OString aILDir;
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx
index e7da28e997fd..f9a7afae51b5 100644
--- a/rsc/source/parser/rscdb.cxx
+++ b/rsc/source/parser/rscdb.cxx
@@ -38,7 +38,7 @@
RscTypCont::RscTypCont( RscError * pErrHdl,
RSCBYTEORDER_TYPE nOrder,
const OString& rSearchPath,
- sal_uInt32 nFlagsP )
+ CommandFlags nFlagsP )
: nSourceCharSet( RTL_TEXTENCODING_UTF8 )
, nByteOrder( nOrder )
, aSearchPath( rSearchPath )
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
index 4b921d733687..87183b56ab13 100644
--- a/rsc/source/rsc/rsc.cxx
+++ b/rsc/source/rsc/rsc.cxx
@@ -65,7 +65,7 @@ AtomContainer* pHS = nullptr;
void RscCmdLine::Init()
{
- nCommands = 0;
+ nCommands = CommandFlags::NONE;
nByteOrder = RSC_BIGENDIAN;
aPath = OString(".");
@@ -114,24 +114,24 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
if( !rsc_stricmp( (*ppStr) + 1, "h" )
|| !strcmp( (*ppStr) + 1, "?" ) )
{ // Write help to standard output
- nCommands |= HELP_FLAG;
+ nCommands |= CommandFlags::Help;
}
else if( !rsc_stricmp( (*ppStr) + 1, "p" ) )
{ // No preprocessor
- nCommands |= NOPREPRO_FLAG;
+ nCommands |= CommandFlags::NoPrePro;
}
else if( !rsc_stricmp( (*ppStr) + 1, "s" ) )
{ // Syntax analysis, creates .srs file
- nCommands |= NOLINK_FLAG;
+ nCommands |= CommandFlags::NoLink;
}
else if( !rsc_stricmp( (*ppStr) + 1, "l" ) )
{ // links, no syntax and no preprocessing
- nCommands |= NOPREPRO_FLAG;
- nCommands |= NOSYNTAX_FLAG;
+ nCommands |= CommandFlags::NoPrePro;
+ nCommands |= CommandFlags::NoSyntax;
}
else if( !rsc_stricmp( (*ppStr) + 1, "r" ) )
{ // generate no .res file
- nCommands |= NORESFILE_FLAG;
+ nCommands |= CommandFlags::NoResFile;
}
else if( !rsc_strnicmp( (*ppStr) + 1, "sub", 3 ) )
{
@@ -146,7 +146,7 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
}
else if( !rsc_stricmp( (*ppStr) + 1, "PreLoad" ) )
{ // all resources with Preload
- nCommands |= PRELOAD_FLAG;
+ nCommands |= CommandFlags::Preload;
}
else if( !rsc_stricmp( (*ppStr) + 1, "LITTLEENDIAN" ) )
{ // endianness when writing
@@ -158,11 +158,11 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
}
else if( !rsc_strnicmp( (*ppStr) + 1, "d", 1 ) )
{ // define symbols
- nCommands |= DEFINE_FLAG;
+ nCommands |= CommandFlags::Define;
}
else if( !rsc_strnicmp( (*ppStr) + 1, "i", 1 ) )
{ // define include path
- nCommands |= INCLUDE_FLAG;
+ nCommands |= CommandFlags::Include;
OStringBuffer aBuffer(aPath);
if (!aBuffer.isEmpty())
aBuffer.append(SAL_PATHSEPARATOR);
@@ -204,11 +204,11 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
}
else if( !rsc_stricmp( (*ppStr) + 1, "NoSysResTest" ) )
{ // don't check Bitmap, Pointers, Icons
- nCommands |= NOSYSRESTEST_FLAG;
+ nCommands |= CommandFlags::NoSysResTest;
}
else if( !rsc_stricmp( (*ppStr) + 1, "SrsDefault" ) )
{ // Only write one language to srs file
- nCommands |= SRSDEFAULT_FLAG;
+ nCommands |= CommandFlags::SrsDefault;
}
else if( !rsc_stricmp( (*ppStr) + 1, "lg" ) )
{
@@ -232,7 +232,7 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
i++;
}
- if( nCommands & HELP_FLAG )
+ if( nCommands & CommandFlags::Help )
pEH->FatalError( ERR_USAGE, RscId() );
// was an inputted file specified
else if( !aInputList.empty() )
@@ -319,9 +319,9 @@ ERRTYPE RscCompiler::Start()
for( size_t i = 0, n = pCL->aInputList.size(); i < n; ++i )
pTC->aFileTab.NewCodeFile( *pCL->aInputList[ i ] );
- if( !(pCL->nCommands & NOSYNTAX_FLAG) )
+ if( !(pCL->nCommands & CommandFlags::NoSyntax) )
{
- if( pCL->nCommands & NOPREPRO_FLAG )
+ if( pCL->nCommands & CommandFlags::NoPrePro )
{
pTC->pEH->SetListFile( nullptr );
@@ -371,7 +371,7 @@ ERRTYPE RscCompiler::Start()
void RscCompiler::EndCompile()
{
- if( !pCL->aOutputSrs.isEmpty() && (pCL->nCommands & NOLINK_FLAG) )
+ if( !pCL->aOutputSrs.isEmpty() && (pCL->nCommands & CommandFlags::NoLink) )
{
pTC->pEH->StdOut( "Writing file ", RscVerbosityVerbose );
pTC->pEH->StdOut( pCL->aOutputSrs.getStr(), RscVerbosityVerbose );
@@ -379,7 +379,7 @@ void RscCompiler::EndCompile()
// copy from TMP to real names
unlink( pCL->aOutputSrs.getStr() ); // delete target file
- if( !(pCL->nCommands & NOSYNTAX_FLAG) )
+ if( !(pCL->nCommands & CommandFlags::NoSyntax) )
{
FILE * foutput;
@@ -558,7 +558,7 @@ ERRTYPE RscCompiler::Link()
ERRTYPE aError;
RscFile* pFName;
- if( !(pCL->nCommands & NOLINK_FLAG) )
+ if( !(pCL->nCommands & CommandFlags::NoLink) )
{
::std::list<RscCmdLine::OutputFile>::const_iterator it;