home *** CD-ROM | disk | FTP | other *** search
-
- #include <string.h>
-
- #define KEEP_ALPHABET_DEFINES
-
- #if NSTRING_DEBUG > 0
- #include <stdio.h>
- #endif
-
- #include "NString.h"
- #include "Alphabet.h"
- #include "Alphabet_Private.h"
-
- //________________________________________________________________________
-
- Alphabet::Alphabet (const char *source)
- {
-
- #if (NSTRING_DEBUG & 1) != 0
- printf("Creating alphabet from string \"%s\".\n", source);
- #endif
-
- clear();
- *this += source;
- }
-
- //________________________________________________________________________
-
- Alphabet::Alphabet (const char source)
- {
-
- #if (NSTRING_DEBUG & 1) != 0
- printf("Creating alphabet from a letter ('%c').\n", source);
- #endif
-
- clear();
- SET_ELT(source);
- }
-
- //________________________________________________________________________
-
- Alphabet::Alphabet (const Alphabet& source)
- {
- int i;
-
- #if (NSTRING_DEBUG & 1) != 0
- printf("Creating alphabet from another alphabet.\n");
- #endif
-
- for (i=0; i < BUFSIZE; i++)
- buffer[i] = source.buffer[i]; // copy buffer bits
- }
-
- //________________________________________________________________________
-
- Alphabet::Alphabet (const NString& source)
- {
-
- #if (NSTRING_DEBUG & 1) != 0
- printf("Creating alphabet from NString \"%s\".\n", source.sb->str);
- #endif
-
- clear();
- *this += source;
- }
-
- //________________________________________________________________________
-
- Alphabet::Alphabet (const char start, const char end)
- {
- char c;
-
- #if (NSTRING_DEBUG & 1) != 0
- printf("Creating alphabet from letter range '%c' to '%c'.\n", start, end);
- #endif
-
- clear();
-
- for (c=start; c <= end; c++)
- SET_ELT(c);
- }
-
- //________________________________________________________________________
-
- Alphabet& Alphabet::operator= (const char *source)
- {
- clear();
- *this += source;
-
- return *this;
- }
-
- //________________________________________________________________________
-
- Alphabet& Alphabet::operator= (const NString& source)
- {
- clear();
- *this += source;
-
- return *this;
- }
-
- //________________________________________________________________________
-
- Alphabet& Alphabet::operator= (const char source)
- {
- clear();
- SET_ELT(source);
-
- return *this;
- }
-
- //________________________________________________________________________
-
- Alphabet& Alphabet::operator= (const Alphabet& source)
- {
- int i;
-
- for (i=0; i < BUFSIZE; i++)
- buffer[i] = source.buffer[i]; // copy buffer bits
-
- return *this;
- }
-