// file: $isip/class/mmedia/xt_01.cc
// version: $Id: xt_01.cc 9929 2004-12-31 02:42:05Z duncan $

#include "XMLToken.h"

// method: debug
//
// arguments:
//   const unichar* msg: (input) a message to display along with
//     the debugging information
//
// return: a boolean indicating status
//
// this method displays information about member data
//
boolean XMLToken::debug(const unichar* msg_a) const {
  
  SysString output;
  SysString value;
  
  output.debugStr(name(), msg_a, L"");
  Console::put(output);
  
  output.debugStr(name(), msg_a, L"value_d", getValue());
  Console::put(output);
  
  value.assign((long)getType());
  output.debugStr(name(), msg_a, L"type_d", value);
  Console::put(output);
  
  attributes_d.debug(msg_a);
  
  return true;
}  

// method: assign
//
// arguments:
//  const XMLToken& token: (input) object to copy
//
// return: a boolean value indicating status
//
// this method assigns the input object to current object
//
boolean XMLToken::assign(const XMLToken& token_a) {
  
  // copy all of the datamembers from the argument
  // token to this token
  //
  value_d = token_a.value_d;
  type_d = token_a.type_d;
  attributes_d.assign(token_a.attributes_d);
  depth_d = token_a.depth_d;
  
  return true;
}

// method: clear
//
// arguments:
//   Integral::CMODE ctype: (input) the clear type
//
// returns: a boolean indicating status
//
// resets the data members to their default values
//
boolean XMLToken::clear(Integral::CMODE ctype_a) {
  
  if(ctype_a != Integral::RETAIN) {
    type_d = NULL_TAG;
    value_d = String::EMPTY;
    attributes_d.clear(ctype_a); 
    depth_d = 0;
  }
  
  // indicate status
  //
  return true;
}

// method: eq
//
// arguments:
//  const XMLToken& xt: (input) input object to compare
//
// return: a boolean value indicating status
//
// this method checks whether the current object is identical to the
// input object
//
boolean XMLToken::eq(const XMLToken& xt_a) const {
  
  return((value_d.eq(xt_a.value_d)) &&
	 (type_d == xt_a.type_d) &&
	 (attributes_d.eq(xt_a.attributes_d)) &&
	 (depth_d == xt_a.depth_d));
}
