changed static consts (meaning local linkage) to anonymous namespaces

(because Bjarne Stroustrup told me that I'm a bad, bad boy if I don't)
This commit is contained in:
fgerlits 2006-03-31 18:25:03 +00:00
parent 0274a51be9
commit 462f8aa936
15 changed files with 116 additions and 67 deletions

View file

@ -48,41 +48,44 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The localization key for "File type: " before the file type selector box. * The localization key for "File type: " before the file type selector box.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string fileTypeLabelKey = "fileTypeTextLabel"; const std::string fileTypeLabelKey = "fileTypeTextLabel";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The localization key for "all" in the file type selector box. * The localization key for "all" in the file type selector box.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string allLocalizationKey = "allFileType"; const std::string allLocalizationKey = "allFileType";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The localization key for "playlist" in the file type selector box. * The localization key for "playlist" in the file type selector box.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string playlistLocalizationKey = "playlistFileType"; const std::string playlistLocalizationKey = "playlistFileType";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The localization key for "audioClip" in the file type selector box. * The localization key for "audioClip" in the file type selector box.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string audioClipLocalizationKey = "audioClipFileType"; const std::string audioClipLocalizationKey = "audioClipFileType";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The search key for "all" in the file type selector box. * The search key for "all" in the file type selector box.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string allSearchKey = "all"; const std::string allSearchKey = "all";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The search key for "playlist" in the file type selector box. * The search key for "playlist" in the file type selector box.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string playlistSearchKey = "playlist"; const std::string playlistSearchKey = "playlist";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The search key for "audioClip" in the file type selector box. * The search key for "audioClip" in the file type selector box.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string audioClipSearchKey = "audioClip"; const std::string audioClipSearchKey = "audioClip";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -66,24 +66,27 @@ using namespace LiveSupport::gLiveSupport;
CPPUNIT_TEST_SUITE_REGISTRATION(AudioPlayerTest); CPPUNIT_TEST_SUITE_REGISTRATION(AudioPlayerTest);
namespace {
/** /**
* The name of the configuration file for the audio player. * The name of the configuration file for the audio player.
*/ */
static const std::string audioPlayerConfigFileName const std::string audioPlayerConfigFileName
= "etc/audioPlayer.xml"; = "etc/audioPlayer.xml";
/** /**
* The name of the configuration file for the local storage. * The name of the configuration file for the local storage.
*/ */
static const std::string storageClientConfigFileName const std::string storageClientConfigFileName
= "storageClient.xml"; = "storageClient.xml";
/** /**
* The name of the configuration file for the authentication client. * The name of the configuration file for the authentication client.
*/ */
static const std::string authenticationClientConfigFileName const std::string authenticationClientConfigFileName
= "authenticationClient.xml"; = "authenticationClient.xml";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -92,77 +92,80 @@ const std::string configFileDirStr = "/.livesupport/";
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string configFileNameStr = "gLiveSupport.xml"; const std::string configFileNameStr = "gLiveSupport.xml";
namespace {
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the config element for the list of supported languages * The name of the config element for the list of supported languages
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string supportedLanguagesElementName = "supportedLanguages"; const std::string supportedLanguagesElementName = "supportedLanguages";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the config element for a supported language. * The name of the config element for a supported language.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string languageElementName = "language"; const std::string languageElementName = "language";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the attribute for the locale id for a supported language * The name of the attribute for the locale id for a supported language
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string localeAttrName = "locale"; const std::string localeAttrName = "locale";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the attribute for the name for a supported language * The name of the attribute for the name for a supported language
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string nameAttrName = "name"; const std::string nameAttrName = "name";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the config element for the sound output player * The name of the config element for the sound output player
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string outputPlayerElementName = "outputPlayer"; const std::string outputPlayerElementName = "outputPlayer";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the config element for the sound cue player * The name of the config element for the sound cue player
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string cuePlayerElementName = "cuePlayer"; const std::string cuePlayerElementName = "cuePlayer";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the config element for the station logo image * The name of the config element for the station logo image
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string stationLogoConfigElementName = "stationLogo"; const std::string stationLogoConfigElementName = "stationLogo";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the config element for the test audio file location * The name of the config element for the test audio file location
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string testAudioUrlConfigElementName = "testAudioUrl"; const std::string testAudioUrlConfigElementName = "testAudioUrl";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the user preference for storing window positions * The name of the user preference for storing window positions
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string windowPositionsKey = "windowPositions"; const std::string windowPositionsKey = "windowPositions";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the user preference for storing the token of the edited p.l. * The name of the user preference for storing the token of the edited p.l.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string editedPlaylistTokenKey = "editedPlaylistToken"; const std::string editedPlaylistTokenKey = "editedPlaylistToken";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Static constant for the key of the scheduler not available key * Static constant for the key of the scheduler not available key
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string schedulerNotReachableKey = "schedulerNotReachableMsg"; const std::string schedulerNotReachableKey = "schedulerNotReachableMsg";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Static constant for the key of the storage not available key * Static constant for the key of the storage not available key
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string storageNotReachableKey = "storageNotReachableMsg"; const std::string storageNotReachableKey = "storageNotReachableMsg";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Static constant for the key of the authentication not available key * Static constant for the key of the authentication not available key
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string authenticationNotReachableKey = const std::string authenticationNotReachableKey =
"authenticationNotReachableMsg"; "authenticationNotReachableMsg";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Static constant for the key of the locale not available key * Static constant for the key of the locale not available key
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string localeNotAvailableKey = "localeNotAvailableMsg"; const std::string localeNotAvailableKey = "localeNotAvailableMsg";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -73,29 +73,32 @@ using namespace LiveSupport::GLiveSupport;
CPPUNIT_TEST_SUITE_REGISTRATION(GLiveSupportTest); CPPUNIT_TEST_SUITE_REGISTRATION(GLiveSupportTest);
namespace {
/** /**
* The name of the generic configuration file for the GLiveSupport object. * The name of the generic configuration file for the GLiveSupport object.
*/ */
static const std::string gLiveSupportEtcConfigFileName const std::string gLiveSupportEtcConfigFileName
= "etc/gLiveSupport.xml"; = "etc/gLiveSupport.xml";
/** /**
* The name of the user-specific configuration file for the * The name of the user-specific configuration file for the
* GLiveSupport object, relative to the user's home directory. * GLiveSupport object, relative to the user's home directory.
*/ */
static const std::string gLiveSupportUserConfigFileName const std::string gLiveSupportUserConfigFileName
= "/.livesupport/gLiveSupport.xml"; = "/.livesupport/gLiveSupport.xml";
/** /**
* The login name. * The login name.
*/ */
static const std::string login = "root"; const std::string login = "root";
/** /**
* The password. * The password.
*/ */
static const std::string password = "q"; const std::string password = "q";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -49,15 +49,17 @@ using namespace LiveSupport::GLiveSupport;
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string KeyboardShortcut::configElementName = "keyboardShortcut"; const std::string KeyboardShortcut::configElementName = "keyboardShortcut";
namespace {
/** /**
* The name of the attribute of the action element. * The name of the attribute of the action element.
*/ */
static const std::string actionAttributeName = "action"; const std::string actionAttributeName = "action";
/** /**
* The name of the attribute of the key element. * The name of the attribute of the key element.
*/ */
static const std::string keyAttributeName = "key"; const std::string keyAttributeName = "key";
/* /*
* The modifier keys we check against. * The modifier keys we check against.
@ -67,12 +69,13 @@ static const std::string keyAttributeName = "key";
* Gdk::MOD3_MASK (don't know what; always off on my computer), * Gdk::MOD3_MASK (don't know what; always off on my computer),
* Gdk::BUTTONX_MASK (mouse buttons, X = 1..5). * Gdk::BUTTONX_MASK (mouse buttons, X = 1..5).
*/ */
static const Gdk::ModifierType modifiersChecked = Gdk::SHIFT_MASK const Gdk::ModifierType modifiersChecked = Gdk::SHIFT_MASK
| Gdk::CONTROL_MASK | Gdk::CONTROL_MASK
| Gdk::MOD1_MASK // Alt | Gdk::MOD1_MASK // Alt
| Gdk::MOD4_MASK // Windows key | Gdk::MOD4_MASK // Windows key
| Gdk::MOD5_MASK; // AltGr | Gdk::MOD5_MASK; // AltGr
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -49,12 +49,14 @@ using namespace LiveSupport::GLiveSupport;
*/ */
const std::string KeyboardShortcutContainer::configElementName const std::string KeyboardShortcutContainer::configElementName
= "keyboardShortcutContainer"; = "keyboardShortcutContainer";
namespace {
/** /**
* The name of the window name sub-element. * The name of the window name sub-element.
*/ */
static const std::string windowNameAttributeName = "windowName"; const std::string windowNameAttributeName = "windowName";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -55,11 +55,14 @@ using namespace LiveSupport::GLiveSupport;
CPPUNIT_TEST_SUITE_REGISTRATION(KeyboardShortcutTest); CPPUNIT_TEST_SUITE_REGISTRATION(KeyboardShortcutTest);
namespace {
/** /**
* The name of the test keyboard shortcut config file. * The name of the test keyboard shortcut config file.
*/ */
static const std::string configFileName = "etc/keyboardShortcut.xml"; const std::string configFileName = "etc/keyboardShortcut.xml";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -54,11 +54,14 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* The name of the window, used by the keyboard shortcuts (or by the .gtkrc). * The name of the window, used by the keyboard shortcuts (or by the .gtkrc).
*/ */
static const Glib::ustring windowName = "liveModeWindow"; const Glib::ustring windowName = "liveModeWindow";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -51,11 +51,14 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* This should be 1/4th of MasterPanelWindow::updateTimeConstant. * This should be 1/4th of MasterPanelWindow::updateTimeConstant.
*/ */
static const int blinkingConstant = 5; const int blinkingConstant = 5;
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -52,11 +52,14 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* The name of the window, used by the keyboard shortcuts (or by the .gtkrc). * The name of the window, used by the keyboard shortcuts (or by the .gtkrc).
*/ */
static const Glib::ustring windowName = "optionsWindow"; const Glib::ustring windowName = "optionsWindow";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -51,11 +51,14 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* The name of the window, used by the keyboard shortcuts (or by the .gtkrc). * The name of the window, used by the keyboard shortcuts (or by the .gtkrc).
*/ */
static const Glib::ustring windowName = "schedulerWindow"; const Glib::ustring windowName = "schedulerWindow";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -53,16 +53,19 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* The name of the window, used by the keyboard shortcuts (or by the .gtkrc). * The name of the window, used by the keyboard shortcuts (or by the .gtkrc).
*/ */
static const Glib::ustring windowName = "scratchpadWindow"; const Glib::ustring windowName = "scratchpadWindow";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the user preference for storing Scratchpad contents * The name of the user preference for storing Scratchpad contents
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const Glib::ustring userPreferencesKeyName = "scratchpadContents"; const Glib::ustring userPreferencesKeyName = "scratchpadContents";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -52,11 +52,14 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* The name of the window, used by the keyboard shortcuts (or by the .gtkrc). * The name of the window, used by the keyboard shortcuts (or by the .gtkrc).
*/ */
static const Glib::ustring windowName = "simplePlaylistManagementWindow"; const Glib::ustring windowName = "simplePlaylistManagementWindow";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */

View file

@ -65,21 +65,24 @@ using namespace LiveSupport::Core;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* Our copyright notice, should be at most 80 columns * Our copyright notice, should be at most 80 columns
*/ */
static const char copyrightNotice[] = const char copyrightNotice[] =
"Copyright (c) 2004 Media Development Loan Fund under the GNU GPL"; "Copyright (c) 2004 Media Development Loan Fund under the GNU GPL";
/** /**
* String describing the short options. * String describing the short options.
*/ */
static const char options[] = "ho:s:v"; const char options[] = "ho:s:v";
/** /**
* Structure describing the long options * Structure describing the long options
*/ */
static const struct option longOptions[] = { const struct option longOptions[] =
{
{ "help", no_argument, 0, 'h' }, { "help", no_argument, 0, 'h' },
{ "output", required_argument, 0, 'o' }, { "output", required_argument, 0, 'o' },
{ "stylesheet", required_argument, 0, 's' }, { "stylesheet", required_argument, 0, 's' },
@ -90,27 +93,30 @@ static const struct option longOptions[] = {
/** /**
* The encoding to use for the output file. * The encoding to use for the output file.
*/ */
static const std::string encoding = "utf-8"; const std::string encoding = "utf-8";
/** /**
* The output XML file name. * The output XML file name.
*/ */
static Ptr<std::string>::Ref xmlOutFileName; Ptr<std::string>::Ref xmlOutFileName;
/** /**
* The XSLT attached to the output file. * The XSLT attached to the output file.
*/ */
static Ptr<std::string>::Ref xsltFileName; Ptr<std::string>::Ref xsltFileName;
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */
namespace {
/** /**
* Print program version. * Print program version.
* *
* @param os the std::ostream to print to. * @param os the std::ostream to print to.
*/ */
static void void
printVersion ( std::ostream & os ); printVersion ( std::ostream & os );
/** /**
@ -119,7 +125,7 @@ printVersion ( std::ostream & os );
* @param invocation the command line command used to invoke this program. * @param invocation the command line command used to invoke this program.
* @param os the std::ostream to print to. * @param os the std::ostream to print to.
*/ */
static void void
printUsage ( const char invocation[], printUsage ( const char invocation[],
std::ostream & os ); std::ostream & os );
@ -131,9 +137,10 @@ printUsage ( const char invocation[],
* @return true of all went well, false in case the program should exit * @return true of all went well, false in case the program should exit
* after this call. * after this call.
*/ */
static bool bool
processArguments(int argc, char *argv[]); processArguments(int argc, char *argv[]);
}
/* ============================================================= module code */ /* ============================================================= module code */

View file

@ -63,27 +63,31 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/** /**
* Our copyright notice, should be at most 80 columns * Our copyright notice, should be at most 80 columns
*/ */
static const char copyrightNotice[] = const char copyrightNotice[] =
"Copyright (c) 2004 Media Development Loan Fund under the GNU GPL"; "Copyright (c) 2004 Media Development Loan Fund under the GNU GPL";
/** /**
* String describing the short options. * String describing the short options.
*/ */
static const char options[] = "c:hv"; const char options[] = "c:hv";
/** /**
* Structure describing the long options * Structure describing the long options
*/ */
static const struct option longOptions[] = { const struct option longOptions[] =
{
{ "config", required_argument, 0, 'c' }, { "config", required_argument, 0, 'c' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'v' }, { "version", no_argument, 0, 'v' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */