// FontStyleP.C: FontStyle nodes (private source).
// Automatically generated with nodegen 0.5a - do not edit.

#include "FontStyle.H"
#include "xrmlP.H"

namespace xrml {
int FontStyle::major_version(void) { return 0; }
int FontStyle::minor_version(void) { return 5; }
bool FontStyle::is_leaf_class(void) { return true; }

bool IsFontStyle(SFNode* node)
{
  return (dynamic_cast<FontStyle*>(node) != 0);
}

bool FontStyle::assign_family(const MFString& value)
{
  // TODO: value range check!
  family = value;
  status |= family_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_family(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_family", "called for a non-FontStyle node");
  return FontStyle_node->assign_family((const MFString&)value);
}

bool FontStyle::assign_horizontal(const SFBool& value)
{
  // TODO: value range check!
  horizontal = value;
  status |= horizontal_updated;
  timestamp = interface[1]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_horizontal(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_horizontal", "called for a non-FontStyle node");
  return FontStyle_node->assign_horizontal((const SFBool&)value);
}

bool FontStyle::assign_justify(const MFString& value)
{
  // TODO: value range check!
  justify = value;
  status |= justify_updated;
  timestamp = interface[2]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_justify(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_justify", "called for a non-FontStyle node");
  return FontStyle_node->assign_justify((const MFString&)value);
}

bool FontStyle::assign_language(const SFString& value)
{
  // TODO: value range check!
  language = value;
  status |= language_updated;
  timestamp = interface[3]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_language(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_language", "called for a non-FontStyle node");
  return FontStyle_node->assign_language((const SFString&)value);
}

bool FontStyle::assign_leftToRight(const SFBool& value)
{
  // TODO: value range check!
  leftToRight = value;
  status |= leftToRight_updated;
  timestamp = interface[4]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_leftToRight(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_leftToRight", "called for a non-FontStyle node");
  return FontStyle_node->assign_leftToRight((const SFBool&)value);
}

bool FontStyle::assign_size(const SFFloat& value)
{
  // TODO: value range check!
  size = value;
  status |= size_updated;
  timestamp = interface[5]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_size(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_size", "called for a non-FontStyle node");
  return FontStyle_node->assign_size((const SFFloat&)value);
}

bool FontStyle::assign_spacing(const SFFloat& value)
{
  // TODO: value range check!
  spacing = value;
  status |= spacing_updated;
  timestamp = interface[6]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_spacing(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_spacing", "called for a non-FontStyle node");
  return FontStyle_node->assign_spacing((const SFFloat&)value);
}

bool FontStyle::assign_style(const SFString& value)
{
  // TODO: value range check!
  style = value;
  status |= style_updated;
  timestamp = interface[7]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_style(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_style", "called for a non-FontStyle node");
  return FontStyle_node->assign_style((const SFString&)value);
}

bool FontStyle::assign_topToBottom(const SFBool& value)
{
  // TODO: value range check!
  topToBottom = value;
  status |= topToBottom_updated;
  timestamp = interface[8]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_FontStyle_topToBottom(SFNode* node, const fieldValue& value)
{
  FontStyle* FontStyle_node = dynamic_cast<FontStyle*>(node);
  if (!FontStyle_node)
    Fatal(-1, "assign_FontStyle_topToBottom", "called for a non-FontStyle node");
  return FontStyle_node->assign_topToBottom((const SFBool&)value);
}

FontStyle::FontStyle()
{
  interfaceMember* the_interface[9] = {
    new field("family", fieldValue(&family), assign_FontStyle_family),
    new field("horizontal", fieldValue(&horizontal), assign_FontStyle_horizontal),
    new field("justify", fieldValue(&justify), assign_FontStyle_justify),
    new field("language", fieldValue(&language), assign_FontStyle_language),
    new field("leftToRight", fieldValue(&leftToRight), assign_FontStyle_leftToRight),
    new field("size", fieldValue(&size), assign_FontStyle_size),
    new field("spacing", fieldValue(&spacing), assign_FontStyle_spacing),
    new field("style", fieldValue(&style), assign_FontStyle_style),
    new field("topToBottom", fieldValue(&topToBottom), assign_FontStyle_topToBottom),
  };
  SFNode::construct(FontStyleTypeId, 9, the_interface);

  const SFString _family[1] = {"SERIF"};
  family = MFString(1,(SFString *)_family);
  horizontal = 1;
  const SFString _justify[1] = {"BEGIN"};
  justify = MFString(1,(SFString *)_justify);
  language = "";
  leftToRight = 1;
  size = 1;
  spacing = 1;
  style = "PLAIN";
  topToBottom = 1;
  
  FontStyle::util_init();
}

void FontStyle::destruct(void)
{
  FontStyle::util_destruct();
  SFNode::destruct();
}

FontStyle::~FontStyle()
{
  destruct();
}

void FontStyle::clone_here(const FontStyle& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&family);
  interface[1]->value = fieldValue(&horizontal);
  interface[2]->value = fieldValue(&justify);
  interface[3]->value = fieldValue(&language);
  interface[4]->value = fieldValue(&leftToRight);
  interface[5]->value = fieldValue(&size);
  interface[6]->value = fieldValue(&spacing);
  interface[7]->value = fieldValue(&style);
  interface[8]->value = fieldValue(&topToBottom);
  
  family = src.family;
  horizontal = src.horizontal;
  justify = src.justify;
  language = src.language;
  leftToRight = src.leftToRight;
  size = src.size;
  spacing = src.spacing;
  style = src.style;
  topToBottom = src.topToBottom;
  
  FontStyle::util_clone(src);
}

FontStyle::FontStyle(const FontStyle& src)
{
  clone_here(src);
}

FontStyle& FontStyle::operator=(const FontStyle& src)
{
  if (this != &src) {
    destruct();
    clone_here(src);
  }
  return *this;
}

SFNode* FontStyle::instantiate(Proto *enclosing_proto)
{
  if (nameIndex>=0)
    // named node: return pointer to pre-made instance
    return enclosing_proto ? enclosing_proto->namedNodes[nameIndex] : this;
  
  FontStyle* instance = new FontStyle(*this);
  instance->instantiate_interface(enclosing_proto);
  return instance;
}

}  // namespace xrml
