pike.git / lib / modules / Parser.pmod / XML.pmod / DOM.pmod

version» Context lines:

pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:49:    {    switch (i) {    case 0:    return "DOMException: " +    (human_readable[code] || ("unknown exception "+code)) + "\n";    case 1:    return backtrace;    }    }    -  protected string _sprintf(int mode, mapping options) +  protected string _sprintf(int mode)    {    return mode == 'O' && sprintf("%O(%s)", this_program,    (string)(symbolic[code]||code) );    }      };      class DOMImplementation   {    int has_feature(string feature, string|void version)
pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:87:      class NodeList   {    protected array(Node) nodes;       protected NodeList `+(NodeList nl) {    return NodeList(values(this)+values(nl));    }    protected Node `[](int index) { return item(index); }    protected int _sizeof() { return get_length(); } -  protected array(Node) cast(string to) { -  return to[..4] == "array" && values(this); +  protected array(Node) cast(string to) +  { +  if(to == "array") +  return values(this); +  return UNDEFINED;    }       Node item(int index)    {    return index >= 0 && index < sizeof(nodes) && nodes[index];    }       int get_length()    {    return sizeof(nodes);
pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:153:    unbind(old);    return old;    }       protected Node `[](int|string index)    {    return stringp(index)? get_named_item(index) : item(index);    }       protected int _sizeof() { return get_length(); } -  protected mapping(string:Node) cast(string to) { -  return to[..6] == "mapping" && copy_value(map); +  protected mapping(string:Node) cast(string to) +  { +  if(to == "mapping") +  return copy_value(map); +  return UNDEFINED;    }       Node item(int index)    {    return values(this)[index];    }       int get_length()    {    return sizeof(map);
pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:339:    }       Node append_child(Node new_child) { return insert_before(new_child, 0); }       int has_child_nodes() { return child_nodes && sizeof(child_nodes) > 0; }       Node clone_node(int|void deep) {    throw(DOMException(DOMException.NOT_SUPPORTED_ERR));    }    -  protected string _sprintf(int mode, mapping options) +  protected string _sprintf(int mode)    {    return mode == 'O' &&    sprintf("%O(%s)", this_program, get_node_name());    }   }      class DocumentFragment   {    inherit Node;   
pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:535:    {    if(offset > get_length() || count < 0)    throw(DOMException(DOMException.INDEX_SIZE_ERR));    if(offset + count >= get_length())    set_data(substring_data(0, offset) + arg);    else    set_data(substring_data(0, offset) + arg +    substring_data(offset+count, get_length()));    }    -  string cast(string to) { return to == "string" && get_data(); } +  protected string cast(string to) +  { +  if(to == "string") +  return get_data(); +  return UNDEFINED;    } -  + }      class Attr   {    inherit Node;       protected string name;    protected int specified = 1;    protected Element bound_to;       int get_node_type() { return ATTRIBUTE_NODE; }
pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:866:       protected string name, public_id, system_id, notation_name;       int get_node_type() { return ENTITY_NODE; }    string get_node_name() { return name; }    string get_public_id() { return public_id; }    string get_system_id() { return system_id; }    string get_notation_name() { return notation_name; }    protected int is_readonly() { return name != 0; }    -  string cast(string to) +  protected string cast(string to)    { -  return to == "string" && ((array(string))get_child_nodes())*""; +  if(to == "string") +  return ((array(string))get_child_nodes())*""; +  return UNDEFINED;    }       protected int child_is_allowed(Node child)    {    return (<ELEMENT_NODE,PROCESSING_INSTRUCTION_NODE,    COMMENT_NODE,TEXT_NODE,CDATA_SECTION_NODE,    ENTITY_REFERENCE_NODE>)[child->get_node_type()];    }       protected void create(Document owner, string _name, string p_id, string s_id,
pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:906:    protected Entity entity;       int get_node_type() { return ENTITY_REFERENCE_NODE; }    string get_node_name() { return name; }    protected int is_readonly() { return 1; }       Node clone_node(int|void deep) {    return owner_document->create_entity_reference(name);    }    -  string cast(string to) +  protected string cast(string to)    { -  return to == "string" && -  (entity? (string)entity : -  "&"+name+";"); +  if(to == "string") +  return (entity? (string)entity : "&"+name+";"); +  return UNDEFINED;    }       NodeList get_child_nodes() { return entity && entity->get_child_nodes(); }    Node get_first_child() { return entity && entity->get_first_child(); }    Node get_last_child() { return entity && entity->get_last_child(); }       Node get_previous_sibling(Node|void node) {    return node? entity && entity->get_previous_sibling(node) :    ::get_previous_sibling();    }
pike.git/lib/modules/Parser.pmod/XML.pmod/DOM.pmod:994:    protected string|array `[] (int i)    {    switch (i) {    case 0:    return "ParseException: " + sysid + ":" + loc + ": " + message+"\n";    case 1:    return backtrace;    }    }    -  protected string _sprintf(int mode, mapping options) +  protected string _sprintf(int mode)    {    return mode == 'O' &&    sprintf("%O(%O /* %O char %d */)",    this_program, message, sysid, loc);    }       protected void create(string _message, string|void _sysid, string|void _pubid,    int|void _loc)    {    message = _message;