#define MiX_TEXT_CPP_

#include "Text.h"

namespace MiX{
  //dmy_itはcreateで第三引数を省略するためのトリック
  template <class charT,class char_traits,class xml_traits>
  const typename NodeList<charT,char_traits,xml_traits>::iterator Text<charT,char_traits,xml_traits>::dmy_it = NodeList<charT,char_traits,xml_traits>::iterator();
  
  template <class charT,class char_traits,class xml_traits>
  XMLString<charT,char_traits,xml_traits> Text<charT,char_traits,xml_traits>::toString(bool is_indent,int indent_off)const{
    if(is_indent){
      string_type s;
      insertIndent(indent_off,s,xml_traits::tab());
      s += getValue(); s += xml_traits::crlf();
      return s;
    }
    else return getValue();
  }

  
  template <class charT,class char_traits,class xml_traits>
  Text<charT,char_traits,xml_traits>& Text<charT,char_traits,xml_traits>::create(const string_type& str,element_type& parent,const typename nodelist_type::iterator& it){
    this_type* newtxt = new this_type(str);
    newtxt->setParent(parent);
    if(&it==&dmy_it) parent.getChildren().insert(parent.getChildren().end(),newtxt);
    else parent.getChildren().insert(it,newtxt);
    return *newtxt;
  }
  
}
