MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / className

Method className

src/jrd/Collation.cpp:820–855  ·  view source on GitHub ↗

See if a character is a member of a class. Japanese version operates on short-based buffer, instead of SCHAR-based.

Source from the content-addressed store, hash-verified

818 // Japanese version operates on short-based buffer,
819 // instead of SCHAR-based.
820 static bool className(Jrd::TextType* obj, // USHORT flags,
821 const CharType* char_class, const CharType* const end_class, CharType character)
822 {
823 fb_assert(char_class != NULL);
824 fb_assert(end_class != NULL);
825 fb_assert(char_class <= end_class);
826 fb_assert(obj->getCanonicalWidth() == sizeof(CharType));
827
828 bool result = true;
829
830 if (*char_class == *(CharType*) obj->getCanonicalChar(CHAR_GDML_NOT))
831 {
832 ++char_class;
833 result = false;
834 }
835
836 while (char_class < end_class)
837 {
838 const CharType c = *char_class++;
839 if (c == *(CharType*) obj->getCanonicalChar(CHAR_GDML_QUOTE))
840 {
841 if (*char_class++ == character)
842 return true;
843 }
844 else if (*char_class == *(CharType*) obj->getCanonicalChar(CHAR_GDML_RANGE))
845 {
846 char_class += 2;
847 if (character >= c && character <= char_class[-1])
848 return result;
849 }
850 else if (character == c)
851 return result;
852 }
853
854 return !result;
855 }
856
857 // Merge the matching pattern and control strings to give a cannonical
858 // matching pattern. Return the length of the combined string.

Callers

nothing calls this directly

Calls 2

getCanonicalWidthMethod · 0.80
getCanonicalCharMethod · 0.80

Tested by

no test coverage detected