AttributeData::AttributeData(const AttributeData * model, BrowserNode * bn) : ClassMemberData(model), multiplicity(model->multiplicity), init_value(model->init_value), constraint(model->constraint), is_deleted(FALSE), isa_class_attribute(model->isa_class_attribute), isa_volatile_attribute(model->isa_volatile_attribute), isa_const_attribute(model->isa_const_attribute), is_derived(model->is_derived), is_derivedunion(model->is_derivedunion), is_ordered(model->is_ordered), is_unique(model->is_unique), cpp_mutable(model->cpp_mutable), java_transient(model->java_transient), uml_visibility(model->uml_visibility), cpp_visibility(model->cpp_visibility), cpp_decl(model->cpp_decl), java_decl(model->java_decl), java_annotation(model->java_annotation), php_decl(model->php_decl), python_decl(model->python_decl), idl_decl(model->idl_decl) { browser_node = bn; idl_case = 0; // set_idlcase look at current value set_type(model->type); set_idlcase(model->idl_case, model->idl_explicit_case); }
bool RelationData::tool_cmd(ToolCom * com, BrowserRelation * rel, const char * args) { if (((unsigned char) args[-1]) >= firstSetCmd) { if (!rel->is_writable() && !root_permission()) com->write_ack(FALSE); else { RoleData & r = (rel == start) ? a : b; switch ((unsigned char) args[-1]) { case setDescriptionCmd: r.comment = args; break; case setStereotypeCmd: set_stereotype(args); modified(); com->write_ack(TRUE); // send the other side to update it if (rel == start) { if (end != 0) end->write_id(com); else com->write_id(0); } else start->write_id(com); return TRUE; case setRelationAssocClassCmd: { AType t; com->get_type(t, args); set_association(t); modified(); com->write_ack(TRUE); // send the other side to update it if (rel == start) { if (end != 0) end->write_id(com); else com->write_id(0); } else start->write_id(com); } return TRUE; case setNameCmd: name = args; break; case setDefaultValueCmd: r.init_value = args; break; case setIsClassMemberCmd: r.isa_class_relation = (*args != 0); break; case setIsVolatileCmd: r.isa_volatile_relation = (*args != 0); break; case setVisibilityCmd: { UmlVisibility v; if (! com->get_visibility(v, args)) { com->write_ack(FALSE); return TRUE; } r.uml_visibility = v; } break; case setConstraintCmd: r.constraint = args; break; case setCppDeclCmd: r.cpp_decl = args; break; case setJavaDeclCmd: r.java_decl = args; break; case setJavaAnnotationCmd: { WrapperStr s = args; s = s.stripWhiteSpace(); if (! s.isEmpty()) s += '\n'; r.java_annotation = s; } break; case setPhpDeclCmd: r.php_decl = args; break; case setPythonDeclCmd: r.python_decl = args; break; case setIdlDeclCmd: r.idl_decl = args; break; case setCppVisibilityCmd: { UmlVisibility v; if (! com->get_visibility(v, args)) { com->write_ack(FALSE); return TRUE; } r.cpp_visibility = v; } break; case setIsReadOnlyCmd: r.isa_const_relation = (*args != 0); break; case setIsCppMutableCmd: r.cpp_mutable = (*args != 0); break; case setRoleNameCmd: if ((rel == start) ? wrong_role_a_name(args) : wrong_role_b_name(args)) { com->write_ack(FALSE); return TRUE; } r.role = args; break; case setMultiplicityCmd: r.multiplicity = args; break; case setCppVirtualInheritanceCmd: r.cpp_virtual_inheritance = (*args != 0); break; case setIsIdlTruncatableCmd: r.idl_truncatable_inheritance = (*args != 0);; break; case setIsJavaTransientCmd: r.java_transient = (*args != 0); break; case setIdlCaseCmd: { BrowserAttribute * at = (BrowserAttribute *) com->get_id(args); set_idlcase(r, at, args); } break; case setDerivedCmd: switch (*args) { case 0: r.is_derived = r.is_derivedunion = FALSE; break; case 1: r.is_derived = TRUE; r.is_derivedunion = FALSE; break; case 3: r.is_derived = r.is_derivedunion = TRUE; break; default: // derived union but non derived com->write_ack(FALSE); return TRUE; } break; case setOrderingCmd: r.is_ordered = (*args != 0); break; case setUniqueCmd: r.is_unique = (*args != 0); break; case setTypeCmd: // only inside associations { UmlCode c; if (!com->get_relation_kind(c, args)) { com->write_ack(FALSE); return TRUE; } else { type = c; if (end) end->package_modified(); if (check_end_visibility()) end->modified(); start->modified(); start->package_modified(); modified(); } } break; default: return FALSE; } // ok case if (rel == start) { start->modified(); start->package_modified(); } else { end->modified(); end->package_modified(); } modified(); com->write_ack(TRUE); } } else { switch ((unsigned char) args[-1]) { case getDefCmd: send_uml_def(com, rel); send_cpp_def(com, rel); send_java_def(com, rel); if (com->api_format() >= 34) { send_php_def(com, rel); if (com->api_format() >= 39) send_python_def(com, rel); } send_idl_def(com, rel); break; case getUmlDefCmd: send_uml_def(com, rel); break; case getCppDefCmd: send_uml_def(com, rel); send_cpp_def(com, rel); break; case getJavaDefCmd: send_uml_def(com, rel); send_java_def(com, rel); break; case getPhpDefCmd: send_uml_def(com, rel); send_php_def(com, rel); break; case getPythonDefCmd: send_uml_def(com, rel); send_python_def(com, rel); break; case getIdlDefCmd: send_uml_def(com, rel); send_idl_def(com, rel); break; case sideCmd: if (*args) start->write_id(com); else if (end != 0) end->write_id(com); else com->write_id(0); break; default: return FALSE; } } return TRUE; }
void AttributeData::read(char *& st, char *& k) { if (!strcmp(k, "class_attribute") || !strcmp(k, "class_attribut")) { isa_class_attribute = TRUE; k = read_keyword(st); } else isa_class_attribute = FALSE; if (!strcmp(k, "volatile")) { isa_volatile_attribute = TRUE; k = read_keyword(st); } else isa_volatile_attribute = FALSE; if (!strcmp(k, "const_attribute") || !strcmp(k, "const_attribut")) { isa_const_attribute = TRUE; k = read_keyword(st); } else isa_const_attribute = FALSE; if (!strcmp(k, "derivedunion")) { is_derived = TRUE; is_derivedunion = TRUE; k = read_keyword(st); } else if (!strcmp(k, "derived")) { is_derived = TRUE; is_derivedunion = FALSE; k = read_keyword(st); } else is_derived = is_derivedunion = FALSE; if (!strcmp(k, "ordered")) { is_ordered = TRUE; k = read_keyword(st); } else is_ordered = FALSE; if (!strcmp(k, "unique")) { is_unique = TRUE; k = read_keyword(st); } else is_unique = FALSE; uml_visibility = ::visibility(k); k = read_keyword(st); AType t; t.read(st, "type", "explicit_type", k); set_type(t); k = read_keyword(st); if (!strcmp(k, "multiplicity")) { multiplicity = read_string(st); k = read_keyword(st); } else multiplicity = 0; if (!strcmp(k, "init_value")) { init_value = QString(QTextCodec::codecForName(codec().toLatin1().constData())->fromUnicode(read_string(st))); // init_value = read_string(st); k = read_keyword(st); } else init_value = QString(); if (!strcmp(k, "constraint")) { constraint = read_string(st); k = read_keyword(st); } else constraint = QString(); BasicData::read(st, k); // updates k if (!strcmp(k, "cpp_volatile")) { // old version isa_volatile_attribute = TRUE; k = read_keyword(st); } if (!strcmp(k, "cpp_mutable")) { cpp_mutable = TRUE; k = read_keyword(st); } else cpp_mutable = FALSE; if (!strcmp(k, "cpp_visibility")) { cpp_visibility = ::visibility(read_keyword(st)); k = read_keyword(st); } else cpp_visibility = UmlDefaultVisibility; if (!strcmp(k, "cpp_decl")) { cpp_decl = read_string(st); k = read_keyword(st); } else cpp_decl = QString(); if (!strcmp(k, "transient")) { java_transient = TRUE; k = read_keyword(st); } else java_transient = FALSE; if (!strcmp(k, "java_decl")) { java_decl = read_string(st); k = read_keyword(st); } else java_decl = QString(); if (!strcmp(k, "java_annotation")) { java_annotation = read_string(st); k = read_keyword(st); } else java_annotation = QString(); if (!strcmp(k, "php_decl")) { php_decl = read_string(st); k = read_keyword(st); } else php_decl = QString(); if (!strcmp(k, "python_decl")) { python_decl = read_string(st); k = read_keyword(st); } else python_decl = QString(); if (!strcmp(k, "idl_case")) { set_idlcase(BrowserAttribute::read_ref(st), ""); k = read_keyword(st); } else if (!strcmp(k, "idl_explicit_case")) { set_idlcase(0, read_string(st)); k = read_keyword(st); } else set_idlcase(0, ""); if (!strcmp(k, "idl_decl")) { idl_decl = read_string(st); k = read_keyword(st); } else idl_decl = QString(); }
bool AttributeData::tool_cmd(ToolCom * com, const char * args, BrowserNode * bn, const QString & comment) { if (((unsigned char) args[-1]) >= firstSetCmd) { if (!bn->is_writable() && !root_permission()) com->write_ack(FALSE); else { switch ((unsigned char) args[-1]) { case setIsClassMemberCmd: isa_class_attribute = (*args != 0); break; case setIsVolatileCmd: isa_volatile_attribute = (*args != 0); break; case setVisibilityCmd: { UmlVisibility v; if (! com->get_visibility(v, args)) { com->write_ack(FALSE); return TRUE; } else uml_visibility = v; } break; case setMultiplicityCmd: multiplicity = args; break; case setConstraintCmd: constraint = args; break; case setCppDeclCmd: cpp_decl = args; break; case setJavaDeclCmd: java_decl = args; break; case setJavaAnnotationCmd: { WrapperStr s = args; s = s.stripWhiteSpace(); if (! s.isEmpty()) s += '\n'; java_annotation = s; } break; case setPhpDeclCmd: php_decl = args; break; case setPythonDeclCmd: python_decl = args; break; case setIdlDeclCmd: idl_decl = args; break; case setCppVisibilityCmd: { UmlVisibility v; if (! com->get_extended_visibility(v, args)) { com->write_ack(FALSE); return TRUE; } else cpp_visibility = v; } break; case setIsReadOnlyCmd: isa_const_attribute = (*args != 0); break; case setDefaultValueCmd: init_value = args; break; case setTypeCmd: { AType t; com->get_type(t, args); set_type(t); } break; case setIsCppMutableCmd: cpp_mutable = (*args != 0); break; case setIsJavaTransientCmd: java_transient = (*args != 0); break; case setIdlCaseCmd: { BrowserAttribute * at = (BrowserAttribute *) com->get_id(args); set_idlcase(at, args); } break; case setDerivedCmd: switch (*args) { case 0: is_derived = is_derivedunion = FALSE; break; case 1: is_derived = TRUE; is_derivedunion = FALSE; break; case 3: is_derived = is_derivedunion = TRUE; break; default: // derived union but non derived com->write_ack(FALSE); return TRUE; } break; case setOrderingCmd: is_ordered = (*args != 0); break; case setUniqueCmd: is_unique = (*args != 0); break; default: return BasicData::tool_cmd(com, args, bn, comment); } // ok case bn->modified(); bn->package_modified(); modified(); com->write_ack(TRUE); } return TRUE; } else return BasicData::tool_cmd(com, args, bn, comment); }