Browse Source

HPCC-13496 Add backwards compatible str() and lower() to aid merging

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 10 years ago
parent
commit
46b04fafbe
1 changed files with 8 additions and 0 deletions
  1. 8 0
      system/jlib/jhash.hpp

+ 8 - 0
system/jlib/jhash.hpp

@@ -49,11 +49,14 @@ interface jlib_decl IAtom : extends IMapping
 {
 {
  public:
  public:
     virtual const char * getNamePtr() const = 0;
     virtual const char * getNamePtr() const = 0;
+    inline const char * queryStr() const { return getNamePtr(); }
 
 
     const char *         getAtomNamePtr() const;     // ok if this=NULL
     const char *         getAtomNamePtr() const;     // ok if this=NULL
     inline const char * str() const { return getAtomNamePtr(); }
     inline const char * str() const { return getAtomNamePtr(); }
     inline operator const char *() const { return getAtomNamePtr(); }
     inline operator const char *() const { return getAtomNamePtr(); }
 };
 };
+inline jlib_decl const char * str(const IAtom * atom) { return atom ? atom->queryStr() : NULL; }
+
 
 
 //This interface represents an atom which preserves its case, but also stores a lower case representation
 //This interface represents an atom which preserves its case, but also stores a lower case representation
 //for efficient case insensitive comparison.
 //for efficient case insensitive comparison.
@@ -62,6 +65,7 @@ interface jlib_decl IIdAtom : extends IMapping
 {
 {
  public:
  public:
     virtual const char * getNamePtr() const = 0;
     virtual const char * getNamePtr() const = 0;
+    inline const char * queryStr() const { return getNamePtr(); }
 
 
     const char *         getAtomNamePtr() const { return this ? getNamePtr() : NULL; }
     const char *         getAtomNamePtr() const { return this ? getNamePtr() : NULL; }
     inline const char * str() const { return getAtomNamePtr(); }
     inline const char * str() const { return getAtomNamePtr(); }
@@ -71,6 +75,10 @@ interface jlib_decl IIdAtom : extends IMapping
     virtual IAtom * queryLower() const = 0;
     virtual IAtom * queryLower() const = 0;
     IAtom * lower() const; // safe if this==NULL
     IAtom * lower() const; // safe if this==NULL
 };
 };
+inline jlib_decl const char * str(const IIdAtom * atom) { return atom ? atom->queryStr() : NULL; }
+inline jlib_decl IAtom * lower(const IIdAtom * atom) { return atom ? atom->queryLower() : NULL; }
+
+
 
 
 #ifdef _MSC_VER
 #ifdef _MSC_VER
 #pragma warning (push)
 #pragma warning (push)