More cleanup in locale kit, this time regarding namespaces.

* it's bad practice to do a 'using <namespace>' in a header, as that
  is very likely to have unintended effects, so drop those from a couple
  of private Locale headers
* adjust files all over the locale kit in order to fix the problems
  (by explicitly importing the required classes in the implementation
  files)
This commit is contained in:
Oliver Tappe
2012-04-16 00:04:40 +02:00
parent 7ae67a9920
commit 5ac65b7f11
14 changed files with 89 additions and 47 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ namespace BPrivate {
* but the value-type might change to add support for shortcuts and/or
* graphical data (button-images and the like).
*/
class DefaultCatalog : public BHashMapCatalog {
class DefaultCatalog : public HashMapCatalog {
public:
DefaultCatalog(const entry_ref &catalogOwner, const char *language,
uint32 fingerprint);
@@ -35,7 +35,6 @@ class DefaultCatalog : public BHashMapCatalog {
~DefaultCatalog();
// implementation for editor-interface:
status_t ReadFromFile(const char *path = NULL);
status_t ReadFromAttribute(const entry_ref &appOrAddOnRef);
@@ -63,13 +62,14 @@ class DefaultCatalog : public BHashMapCatalog {
mutable BString fPath;
};
extern "C" status_t
default_catalog_get_available_languages(BMessage* availableLanguages,
const char* sigPattern, const char* langPattern = NULL,
int32 fingerprint = 0);
} // namespace BPrivate
using namespace BPrivate;
#endif /* _DEFAULT_CATALOG_H_ */
+10 -10
View File
@@ -61,14 +61,14 @@ class CatKey {
};
class BHashMapCatalog: public BCatalogAddOn {
class HashMapCatalog: public BCatalogAddOn {
protected:
uint32 ComputeFingerprint() const;
typedef HashMap<CatKey, BString> CatMap;
CatMap fCatMap;
public:
BHashMapCatalog(const char* signature, const char* language,
HashMapCatalog(const char* signature, const char* language,
uint32 fingerprint);
// Constructor for normal use
//
@@ -112,7 +112,7 @@ class BHashMapCatalog: public BCatalogAddOn {
public:
//CatWalker() {}; // if you use this there is no way to set fPos
// properly.
CatWalker(BHashMapCatalog* catalog);
CatWalker(HashMapCatalog* catalog);
bool AtEnd() const;
const CatKey& GetKey() const;
const char *GetValue() const;
@@ -129,7 +129,7 @@ class BHashMapCatalog: public BCatalogAddOn {
};
inline BHashMapCatalog::BHashMapCatalog(const char* signature,
inline HashMapCatalog::HashMapCatalog(const char* signature,
const char* language, uint32 fingerprint)
:
BCatalogAddOn(signature, language, fingerprint)
@@ -138,7 +138,7 @@ inline BHashMapCatalog::BHashMapCatalog(const char* signature,
inline
BHashMapCatalog::CatWalker::CatWalker(BHashMapCatalog* catalog)
HashMapCatalog::CatWalker::CatWalker(HashMapCatalog* catalog)
:
fPos(catalog->fCatMap.GetIterator())
{
@@ -151,14 +151,14 @@ BHashMapCatalog::CatWalker::CatWalker(BHashMapCatalog* catalog)
inline bool
BHashMapCatalog::CatWalker::AtEnd() const
HashMapCatalog::CatWalker::AtEnd() const
{
return atEnd;
}
inline const CatKey &
BHashMapCatalog::CatWalker::GetKey() const
HashMapCatalog::CatWalker::GetKey() const
{
assert(!atEnd);
return current.key;
@@ -166,7 +166,7 @@ BHashMapCatalog::CatWalker::GetKey() const
inline const char *
BHashMapCatalog::CatWalker::GetValue() const
HashMapCatalog::CatWalker::GetValue() const
{
assert(!atEnd);
return current.value.String();
@@ -174,7 +174,7 @@ BHashMapCatalog::CatWalker::GetValue() const
inline void
BHashMapCatalog::CatWalker::Next()
HashMapCatalog::CatWalker::Next()
{
if (fPos.HasNext()) {
current = fPos.Next();
@@ -185,7 +185,7 @@ BHashMapCatalog::CatWalker::Next()
inline status_t
BHashMapCatalog::GetWalker(CatWalker *walker)
HashMapCatalog::GetWalker(CatWalker *walker)
{
if (!walker)
return B_BAD_VALUE;
+3 -4
View File
@@ -15,7 +15,8 @@ class BFile;
namespace BPrivate {
class PlainTextCatalog : public BHashMapCatalog {
class PlainTextCatalog : public HashMapCatalog {
public:
PlainTextCatalog(const char *signature, const char *language,
uint32 fingerprint);
@@ -28,7 +29,6 @@ class PlainTextCatalog : public BHashMapCatalog {
~PlainTextCatalog();
// implementation for editor-interface:
status_t ReadFromFile(const char *path = NULL);
status_t WriteToFile(const char *path = NULL);
@@ -45,9 +45,8 @@ class PlainTextCatalog : public BHashMapCatalog {
mutable BString fPath;
};
} // namespace BPrivate
using BPrivate::PlainTextCatalog;
} // namespace BPrivate
#endif /* _PLAINTEXT_CATALOG_H_ */