Unichar Class


// file: $isip/class/math/scalar/unichar/unichar.h
//

// make sure definitions are only made once
//
#ifndef __ISIP_CHAR
#define __ISIP_CHAR

// isip include files
//
#ifndef __ISIP_INTEGRAL
#define ISIP_INTEGRAL
#include 
#endif

// forward class definitions
//
class Sof;

// char: a 2 byte (16 bit Unicode) character class
//
class Char {

  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------
protected:

  // typedef char to whatever wchar_t is defined to be
  //
  typedef char wchar_t;

  // internal data - be careful to not add anything that isn't absolutely
  // necessary, so that higher level classes (e.g., vector) do not waste space
  //
  char value_d;

  //---------------------------------------------------------------------------
  //
  // public methods
  //
  //---------------------------------------------------------------------------
public:

  // required methods
  //
  char* name_cc();
  boolean debug_cc(FILE* fp, char* message);
  
  // destructors/constructors
  //
  ~Char();  
  Char();
  Char(char arg);
  Char(wchar arg);
  Char(Char& arg);

  // in-line methods
  //
  inline operator char() {
    return value_d;
  }

  // overloaded assignment operator
  //
  inline Char& operator= (char arg) {
    value_d = arg;
    return *this;
  }

  // i/o methods
  //
  boolean read_cc(Sof& sof, char* name, long tag, char* io_fmt);
  boolean read_cc(Sof& sof, char* io_fmt);
  boolean read_cc(Sof& sof, long tag);
  boolean write_cc(Sof& sof, char* name, long tag, char* io_fmt);
  boolean write_cc(Sof& sof, char* io_fmt);
  boolean write_cc(Sof& sof, long tag);
  
  // local methods
  //
  boolean is_whitespace_cc(char chr);            // checks for a white space

  char decode_cc(byte* arg);                    // unicode to ascii
  char decode_cc(byte* arg, char* format);      // unicode to specified format

  byte* encode_cc(char arg);                    // ascii to uicode
  byte* encode_cc(char arg, char* format);      // ascii to specified format
  
  //---------------------------------------------------------------------------
  //
  // private methods
  //
  //---------------------------------------------------------------------------
private:
};

// end of include file
//
#endif