struct StaticAsciiLiteral

Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::lang::StaticAsciiLiteral Struct Reference
[ACDK String macros/function/classes]

#include <String.h>

List of all members.

Detailed Description

this is a little helper class for fast comparing String with string literals.

The class itself is not doing anything with heap, so the common using is as static variable inside a function

    bool fastEqual(IN(RString) str)
      // length and hashCode has only calculated at first call of fastCall
      static StaticAsciiLiteral myLit(myLiteral); 
      return myLit == str;
      // or if str != Nil
      return str->equals(myLit);

Public Member Functions

 StaticAsciiLiteral (const char *ptr)
bool operator== (IN(RString) str) const
bool operator!= (IN(RString) str) const

Public Attributes

int hashCode
int length
const char * text

Constructor & Destructor Documentation

acdk::lang::StaticAsciiLiteral::StaticAsciiLiteral const char *  ptr  ) 

Member Function Documentation

bool acdk::lang::StaticAsciiLiteral::operator!= IN(RString str  )  const [inline]

bool acdk::lang::StaticAsciiLiteral::operator== IN(RString str  )  const [inline]

Member Data Documentation

int acdk::lang::StaticAsciiLiteral::hashCode

int acdk::lang::StaticAsciiLiteral::length

const char* acdk::lang::StaticAsciiLiteral::text